diff --git a/.github/workflows/helm-unittest.yml b/.github/workflows/helm-unittest.yml index 1a975ae..bfb380a 100644 --- a/.github/workflows/helm-unittest.yml +++ b/.github/workflows/helm-unittest.yml @@ -12,7 +12,7 @@ on: [push, pull_request] jobs: build: - name: Run helm lint over the chart + name: Run helm unittest over the chart # It has to be 24.04 because -latest has a podman version that is too old runs-on: ubuntu-24.04 @@ -20,6 +20,6 @@ jobs: - name: Checkout Code uses: actions/checkout@v6 - - name: Run make helmlint + - name: Run make helmunittest run: | make helm-unittest diff --git a/README.md b/README.md index b15fc3b..0d811f7 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ This chart is used to set up the basic building blocks in [Validated Patterns](h | clusterGroup.argoCD.resourceHealthChecks[1].group | string | `"serving.kserve.io"` | | | clusterGroup.argoCD.resourceHealthChecks[1].kind | string | `"InferenceService"` | | | clusterGroup.argoCD.resourceTrackingMethod | string | `"label"` | | +| clusterGroup.argoCD.volumes | list | `[]` | | | clusterGroup.extraObjects | object | `{}` | | | clusterGroup.imperative.activeDeadlineSeconds | int | `3600` | | | clusterGroup.imperative.adminClusterRoleName | string | `"imperative-admin-cluster-role"` | | diff --git a/templates/plumbing/argocd.yaml b/templates/plumbing/argocd.yaml index 89b69a2..0513c0d 100644 --- a/templates/plumbing/argocd.yaml +++ b/templates/plumbing/argocd.yaml @@ -99,6 +99,18 @@ spec: name: trusted-hub-bundle - emptyDir: {} name: ca-bundles +{{- if len $.Values.clusterGroup.argoCD.volumes }} +{{ toYaml $.Values.clusterGroup.argoCD.volumes | indent 4 }} +{{- end }} +{{- if len $.Values.clusterGroup.argoCD.configManagementPlugins }} + - emptyDir: {} + name: cmp-tmp +{{- range $cmp := $.Values.clusterGroup.argoCD.configManagementPlugins }} + - configMap: + name: "argocd-cmp-{{ $cmp.name }}" + name: {{ $cmp.name }} +{{- end }} +{{- end }} {{- if len $.Values.clusterGroup.argoCD.configManagementPlugins }} sidecarContainers: {{- range $cmp := $.Values.clusterGroup.argoCD.configManagementPlugins }} @@ -123,17 +135,10 @@ spec: subPath: plugin.yaml name: {{ $cmp.name }} {{- end }} +{{- if $cmp.volumeMounts }} +{{ toYaml $cmp.volumeMounts | indent 10 }} {{- end }} {{- end }} -{{- if len $.Values.clusterGroup.argoCD.configManagementPlugins }} - volumes: - - emptyDir: {} - name: cmp-tmp -{{- range $cmp := $.Values.clusterGroup.argoCD.configManagementPlugins }} - - configMap: - name: "argocd-cmp-{{ $cmp.name }}" - name: {{ $cmp.name }} -{{- end }} {{- end }} {{- if $.Values.clusterGroup.argoCD.resourceExclusions }} resourceExclusions: {{- $.Values.clusterGroup.argoCD.resourceExclusions | toYaml | indent 2 }} diff --git a/tests/argocd_cmp_test.yaml b/tests/argocd_cmp_test.yaml new file mode 100644 index 0000000..657aae2 --- /dev/null +++ b/tests/argocd_cmp_test.yaml @@ -0,0 +1,52 @@ +suite: Test argocd with configManagementPlugins +templates: + - templates/plumbing/argocd.yaml +release: + name: release-test +tests: + - it: should render the volumes and the sidecarContainer from CMP correctly + set: + clusterGroup: + argoCD: + configManagementPlugins: + - name: test-cmp + image: test-cmp-img + pluginConfig: | + test-cmp-config + volumeMounts: + - mountPath: /test + name: test-cmp-volumemount + documentIndex: 0 + asserts: + - contains: + path: spec.repo.volumes + content: + emptyDir: {} + name: cmp-tmp + - contains: + path: spec.repo.volumes + content: + configMap: + name: argocd-cmp-test-cmp + name: test-cmp + - contains: + path: spec.repo.sidecarContainers + content: + name: test-cmp + command: [/var/run/argocd/argocd-cmp-server] + image: test-cmp-img + imagePullPolicy: Always + securityContext: + runAsNonRoot: true + volumeMounts: + - mountPath: /var/run/argocd + name: var-files + - mountPath: /home/argocd/cmp-server/plugins + name: plugins + - mountPath: /tmp + name: cmp-tmp + - mountPath: /home/argocd/cmp-server/config/plugin.yaml + subPath: plugin.yaml + name: test-cmp + - mountPath: /test + name: test-cmp-volumemount diff --git a/tests/argocd_test.yaml b/tests/argocd_test.yaml index 249e525..3bd55fc 100644 --- a/tests/argocd_test.yaml +++ b/tests/argocd_test.yaml @@ -203,3 +203,32 @@ tests: - echo image: test name: test + + - it: should render volumes correctly when configManagementPlugins is set + set: + clusterGroup: + argoCD: + configManagementPlugins: + - name: test + image: test + pluginConfig: | + test + documentIndex: 0 + asserts: + - contains: + path: spec.repo.volumes + content: + configMap: + name: kube-root-ca.crt + name: kube-root-ca + - contains: + path: spec.repo.volumes + content: + emptyDir: {} + name: cmp-tmp + - contains: + path: spec.repo.volumes + content: + configMap: + name: argocd-cmp-test + name: test diff --git a/tests/argocd_volumes_test.yaml b/tests/argocd_volumes_test.yaml new file mode 100644 index 0000000..421cb3a --- /dev/null +++ b/tests/argocd_volumes_test.yaml @@ -0,0 +1,20 @@ +suite: Test argocd with volumes +templates: + - templates/plumbing/argocd.yaml +release: + name: release-test +tests: + - it: should render the additional custom volumes correctly + set: + clusterGroup: + argoCD: + volumes: + - emptyDir: {} + name: test + documentIndex: 0 + asserts: + - contains: + path: spec.repo.volumes + content: + emptyDir: {} + name: test diff --git a/values.schema.json b/values.schema.json index 1108fcb..d95470e 100644 --- a/values.schema.json +++ b/values.schema.json @@ -676,6 +676,10 @@ "type": "array", "description": "A list of initContainers to add to the repo-server if needed" }, + "volumes": { + "type": "array", + "description": "A list of volumes to add to the repo-server if needed" + }, "resourceTrackingMethod": { "type": "string", "description": "ResourceTrackingMethod defines how Argo CD should track resources that it manages", @@ -700,7 +704,7 @@ }, "ArgoCDConfigManagementPlugin": { "type": "object", - "additionalProperties": true, + "additionalProperties": false, "properties": { "name": { "type": "string", @@ -714,6 +718,10 @@ "type": "string", "description": "Image pull policy for the sidecar. Defaults to 'Always'" }, + "volumeMounts": { + "type": "array", + "description": "Additional volumeMounts for the sidecar" + }, "pluginConfig": { "type": "string", "description": "Configuration file to project into sidecar container. This will create a configMap if specified" diff --git a/values.yaml b/values.yaml index 5f92520..447ff13 100644 --- a/values.yaml +++ b/values.yaml @@ -30,6 +30,7 @@ clusterGroup: argoCD: initContainers: [] + volumes: [] configManagementPlugins: [] # resource tracking can be set to annotation, label, or annotation+label resourceTrackingMethod: label