Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(argocd-apps): Support Template Patch to ApplicationSet #2549

Merged
merged 3 commits into from
Feb 25, 2024

Conversation

yu-croco
Copy link
Collaborator

@yu-croco yu-croco commented Feb 24, 2024

Resolves #2463

Checklist:

  • I have bumped the chart version according to versioning
  • I have updated the documentation according to documentation
  • I have updated the chart changelog with all the changes that come with this pull request according to changelog.
  • Any new values are backwards compatible and/or have sensible default.
  • I have signed off all my commits as required by DCO.
  • My build is green (troubleshooting builds).

Comment on lines +87 to +90
{{- with .templatePatch }}
templatePatch: |
{{- . | nindent 4 }}
{{- end }}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yu-croco yu-croco marked this pull request as ready for review February 24, 2024 12:31
Signed-off-by: yu-croco <yu.croco@gmail.com>
Copy link
Member

@mkilchhofer mkilchhofer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Rendered output
$ helm template . --values ci/applicationsets-values.yaml
---
# Source: argocd-apps/templates/applicationsets.yaml
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: applicationset
spec:
  generators:
    - git:
        directories:
        - path: guestbook
        - path: kustomize-*
        repoURL: https://github.com/argoproj/argocd-example-apps.git
        revision: HEAD
  ignoreApplicationDifferences:
    - jsonPointers:
      - /spec/syncPolicy
  syncPolicy:
    preserveResourcesOnDeletion: false
  template:
    metadata:
      name: '{{path.basename}}'
    spec:
      project: 'default'
      source:
        path: '{{path}}'
        repoURL: https://github.com/argoproj/argocd-example-apps.git
        targetRevision: HEAD
      destination:
        namespace: default
        server: https://kubernetes.default.svc
      syncPolicy:
        automated:
          prune: false
          selfHeal: false
      ignoreDifferences:
        - group: apps
          jsonPointers:
          - /spec/replicas
          kind: Deployment
      info:
        - name: url
          value: https://argoproj.github.io/
  templatePatch: |
    spec:
      source:
        helm:
          valueFiles:
          {{- range $valueFile := .valueFiles }}
            - {{ $valueFile }}
          {{- end }}
    {{- if .autoSync }}
      syncPolicy:
        automated:
          prune: {{ .prune }}
    {{- end }}
---
# Source: argocd-apps/templates/applicationsets.yaml
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: applicationset-list-generator
spec:
  generators:
    - list:
        elements:
        - cluster: engineering-dev
          url: https://kubernetes.default.svc
        template:
          metadata: {}
          spec:
            destination: {}
            project: '{{cluster}}'
            source:
              path: applicationset/examples/template-override/{{cluster}}-override
              repoURL: https://github.com/argoproj/argo-cd.git
              targetRevision: HEAD
  template:
    metadata:
      name: '{{cluster}}-guestbook'
    spec:
      project: '{{cluster}}'
      source:
        path: applicationset/examples/template-override/default
        repoURL: https://github.com/argoproj/argo-cd.git
        targetRevision: HEAD
      destination:
        namespace: guestbook
        server: '{{url}}'

@oscrx
Copy link
Contributor

oscrx commented Feb 25, 2024

LGTM

@pdrastil pdrastil merged commit fa85e82 into argoproj:main Feb 25, 2024
6 checks passed
@jwitko
Copy link

jwitko commented Feb 26, 2024

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

helm: argocd-apps chart should support templatePatch 2.10 feature
5 participants