Last active
January 18, 2022 00:24
-
-
Save vfarcic/050dfd04db243f0344093fbaa85f39be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source: https://gist.github.com/050dfd04db243f0344093fbaa85f39be | |
####################################################################################################################################################################################################### | |
# Installing And Managing Argo CD Through Continuous Delivery Pipelines Using Codefresh With Google Kubernetes Engine (GKE), AWS Elastic Kubernetes Service (EKS), And Azure Kubernetes Service (AKS) # | |
####################################################################################################################################################################################################### | |
TODO: Link to the previous articles | |
######################## | |
# Setting Up The Scene # | |
######################## | |
codefresh auth \ | |
create-context devops-catalog \ | |
--api-key [...] | |
# Gists with the instructions how to recreate the cluster. | |
# GKE: https://gist.github.com/0f8ba1ee61d0fe08f4d9290a17145440 (gke-codefresh.sh) | |
# EKS: https://gist.github.com/ddfa70d992a0a92ba63b591e72aaa6a6 (eks-codefresh.sh) | |
# AKS: https://gist.github.com/fc32da271b7648e3db6e040401353cc5 (aks-codefresh.sh) | |
# Replace `[...]` with the k8s platform (e.g., `gke`, `eks`, or `aks`) | |
export K8S_PLATFORM=[...] | |
cd cf-terraform-$K8S_PLATFORM | |
terraform init | |
cat get-kubeconfig.sh | |
chmod +x get-kubeconfig.sh | |
# Only if EKS | |
./get-kubeconfig.sh \ | |
$(terraform output cluster_name) \ | |
$(terraform output region) | |
# Only if AKS | |
./get-kubeconfig.sh \ | |
$(terraform output cluster_name) \ | |
$(terraform output resource_group) | |
# Only if GKE | |
./get-kubeconfig.sh \ | |
$(terraform output cluster_name) \ | |
$(terraform output region) \ | |
$(terraform output project_id) | |
# Only if GKE | |
export GOOGLE_APPLICATION_CREDENTIALS=$PWD/account.json | |
export KUBECONFIG=kubeconfig.yaml | |
kubectl get nodes | |
####################################################################### | |
# Installing And Managing Argo CD Using Continuous Delivery Pipelines # | |
####################################################################### | |
cp orig/codefresh-argocd.yml \ | |
codefresh.yml | |
cat codefresh.yml | |
cp orig/argocd-values.yaml \ | |
argocd-values.yaml | |
cat argocd-values.yaml | |
# Only if GKE or AKS | |
export INGRESS_HOST=$(kubectl \ | |
--namespace ingress-nginx \ | |
get svc ingress-nginx-controller \ | |
--output jsonpath="{.status.loadBalancer.ingress[0].ip}") | |
# Only if EKS | |
export INGRESS_HOSTNAME=$(kubectl \ | |
--namespace ingress-nginx \ | |
get svc ingress-nginx-controller \ | |
--output jsonpath="{.status.loadBalancer.ingress[0].hostname}") | |
# Only if EKS | |
export INGRESS_HOST=$(\ | |
dig +short $INGRESS_HOSTNAME) | |
echo $INGRESS_HOST | |
export ARGO_ADDR=argocd.$INGRESS_HOST.xip.io | |
cat argocd-values.yaml \ | |
| sed -e "s@acme.com@$ARGO_ADDR@g" \ | |
| tee argocd-values.yaml | |
git add . | |
git commit -m "Adding Argo CD" | |
git push | |
codefresh get builds \ | |
--pipeline-name cf-terraform-$K8S_PLATFORM | |
export BUILD_ID=[...] | |
codefresh logs $BUILD_ID -f | |
kubectl --namespace argocd get pods | |
kubectl --namespace argocd get ingresses | |
export PASS=$(kubectl --namespace argocd \ | |
get pods \ | |
--selector app.kubernetes.io/name=argocd-server \ | |
--output name \ | |
| cut -d'/' -f 2) | |
argocd login \ | |
--insecure \ | |
--username admin \ | |
--password $PASS \ | |
--grpc-web \ | |
argocd.$INGRESS_HOST.xip.io | |
echo $PASS | |
argocd account update-password | |
open http://$ARGO_ADDR | |
########################### | |
# What Should We Do Next? # | |
########################### | |
cat codefresh.yml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment