Created
November 16, 2022 17:27
-
-
Save mathieu-benoit/b05019ed9a4b7f4d9faf86499c68d453 to your computer and use it in GitHub Desktop.
OCI with GitOps demo
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
#!/bin/bash | |
# setup | |
if [ ! -f demo-magic.sh ]; then | |
curl -LO https://github.com/paxtonhare/demo-magic/raw/master/demo-magic.sh | |
fi | |
. demo-magic.sh | |
clear | |
# demo cleanup | |
kubectl config use-context gke_mabenoit-cs-ui_northamerica-northeast1_gke | |
kubectl delete rootsyncs -A --all | |
kubectl delete constrainttemplates --all | |
kubectl delete constraints --all | |
# demo setup | |
rm -rf ~/ci-with-helm | |
git clone https://github.com/mathieu-benoit/ci-with-helm | |
cd ~/ci-with-helm/policies | |
cat <<EOF > policies-rootsync.yaml | |
apiVersion: configsync.gke.io/v1beta1 | |
kind: RootSync | |
metadata: | |
name: root-sync-policies | |
namespace: config-management-system | |
spec: | |
sourceFormat: unstructured | |
sourceType: oci | |
oci: | |
image: ghcr.io/mathieu-benoit/policies:0.1.0 | |
dir: . | |
auth: none | |
EOF | |
clear | |
# demo | |
pe "tree" | |
pe "cat privileged-containers/template.yaml" | |
pe "cat privileged-containers/samples/constraint.yaml" | |
pe "clear" | |
pe "kustomize build . > policies.yaml" | |
pe "tar -czf policies.tar.gz policies.yaml" | |
pe "oras push ghcr.io/mathieu-benoit/ci-with-helm/policies:0.1.0 policies.tar.gz" | |
pe "~/nomos status --contexts $(kubectl config current-context)" | |
pe "kubectl get constraints,constrainttemplates" | |
pe "clear" | |
pe "cat policies-rootsync.yaml" | |
pe "kubectl apply -f policies-rootsync.yaml" | |
pe "~/nomos status --contexts $(kubectl config current-context)" | |
pe "kubectl get constraints,constrainttemplates" | |
pe "~/nomos status --contexts $(kubectl config current-context)" | |
pe "kubectl get constraints,constrainttemplates" | |
pe "kubectl get constraints,constrainttemplates" | |
pe "kubectl create deployment nginx --image=nginx" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment