Argocd: Difference between revisions

From Halfface
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 39: Line 39:
Deny scheduling of application
Deny scheduling of application
  argocd proj windows add default --kind deny --schedule "* * * * *" --duration 2m --applications "*"
  argocd proj windows add default --kind deny --schedule "* * * * *" --duration 2m --applications "*"
argocd proj list | grep -v ^NAME | awk '{print $1}' | while read i ; do echo '*' $i ; argocd proj windows add $i --kind deny --schedule "* * * * *" --duration 2m --applications "*" ; done
Remove deny of scheduling
Remove deny of scheduling
  argocd proj windows delete default 0
  argocd proj windows delete default 0
Line 48: Line 49:


=delete apps=
=delete apps=
  argocd app list | grep -v ^NAME | awk '{print $1}' | while read i ; do echo '*' $i ; argocd --grpc-web app delete "${i}" ; done
  argocd app list | grep -v ^NAME | awk '{print $1}' | while read i ; do echo '*' $i ; argocd --grpc-web app delete -y "${i}" ; done


=remove finalizers=
=remove finalizers=
  oc get app --no-headers | awk '{print $1}' | while read i ; do echo '*' $i ; oc patch --type=merge app $i -p '{"metadata":{"finalizers":null}}' ; done
  oc get app --no-headers | awk '{print $1}' | while read i ; do echo '*' $i ; oc patch --type=merge app $i -p '{"metadata":{"finalizers":null}}' ; done

Latest revision as of 14:04, 4 March 2024

What does it mean?

argo cd          Argo continuous delivery
Application      Is a group of Kubernetes resources as defined by a manifest.
ApplicationSet   Is the representation of an ApplicationSet controller deployment.
AppProject       Is a logical grouping of Argo CD Applications.

download binary

sudo curl -sSL https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64 -o /usr/local/bin/argocd ; sudo chmod 755 /usr/local/bin/argocd

login

argocd login openshift-gitops-server-openshift-gitops.apps.$(oc get DNS cluster -o=jsonpath='{.spec.baseDomain}') --username kubeadmin --password <password> --sso --insecure

get admin password

oc -n argocd get secret argocd-cluster -o jsonpath='{.data.admin\.password}' -n argocd | base64 -d

add repo to argocd

argocd repo add https://inter.net/spam.git --username <username> --password <password> --insecure-skip-server-verification

file completion

. <(argocd completion bash)

add constant variables

export ARGOCD_OPTS="--grpc-web"

list applications

argocd app list

list app projects

argocd proj list

sync application

argocd --grpc-web app sync openshift-gitops/rb-infra-ocp-02

Sync all apps.

argocd app list | grep -v ^NAME | awk '{print $1}' | while read i ; do echo '*' $i ; argocd --grpc-web app sync "${i}" ; done

what does it mean

ApplicationSet               Automating the generation of Argo CD Applications with the ApplicationSet Controller

look at attributes

oc api-resources | grep -Ei 'argo|git' | while read line end ; do echo '***' $line $end ; oc get $line -A ; done

prevent argocd from syncing

Deny scheduling of application

argocd proj windows add default --kind deny --schedule "* * * * *" --duration 2m --applications "*"
argocd proj list | grep -v ^NAME | awk '{print $1}' | while read i ; do echo '*' $i ; argocd proj windows add $i --kind deny --schedule "* * * * *" --duration 2m --applications "*" ; done

Remove deny of scheduling

argocd proj windows delete default 0

Toggle allow/deny manual syncing.

argocd proj windows enable-manual-sync default 0
argocd proj windows disable-manual-sync default 0

Look at status of project

argocd proj list | grep -v ^NAME | awk '{print $1}' | while read i ; do echo '*' $i ; argocd proj windows list  $i ; done

delete apps

argocd app list | grep -v ^NAME | awk '{print $1}' | while read i ; do echo '*' $i ; argocd --grpc-web app delete -y "${i}" ; done

remove finalizers

oc get app --no-headers | awk '{print $1}' | while read i ; do echo '*' $i ; oc patch --type=merge app $i -p '{"metadata":{"finalizers":null}}' ; done