diff --git a/deploy/k3s/runner-it/README.md b/deploy/k3s/runner-it/README.md index 9bcddd5..a575d8f 100644 --- a/deploy/k3s/runner-it/README.md +++ b/deploy/k3s/runner-it/README.md @@ -87,6 +87,15 @@ runner termination can bypass cleanup; runner temp cleanup on the next job must still be retained. Merge both workflow and retry-action changes into `tapdata-it/main` together, since reusable action references use `@main`. +## Office scan Gitee SSH credentials + +The `runner-scan` and `runner-scan-common` Deployments mask the runner image's +legacy `/root/.ssh/id_rsa` with a read-only empty file. Workflows that need Gitee +SSH must use their own repository's `GITEE_SSH_KEY` and `GITEE_KNOWN_HOSTS` +Secrets in a job-scoped temporary directory, then remove that directory at job +completion. Do not bake or mount a Gitee private key into these shared runners; +otherwise jobs can inherit an identity from an earlier run. + The following runtime Secrets are intentionally not stored in Git: - `runner-it-auth`: GitHub organization runner registration credentials. diff --git a/deploy/k3s/runner-it/remaining-runners.yaml b/deploy/k3s/runner-it/remaining-runners.yaml index 81aa524..2e0e105 100644 --- a/deploy/k3s/runner-it/remaining-runners.yaml +++ b/deploy/k3s/runner-it/remaining-runners.yaml @@ -165,6 +165,14 @@ spec: hostAliases: - ip: 192.168.1.184 hostnames: [fileserver.tapdata.net, nexus.tapdata.net] + initContainers: + - name: mask-image-gitee-key + image: harbor.internal.tapdata.io/tapdata/github-action-runner:5.12 + imagePullPolicy: IfNotPresent + command: ["sh", "-ec", "umask 077; : > /ssh/id_rsa"] + volumeMounts: + - name: gitee-ssh-key + mountPath: /ssh containers: - name: runner image: harbor.internal.tapdata.io/tapdata/github-action-runner:5.12 @@ -197,6 +205,10 @@ spec: volumeMounts: - name: docker-sock mountPath: /var/run/docker.sock + - name: gitee-ssh-key + mountPath: /root/.ssh/id_rsa + subPath: id_rsa + readOnly: true - name: java-truststore mountPath: /usr/java/jdk-17.0.12/lib/security/cacerts subPath: cacerts @@ -210,6 +222,8 @@ spec: secret: secretName: runner-it-truststore defaultMode: 0444 + - name: gitee-ssh-key + emptyDir: {} --- apiVersion: apps/v1 kind: Deployment @@ -240,6 +254,14 @@ spec: hostAliases: - ip: 192.168.1.184 hostnames: [fileserver.tapdata.net, nexus.tapdata.net] + initContainers: + - name: mask-image-gitee-key + image: harbor.internal.tapdata.io/tapdata/github-action-runner:5.12 + imagePullPolicy: IfNotPresent + command: ["sh", "-ec", "umask 077; : > /ssh/id_rsa"] + volumeMounts: + - name: gitee-ssh-key + mountPath: /ssh containers: - name: runner image: harbor.internal.tapdata.io/tapdata/github-action-runner:5.12 @@ -272,11 +294,17 @@ spec: volumeMounts: - name: docker-sock mountPath: /var/run/docker.sock + - name: gitee-ssh-key + mountPath: /root/.ssh/id_rsa + subPath: id_rsa + readOnly: true volumes: - name: docker-sock hostPath: path: /run/podman/podman.sock type: Socket + - name: gitee-ssh-key + emptyDir: {} --- apiVersion: apps/v1 kind: Deployment