argoproj-labs / argocd-autopilot

Argo-CD Autopilot
https://argocd-autopilot.readthedocs.io/en/stable/
Apache License 2.0
868 stars 119 forks source link

How to specify ArgoCD version to use? #557

Closed AlexEndris closed 5 months ago

AlexEndris commented 5 months ago

Hi, currently, the version 0.4.17 of argocd-autopilot links to the install script in the master branch of the argocd repository. How can I specify which version of argocd (not autopilot) to use?

It would be very helpful if we could control updates and upgrades of argocd this way, instead of always linking to the master branch.

Maybe it's already possible, and I'm just missing something, but if not, that would be truly handy!

Thanks!

diogosilva30 commented 5 months ago

I have the same question 🤔

My ArgoCD was bumped to 2.10, which introduced a bug https://github.com/argoproj/argo-cd/issues/17016 , and I'd like to rollback to an older version

noam-codefresh commented 5 months ago

you can install using

argocd-autopilot repo bootstrap --app https://raw.githubusercontent.com/argoproj/argo-cd/v2.9.6/manifests/install.yaml

(or use any other url for a speific argo-cd version, or even your own fork)

to override the default argo-cd app specifier that installs the current stable version (defaults to https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml)

please re-open if this isn't what you asked for.

AlexEndris commented 5 months ago

@noam-codefresh Is this also how you'd upgrade form a specific version to another one? If so, then this is what I've asked for.

noam-codefresh commented 5 months ago

after bootstrapping a new repository (with the default settings), the bootstrap/argo-cd/kustomization.yaml file will have a resource reference to github.com/argoproj-labs/argocd-autopilot/manifests/base?ref=v0.4.17 (right now, when the autopilot stable version is v0.4.17) that references this file.

if you replace this resource reference with https://raw.githubusercontent.com/argoproj/argo-cd/v2.9.6/manifests/install.yaml (for example), it will replace your argo-cd installation to v2.9.6.

you will need to copy over the following patches into your repo's kustomzation file:

configMapGenerator:
  - name: argocd-cm
    behavior: merge
    literals:
      - "timeout.reconciliation=15s"

patches:
  # reset the crbs to `subject.namespace: default`, so that argo-cd will later change them to the actual ns
  - target:
      group: rbac.authorization.k8s.io
      version: v1
      kind: ClusterRoleBinding
    patch: |-
      - op: replace
        path: /subjects/0/namespace
        value: default

the first patch will change the default reconciliation timeout to 15s. the second patch is important if you install to a non-default (argocd) namespace. if you do not have this patch, the clusterRoles will not give the permissions to the right serviceAccount.

AlexEndris commented 5 months ago

Thanks, @noam-codefresh. That's what I understood and would have done. I just thought this would be more of a workaround, rather than intended.

noam-codefresh commented 5 months ago

thank you @AlexEndris for helping me realize we have an issue -

while writing my reply i realized that actually installing with --app <some-other-argocd-version> --namespace <some-other-namespace> will result in a broken installation, because of those missing patches (the 2nd one is the important one, actually). we should have an issue about it, and make sure the patch is in there, in case the kustomization is not going through the standard base reference.

do you want to open an issue about it?

AlexEndris commented 5 months ago

@noam-codefresh Done :) Glad to be of help with asking seemingly stupid questions 👍🏻