Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Created September 23, 2024 10:31
Show Gist options
  • Save vfarcic/9933af2ce1e972298b9cc87bec62ab8d to your computer and use it in GitHub Desktop.
Save vfarcic/9933af2ce1e972298b9cc87bec62ab8d to your computer and use it in GitHub Desktop.

Intro

FIXME: https://github.com/crossplane-contrib/function-status-transformer

Setup

git clone https://github.com/vfarcic/crossplane-sql

cd crossplane-sql

git pull

git fetch

git checkout status-transformer

Make sure that Docker is up-and-running. We'll use it to create a KinD cluster.

Watch Nix for Everyone: Unleash Devbox for Simplified Development if you are not familiar with Devbox. Alternatively, you can skip Devbox and install all the tools listed in devbox.json yourself.

devbox shell

# FIXME: Add Google
# FIXME: Add Azure
chmod +x examples/setup.nu

./examples/setup.nu

source .env

kubectl create namespace a-team

kubectl delete \
    --filename examples/provider-config-$HYPERSCALER.yaml

FIXME:

cat app/error.yaml

kubectl --namespace a-team apply --filename app/error.yaml

kubectl --namespace a-team get deployments

kubectl --namespace a-team describe deployment silly-demo

kubectl --namespace a-team get pods

kubectl --namespace a-team describe pod \
    --selector app.kubernetes.io/name=silly-demo

cat examples/$HYPERSCALER-error.yaml

kubectl --namespace a-team apply \
    --filename examples/$HYPERSCALER-error.yaml

kubectl --namespace a-team get sqlclaims

kubectl --namespace a-team describe sqlclaim my-db

# FIXME: If AWS
kubectl get instance.rds.aws.upbound.io

# FIXME: If AWS
kubectl describe instance.rds.aws.upbound.io my-db

# FIXME: If AWS
kubectl get vpc.ec2.aws.upbound.io

# FIXME: If AWS
kubectl describe vpc.ec2.aws.upbound.io my-db

yq --inplace \
    '.spec.package = "xpkg.upbound.io/devops-toolkit/dot-sql:v0.8.138"' \
    config.yaml

kubectl apply --filename config.yaml

kubectl --namespace a-team describe sqlclaim my-db

FIXME: It might take a few moments...

cat examples/provider-config-$HYPERSCALER.yaml

kubectl apply \
    --filename examples/provider-config-$HYPERSCALER.yaml

FIXME: It might take a few moments...

kubectl --namespace a-team describe sqlclaim my-db

FIXME: Web UI?

cat examples/$HYPERSCALER.yaml

diff examples/$HYPERSCALER-error.yaml examples/$HYPERSCALER.yaml

kubectl --namespace a-team apply \
    --filename examples/$HYPERSCALER.yaml

kubectl --namespace a-team describe sqlclaim my-db

viddy crossplane beta trace sqlclaim my-db --namespace a-team

kubectl --namespace a-team get sqlclaims

kubectl --namespace a-team describe sqlclaim my-db

FIXME: It might take a few moments...

kubectl --namespace a-team get sqlclaims

FIXME: It might take a few moments...

FIXME: Pros and Cons

TODO: Header: Cons; Items: FIXME:

TODO: Header: Pros; Items: FIXME:

Destroy

FIXME: Convert to a script

kubectl --namespace a-team delete \
    --filename examples/$HYPERSCALER.yaml

kubectl get managed

# FIXME: Wait until all resources are deleted

yq --inplace \
    '.spec.package = "xpkg.upbound.io/devops-toolkit/dot-sql:v0.8.132"' \
    config.yaml

kind delete cluster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment