actions / actions-runner-controller

Kubernetes controller for GitHub Actions self-hosted runners
Apache License 2.0
4.73k stars 1.12k forks source link

Can't use underscore in "runnerScaleSetName" on the helm charts #3095

Open thomassandslyst opened 11 months ago

thomassandslyst commented 11 months ago

Checks

Controller Version

0.6.1

Deployment Method

ArgoCD

Checks

To Reproduce

1. Set "runnerScaleSetName" to any word containing an underscore such as "x86_64"
2. Attempt to apply the chart

Describe the bug

"runnerScaleSetName" (defined as "gha-runner-scale-set.scale-set-name" in _helpers.tpl) is tightly bound to several values in the metadata including resource names, this limits the Github Actions label resulting from this to the k8s' RFC 1123 naming scheme which restricts it to lower case only and no underscores.

This is troublesome as many descriptive labels, such as architectures, contain capital letters or underscores such as "x86_64".

I suggest decoupling runnerScaleSetName and instead relying on "gha-runner-scale-set.name" in _helpers.tpl which should be set by the helm release name or by a separate name value.

Describe the expected behavior

"runnerScaleSetName" should be able to be set in the helm chart to any combination of characters supported by Github Actions.

Additional Context

gha-runner-scale-set:
  githubConfigUrl: ########
  maxRunners: 20
  minRunners: 0
  runnerGroup: "Default"
  runnerScaleSetName: "x86_64"

  controllerServiceAccount:
    namespace: gha-runner-scale-set
    name: gha-runner-scale-set-controller-gha-rs-controller

  template:
    spec:
      nodeSelector:
        kubernetes.io/arch: amd64
        # Fixed zone due to EBS cache
        topology.kubernetes.io/zone: eu-west-1a

      shareProcessNamespace: True # For EBS cache script information sharing
      initContainers:
        - name: init-dind-externals
          image: ghcr.io/actions/actions-runner:latest
          command:
            [
              "cp",
              "-r",
              "-v",
              "/home/runner/externals/.",
              "/home/runner/tmpDir/",
            ]
          volumeMounts:
            - name: dind-externals
              mountPath: /home/runner/tmpDir

      containers:
        - name: runner
          image: ######
          imagePullPolicy: Always
          command: ["/home/runner/run.sh"]
          env:
            - name: DOCKER_HOST
              value: unix:///run/docker/docker.sock
            - name: "ACTIONS_RUNNER_HOOK_JOB_STARTED"
              value: "/usr/bin/cache-init.sh"
          volumeMounts:
            - name: work
              mountPath: /home/runner/_work
            - name: dind-sock
              mountPath: /run/docker
              readOnly: true
            - mountPath: "/home/runner/.dockercreds"
              name: dockercreds
              readOnly: true
          resources:
            limits:
              cpu: "2"
              memory: "8Gi"
            requests:
              cpu: 500m
              memory: "2Gi"
          lifecycle:
            postStart:
              exec:
                command:
                  - /bin/sh
                  - -c
                  - mkdir -p ~/.docker && cp ~/.dockercreds/config.json ~/.docker/config.json
        - name: dind
          image: docker:dind
          imagePullPolicy: Always
          env:
            - name: DOCKER_GROUP_GID
              value: "123"
          securityContext:
            privileged: true
          volumeMounts:
            - name: work
              mountPath: /home/runner/_work
            - name: dind-sock
              mountPath: /run/docker
            - name: dind-externals
              mountPath: /home/runner/externals
          resources:
            limits:
              cpu: "2"
              memory: "8Gi"
            requests:
              cpu: 500m
              memory: "2Gi"
      volumes:
        - name: work
          emptyDir: {}
        - name: dind-sock
          emptyDir: {}
        - name: dind-externals
          emptyDir: {}
        - name: dockercreds
          secret:
            secretName: dockercreds

Controller Logs

Helm chart issue, controller logs not applicable. Here's the apply error instead:

one or more objects failed to apply, reason: ServiceAccount "x86_64-gha-rs-no-permission" is invalid: metadata.name: Invalid value: "x86_64-gha-rs-no-permission": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'),Secret "x86_64-gha-rs-github-secret" is invalid: metadata.name: Invalid value: "x86_64-gha-rs-github-secret": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'),AutoscalingRunnerSet.actions.github.com "x86_64" is invalid: metadata.name: Invalid value: "x86_64": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')

Runner Pod Logs

Helm chart issue, Pod logs not applicable
github-actions[bot] commented 11 months ago

Hello! Thank you for filing an issue.

The maintainers will triage your issue shortly.

In the meantime, please take a look at the troubleshooting guide for bug reports.

If this is a feature request, please review our contribution guidelines.