argocd-autopilot icon indicating copy to clipboard operation
argocd-autopilot copied to clipboard

Support bootstrap with existing argocd installation

Open roi-codefresh opened this issue 3 years ago • 4 comments

roi-codefresh avatar Apr 29 '21 14:04 roi-codefresh

This would be a DR scenario, restoring everything from scratch, for example:

minikube delete
minikube create
argocd-autopilot repo bootstrap

Unfortunately this doesn't work. It seems autopilot assumes if must create the boostrap directory ;-(

$ argocd-autopilot repo bootstrap
INFO cloning repo: https://github.com/myspotontheweb/argocd-demo2.git 
Enumerating objects: 31, done.
Counting objects: 100% (31/31), done.
Compressing objects: 100% (29/29), done.
Total 31 (delta 10), reused 22 (delta 1), pack-reused 0
INFO using revision: "", installation path: ""    
FATAL folder bootstrap already exist in: /bootstrap 

PS

It's really nice to have a bootstrap command. The alternative is the following

#
# Clone repo
#
git clone [email protected]:myspotontheweb/argocd-demo1.git
cd argocd-demo1

#
# Bootstrap ArgoCD
# 
kustomize build bootstrap/argo-cd | kubectl apply -f -
kubectl apply -f bootstrap/argo-cd.yaml
kubectl apply -f bootstrap/root.yaml

#
# Recreate the autopilot secret
#
kubectl -n argocd create secret generic autopilot-secret --from-literal git_username=username --from-literal git-token=XXXXXX

#
# Get the admin password
#
kubectl get secret argocd-initial-admin-secret -n argocd -ogo-template='{{printf "%s\n" (index (index . "data") "password" | base64decode)}}'

myspotontheweb avatar May 09 '21 20:05 myspotontheweb

The alternative you supplied is almost identical to the output of the bootstrap. The main difference I can spot at the moment is that the bootstrap also creates an "autopilot-bootstrap" Argo CD Application that monitors the "bootstrap" folder (so there is no need to manually apply the two manifests in that folder. That can also be achieved with an argocd cli command (or even kubectl, if you want to pipe in the bootstrap app yaml)

noam-codefresh avatar May 10 '21 06:05 noam-codefresh

It will be extremely useful to have a command that does all of the above! @noam-codefresh I was looking at the code and it seems if you guys can expose the buildBootstrapManifests and some other functions, it makes it very versatile for us to do the bootstrapping of an existing repo.

It might be a good idea to have the bootstrap app as a default app in the app directory as a YAML manifest.

omidb avatar Jan 23 '22 22:01 omidb

As I just found out (D'oh!), this is now easily possible with the --recover flag of repo bootstrap:

argocd-autopilot repo bootstrap --recover

Saves a lot of manual work, so thanks for that being implemented.

WolframRavenwolf avatar Aug 05 '22 18:08 WolframRavenwolf