diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index e29b4871..2eb2beb1 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -59,10 +59,11 @@ jobs: if: steps.list-changed.outputs.changed == 'true' with: config: .github/configs/kind-config.yaml - + - name: Deploy latest ArgoCD CRDs when testing ArgoCD extensions if: | - contains(steps.list-changed.outputs.changed_charts, 'argocd-image-updater') + contains(steps.list-changed.outputs.changed_charts, 'argocd-image-updater') || + contains(steps.list-changed.outputs.changed_charts, 'argocd-apps') run: | helm repo add dandydeveloper https://dandydeveloper.github.io/charts/ helm dependency build charts/argo-cd/ diff --git a/charts/argocd-apps/Chart.yaml b/charts/argocd-apps/Chart.yaml index 6a3fda06..c304fee2 100644 --- a/charts/argocd-apps/Chart.yaml +++ b/charts/argocd-apps/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: argocd-apps description: A Helm chart for managing additional Argo CD Applications and Projects type: application -version: 0.0.1 +version: 0.0.2 home: https://github.com/argoproj/argo-helm icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png keywords: @@ -14,4 +14,4 @@ maintainers: url: https://argoproj.github.io/ annotations: artifacthub.io/changes: | - - "[Added]: Add additional Applications and Projects" + - "[Added]: Add ApplicationSets" diff --git a/charts/argocd-apps/README.md b/charts/argocd-apps/README.md index ea205caa..991f55b2 100644 --- a/charts/argocd-apps/README.md +++ b/charts/argocd-apps/README.md @@ -25,6 +25,7 @@ $ helm install my-release argo/argocd-apps | Key | Type | Default | Description | |-----|------|---------|-------------| | applications | list | `[]` (See [values.yaml]) | Deploy Argo CD Applications within this helm release | +| applicationsets | list | `[]` (See [values.yaml]) | Deploy Argo CD ApplicationSets within this helm release | | projects | list | `[]` (See [values.yaml]) | Deploy Argo CD Projects within this helm release | ---------------------------------------------- diff --git a/charts/argocd-apps/ci/applicationsets-values.yaml b/charts/argocd-apps/ci/applicationsets-values.yaml new file mode 100644 index 00000000..a76ed41a --- /dev/null +++ b/charts/argocd-apps/ci/applicationsets-values.yaml @@ -0,0 +1,45 @@ +# Test with applicationsets + +applicationsets: +- name: guestbook + namespace: default # Only for test purpose. + additionalLabels: {} + additionalAnnotations: {} + # See PR #10026 (ArgoCD v2.5 or later) + # goTemplate: false + generators: + - git: + repoURL: https://github.com/argoproj/argocd-example-apps.git + revision: HEAD + directories: + - path: guestbook + - path: kustomize-* + template: + metadata: + name: '{{path.basename}}' + labels: {} + annotations: {} + spec: + project: default + source: + repoURL: https://github.com/argoproj/argocd-example-apps.git + targetRevision: HEAD + path: '{{path}}' + destination: + server: https://kubernetes.default.svc + namespace: default + syncPolicy: + automated: + prune: false + selfHeal: false + ignoreDifferences: + - group: apps + kind: Deployment + jsonPointers: + - /spec/replicas + info: + - name: url + value: https://argoproj.github.io/ + syncPolicy: + # Set Application finalizer + preserveResourcesOnDeletion: false diff --git a/charts/argocd-apps/templates/applicationsets.yaml b/charts/argocd-apps/templates/applicationsets.yaml new file mode 100644 index 00000000..20898d0a --- /dev/null +++ b/charts/argocd-apps/templates/applicationsets.yaml @@ -0,0 +1,73 @@ + +{{- range .Values.applicationsets }} +--- +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + {{- with .additionalAnnotations }} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} + {{- with .additionalLabels }} + labels: + {{- toYaml . | nindent 4 }} + {{- end }} + name: {{ .name }} + {{- with .namespace }} + namespace: {{ . }} + {{- end }} +spec: + {{- if hasKey . "goTemplate" }} + goTemplate: {{ .goTemplate }} + {{- end }} + {{- with .generators }} + generators: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .syncPolicy }} + syncPolicy: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .template }} + template: + {{- with .metadata }} + metadata: + {{- with .annotations }} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ $value | squote }} + {{- end }} + {{- end }} + {{- with .labels }} + labels: + {{- toYaml . | nindent 8 }} + {{- end }} + name: {{ .name | squote }} + {{- with .namespace }} + namespace: {{ . | squote }} + {{- end }} + {{- end }} + {{- with .spec }} + spec: + project: {{ tpl .project $ }} + source: + {{- toYaml .source | nindent 8 }} + destination: + {{- toYaml .destination | nindent 8 }} + {{- with .syncPolicy }} + syncPolicy: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .ignoreDifferences }} + ignoreDifferences: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .info }} + info: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- end -}} + {{- end }} +{{- end }} diff --git a/charts/argocd-apps/values.yaml b/charts/argocd-apps/values.yaml index ec3cbb41..0421a377 100644 --- a/charts/argocd-apps/values.yaml +++ b/charts/argocd-apps/values.yaml @@ -74,3 +74,50 @@ projects: [] # manualSync: true # signatureKeys: # - keyID: ABCDEF1234567890 + +# -- Deploy Argo CD ApplicationSets within this helm release +# @default -- `[]` (See [values.yaml]) +## Ref: https://argo-cd.readthedocs.io/en/stable/operator-manual/applicationset/ +applicationsets: [] +# - name: guestbook +# namespace: argocd +# additionalLabels: {} +# additionalAnnotations: {} +# # See PR #10026 (ArgoCD v2.5 or later) +# # goTemplate: false +# generators: +# - git: +# repoURL: https://github.com/argoproj/argocd-example-apps.git +# revision: HEAD +# directories: +# - path: guestbook +# - path: kustomize-* +# template: +# metadata: +# name: '{{path.basename}}' +# labels: {} +# annotations: {} +# spec: +# project: default +# source: +# repoURL: https://github.com/argoproj/argocd-example-apps.git +# targetRevision: HEAD +# path: '{{path}}' +# destination: +# server: https://kubernetes.default.svc +# namespace: default +# syncPolicy: +# automated: +# prune: false +# selfHeal: false +# ignoreDifferences: +# - group: apps +# kind: Deployment +# jsonPointers: +# - /spec/replicas +# info: +# - name: url +# value: https://argoproj.github.io/ +# syncPolicy: +# # Set Application finalizer +# preserveResourcesOnDeletion: false