Skip to content

Instantly share code, notes, and snippets.

@ralphotowo
Forked from vfarcic/57-argo-workflows.sh
Created October 17, 2021 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ralphotowo/f6eb1dde9a2b2e2013379b908fb5dc70 to your computer and use it in GitHub Desktop.
Save ralphotowo/f6eb1dde9a2b2e2013379b908fb5dc70 to your computer and use it in GitHub Desktop.
# Source: https://gist.github.com/28e2adb5946ca366d7845780608591d7
###########################################################
# Argo Workflows & Pipelines #
# CI/CD, Machine Learning, and Other Kubernetes Workflows #
# https://youtu.be/UMaivwrAyTA #
###########################################################
# Referenced videos:
# - Argo CD - Applying GitOps Principles To Manage Production Environment In Kubernetes: https://youtu.be/vpWQeoaiRM4
# - Argo Events - Event-Based Dependency Manager for Kubernetes: https://youtu.be/sUPkGChvD54
# - Argo Rollouts - Canary Deployments Made Easy In Kubernetes: https://youtu.be/84Ky0aPbHvY
# - Kaniko - Building Container Images In Kubernetes Without Docker: https://youtu.be/EgwVQN6GNJg
#########
# Setup #
#########
# It can be any Kubernetes cluster
minikube start
minikube addons enable ingress
git clone https://github.com/vfarcic/argocd-production.git
cd argocd-production
export REGISTRY_SERVER=https://index.docker.io/v1/
# Replace `[...]` with the registry username
export REGISTRY_USER=[...]
# Replace `[...]` with the registry password
export REGISTRY_PASS=[...]
# Replace `[...]` with the registry email
export REGISTRY_EMAIL=[...]
kubectl create namespace workflows
kubectl --namespace workflows \
create secret \
docker-registry regcred \
--docker-server=$REGISTRY_SERVER \
--docker-username=$REGISTRY_USER \
--docker-password=$REGISTRY_PASS \
--docker-email=$REGISTRY_EMAIL
# If NOT using minikube, change the value to whatever is the address in your cluster
export ARGO_WORKFLOWS_HOST=argo-workflows.$(minikube ip).nip.io
cat argo-workflows/base/ingress_patch.json \
| sed -e "s@acme.com@$ARGO_WORKFLOWS_HOST@g" \
| tee argo-workflows/overlays/production/ingress_patch.json
kustomize build \
argo-workflows/overlays/production \
| kubectl apply --filename -
kubectl --namespace argo \
rollout status \
deployment argo-server \
--watch
cd ..
#############
# Workflows #
#############
git clone \
https://github.com/vfarcic/argo-workflows-demo.git
cd argo-workflows-demo
cat workflows/silly.yaml
cat workflows/parallel.yaml
cat workflows/dag.yaml
#############
# Templates #
#############
cat workflows/cd-mock.yaml
cat workflow-templates/container-image.yaml
kubectl --namespace workflows apply \
--filename workflow-templates/container-image.yaml
kubectl --namespace workflows \
get clusterworkflowtemplates
########################
# Submitting workflows #
########################
cat workflows/cd-mock.yaml \
| sed -e "s@value: vfarcic@value: $REGISTRY_USER@g" \
| tee workflows/cd-mock.yaml
argo --namespace workflows submit \
workflows/cd-mock.yaml
argo --namespace workflows list
argo --namespace workflows \
get @latest
argo --namespace workflows \
logs @latest \
--follow
open http://$ARGO_WORKFLOWS_HOST
kubectl --namespace workflows get pods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment