Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Created October 19, 2020 14:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vfarcic/5d34a90273aa305fb23f8d8cdb57e3ac to your computer and use it in GitHub Desktop.
Save vfarcic/5d34a90273aa305fb23f8d8cdb57e3ac to your computer and use it in GitHub Desktop.
##############################################################################################
# Managing Kubernetes Production Environment Using Argo CD With A Bit Of Helm From Codefresh #
##############################################################################################
#######################################
# Defining The Production Environment #
#######################################
open https://github.com/vfarcic/argocd-production
# Replace `[...]` with the GitHub organization
export GH_ORG=[...]
git clone https://github.com/$GH_ORG/argocd-production.git
cd argocd-production
cat argocd/apps.yaml
cat argocd/apps.yaml \
| sed -e "s@vfarcic@$GH_ORG@g" \
| tee argocd/apps.yaml
###############################################################
# Converging The Actual Into The Desired State With Codefresh #
###############################################################
codefresh get clusters
export CF_CLUSTER=[...]
codefresh get contexts
export CF_GIT_CONTEXT=[...]
codefresh get projects
export CF_PROJECT=[...]
cat orig/argocd-pipeline.yaml
cp orig/argocd-pipeline.yaml \
argocd/codefresh.yml
cat argocd/codefresh.yml \
| sed -e "s@CF_PROJECT@$CF_PROJECT@g" \
| sed -e "s@CF_GIT_CONTEXT@$CF_GIT_CONTEXT@g" \
| sed -e "s@CF_CLUSTER@$CF_CLUSTER@g" \
| sed -e "s@GH_ORG@$GH_ORG@g" \
| tee argocd/codefresh.yml
codefresh create pipeline \
-f argocd/codefresh.yml
codefresh get pipelines
git add .
git commit -m "Adding app of apps"
git push
codefresh get builds \
--pipeline-name argocd-production
export BUILD_ID=[...]
codefresh logs $BUILD_ID -f
###########################
# Observing What Happened #
###########################
kubectl --namespace argocd \
get applications
kubectl --namespace production get all
export ARGOCD_HOST=$(kubectl \
--namespace argocd \
get ingress argocd-server \
--output jsonpath="{.spec.rules[0].host}")
# Might need to change to https
open http://$ARGOCD_HOST
cd ..
##############################
# Destroying What We Created #
##############################
codefresh delete pipeline \
devops-catalog/argocd-production
# Destroy the cluster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment