argocd-autopilot
argocd-autopilot copied to clipboard
Support bootstrap with existing argocd installation
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)}}'
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)
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.
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.