Skip to content

Remove extra condition on cache secret

Mitchell Nielsen requested to merge revert-deployment-cache-secret-condition into main

What does this MR do?

Remove extra condition on cache secret

Removes the extra condition on mounting the Runner cache secret
to better align with the original state prior to
https://gitlab.com/gitlab-org/charts/gitlab-runner/-/merge_requests/393
and
https://gitlab.com/gitlab-org/charts/gitlab-runner/-/merge_requests/406.

Worth noting: this extra check to confirm that the key/map isn't empty isn't really necessary. If the key/map is empty, then if include-ing the template will render nothing anyway.

Why was this MR needed?

The Helm Charts override this template to include the MinIO Secret if
MinIO is enabled.

Further context:
https://gitlab.com/gitlab-org/charts/gitlab-runner/-/issues/460#note_1425750980

What's the best way to test this MR?

Confirm that the cache secret is not mounted when not specified:

$ helm template test . --show-only=templates/deployment.yaml | yq '.spec.template.spec.volumes[] | select(.name=="projected-secrets") | .projected.sources'
- secret:
    name: "test-gitlab-runner"
    items:
      - key: runner-registration-token
        path: runner-registration-token
      - key: runner-token
        path: runner-token

Confirm that the cache secret is mounted when specified:

$ helm template test . --set runners.cache.secretName=mycachesecret --show-only=templates/deployment.yaml | yq '.spec.template.spec.volumes[] | select(.name=="projected-secrets") | .projected.sources'
- secret:
    name: "mycachesecret"
- secret:
    name: "test-gitlab-runner"
    items:
      - key: runner-registration-token
        path: runner-registration-token
      - key: runner-token
        path: runner-token

What are the relevant issue numbers?

Closes #460 (closed)

Merge request reports

Loading