Last active
February 17, 2025 12:37
-
-
Save vfarcic/82e08206a786bc4373f7325af1d3fea9 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/vfarcic/82e08206a786bc4373f7325af1d3fea9 | |
################################################################################ | |
# Argo CD Synchronization is BROKEN! It Should Switch to Eventual Consistency! # | |
################################################################################ | |
# Additional Info: | |
# - Kubernetes Deployment Order: https://argoproj.github.io/cd/ | |
# - Kubernetes? Database Schema? Schema Management with Atlas Operator: https://youtu.be/1iZoEFzlvhM | |
# - Manage Kubernetes Secrets With External Secrets Operator (ESO): https://youtu.be/SyRZe5YVCVk | |
# - Argo CD - Applying GitOps Principles To Manage A Production Environment In Kubernetes: https://youtu.be/vpWQeoaiRM4 | |
# - How To Apply GitOps To Everything - Combining Argo CD And Crossplane: https://youtu.be/yrj4lmScKHQ | |
# - Mastering Argo CD Sync Waves: A Deep Dive into Effective GitOps Synchronization Strategies: https://youtu.be/LKuRtOTvlXk | |
# - Crossplane - GitOps-based Infrastructure as Code through Kubernetes API: https://youtu.be/n8KjVmuHm7A | |
# - How To Shift Left Infrastructure Management Using Crossplane Compositions: https://youtu.be/AtbS1u2j7po | |
# - Crossplane Composition Functions: Unleashing the Full Potential: https://youtu.be/jjtpEhvwgMw | |
######### | |
# Setup # | |
######### | |
git clone https://github.com/vfarcic/kubernetes-deployment-demo | |
cd kubernetes-deployment-demo | |
# Replace `[...]` with hyperscaler you'd like to use in the command that follows. Choices are: `aws` and `google`. Please open an issue if you'd like to add support for Azure or any other hyperscaler. | |
export HYPERSCALER=[...] | |
nix-shell --run $SHELL shell-$HYPERSCALER.nix | |
chmod +x setup.sh | |
./setup.sh | |
source .env | |
################################# | |
# Deployment Order with kubectl # | |
################################# | |
helm upgrade --install atlas-operator \ | |
oci://ghcr.io/ariga/charts/atlas-operator \ | |
--namespace atlas-operator --create-namespace | |
cat external-secrets/$HYPERSCALER.yaml | |
helm upgrade --install \ | |
external-secrets external-secrets/external-secrets \ | |
--namespace external-secrets --create-namespace \ | |
&& kubectl apply \ | |
--filename external-secrets/$HYPERSCALER.yaml | |
kubectl --namespace external-secrets \ | |
wait --for=condition=available \ | |
deployment external-secrets-webhook --timeout=600s | |
kubectl apply --filename external-secrets/$HYPERSCALER.yaml | |
################################# | |
# Deployment Order with Argo CD # | |
################################# | |
ls -1 infra/ | |
cat argocd-app.yaml | |
kubectl --namespace argocd apply --filename argocd-app.yaml | |
kubectl --namespace argocd port-forward svc/argocd-server 8080:80 | |
# Open http://localhost:8080 in a browser in a separate terminal session. Use `admin` as username and `admin123` as password. | |
# Enter the `infra` application and click the `Syncing` button. | |
# Press the `Terminate` button. | |
ls -1 infra-waves | |
cat infra-waves/crossplane.yaml | |
cat infra-waves/aws-config.yaml | |
kubectl --namespace argocd apply --filename argocd-app-waves.yaml | |
kubectl wait --for=condition=healthy provider.pkg.crossplane.io \ | |
--all --timeout=600s | |
kubectl apply --filename infra-waves | |
#################################### | |
# Deployment Order with Crossplane # | |
#################################### | |
cat cluster/$HYPERSCALER.yaml | |
kubectl --namespace a-team apply \ | |
--filename cluster/$HYPERSCALER.yaml | |
cat db/$HYPERSCALER.yaml | |
kubectl --namespace a-team apply --filename db/$HYPERSCALER.yaml | |
crossplane beta trace sqlclaim my-db --namespace a-team | |
crossplane beta trace clusterclaim cluster --namespace a-team | |
crossplane beta trace clusterclaim cluster --namespace a-team | |
# Wait until the status of all resources is `Available`. | |
crossplane beta trace sqlclaim my-db --namespace a-team | |
########### | |
# Destroy # | |
########### | |
./destroy.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment