actions / actions-runner-controller

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

Trim volume and container helpers in gha-runner-scale-set #3807

Open pvickery-ParamountCommerce opened 1 week ago

pvickery-ParamountCommerce commented 1 week ago

In gha-runner-scale-set, some newlines are being unnecessarily added to items in lists. This PR helps cleanup newlines added to template.spec.volumes and template.spec.containers.volumeMounts.

Here is an example using version 0.9.3. Below is the values.yaml file.

template:
  spec:
    containers:
      - name: test
        volumeMounts:
          - name: test
            mountPath: /path
            subPath: file
    volumes:
      - name: test
        secret:
          secretName: secret
          items:
            - key: file
              path: file

This was the resulting manifest for AutoscalingRunnerSet. There are newlines added in the items for template.spec.volumes and template.spec.containers.volumeMounts. The newlines are removed while maintaining proper indentation with this PR.

kind: AutoscalingRunnerSet
...
template:
  spec:
    volumes:
      - name: dind-sock
        emptyDir: {}
      - name: dind-externals
        emptyDir: {}

      - name: work
        emptyDir: {}

      - 
        name: test
        secret:
          items:
          - key: file
            path: file
          secretName: secret

    containers:
      - name: test
        volumeMounts:
          - 
            mountPath: /path
            name: test
            subPath: file
          - name: work
            mountPath: /home/runner/_work
          - name: dind-sock
            mountPath: /var/run