argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.77k stars 5.42k forks source link

how to sync applicationset #10721

Open dgsfor opened 2 years ago

dgsfor commented 2 years ago

I am use applicationset to manage application,but how to sync applicationset when applicationset was update(such as update the imageversion). Currently I use kubectl apply -f applicationset.yaml to update.

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: php-pre
  namespace: argocd
spec:
  generators:
  - clusters:
      selector:
        matchLabels:
          clusterName: hongkong
      values:
        imageversion: pre-1.1.1-20220928-030739
  - clusters:
      selector:
        matchLabels:
          clusterName: korea
      values:
        imageversion: pre-1.1.1-20220928-030739
  template:
    metadata:
      name: '{{values.sname}}-php-pre'
    spec:
      project: default
      source:
        repoURL: *******
        targetRevision: master
        path: master
        helm:
          parameters:
            - name: 'deployment.imageversion'
              value: "{{values.imageversion}}"
          valueFiles:
            - values.yaml
      destination:
        server: '{{server}}'
      syncPolicy:
        automated:
          prune: false
          selfHeal: true
        syncOptions:
          - ApplyOutOfSyncOnly=true
crenshaw-dev commented 2 years ago

You can kubectl apply, or add the applicationset to an application and manage synchronization via gitops.

You could also use a merge generator and pull the current image version from a git generator to combine with your cluster generator.

cacosub7 commented 1 year ago

add the applicationset to an application and manage synchronization via gitops.

How to manage an ApplicationSet through an application? After reviewing the documentation on Argo CD's ApplicationSet, it seems that I haven't found any synchronization methods other than using the CLI tool.

crenshaw-dev commented 1 year ago

How to manage an ApplicationSet through an application?

The same way you would any other resource. Create an Application, point it at a repo, and put the ApplicationSet spec in that repo.