Define the structure of the custom resource, including the allowed fields, data types, and validations
1- Run the command to create the CRD.
kubectl apply -f ./k8s/CustomResourceDefinition.yaml
2- Check if the CRD has been created.
kubectl get crd bucket.levi.com
3- Run command
docker-compose up -d
Access the LocalStack URL to view the list of buckets.
4- Start application
PATH_KUBE_CONFIG="$HOME/.kube/config" \
AWS_PROFILE_NAME="local" \
AWS_CONFIG_ENDPOINT="http://localhost:4566" \
AWS_CONFIG_ACCESS_KEY_ID="localstack-key-id" \
AWS_CONFIG_SECRET_ACCESS_KEY="localstack-access-key" \
go run .
5- Run the command to create an instance of the CRD.
kubectl apply -f ./k8s/CustomResourceInstance.yaml
6- Check if the Instance has been created.
kubectl get bucket
Access LocalStack URL and refresh the page to view the created bucket.
7- Remove CRD Instance
kubectl delete -f ./k8s/CustomResourceInstance.yaml
Check if the bucket has been removed in LocalStack URL.
8- Remove CRD
kubectl delete -f ./k8s/CustomResourceDefinition.yaml