Developing MinIO Operator - cesnietor/dev-docs GitHub Wiki
Developing for MinIO Operator requires to have a Kubernetes environment due to the nature of the product.
We'll use Kind to create our Kubernetes-like environment. And we also need a Docker environment (Docker Desktop [requires subscription], Rancher Desktop or Podman) please see related Wikis.
echo "kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
- role: worker
- role: worker
" > kind-config.yaml
kind create cluster --config kind-config.yaml
kubectl kustomize . | kubectl apply -f -
This should create the namespaces and services defined in the yaml
file.
If you want to use a define minio/operator image, see below for more info.
Update kustomization file if needed using yq
Use cases:
- Changing number of minio/operator replicas to one:
yq -i -e '(. | select(.spec.selector.matchLabels.name=="minio-operator") | .spec.replicas) = 1' operator.yaml
- If building a custom image -> Update
console
andoperator
to use your new image: Run:
make build TAG="minio/operator:cesnietor"
Uplooad your image to Kind (changes depending on Docker env), see docs for Podman:
make build TAG="minio/operator:cesnietor"
Upload image to kind:
kind load docker-image minio/operator:<YOUR_TAG>
Update operator.yaml
to use your new image:
yq -i -e '(. | select(.spec.selector.matchLabels.app=="console") .spec.template.spec.containers[0].image) = "minio/operator:<YOUR_TAG>"' operator.yaml
yq -i -e '(. | select(.spec.selector.matchLabels.name=="minio-operator") .spec.template.spec.containers[0].image) = "minio/operator:<YOUR_TAG>"' operator.yaml
Verify your changes
diff <(yq <(kubectl kustomize .)) operator.yaml
Apply your changes with custom/edited yaml
file.
kubectl apply -f operator.yaml
JWT required to login to Console is stored as a secret:
kubectl describe secrets -n minio-operator console-sa-secret
Copy to clipboard:
kubectl describe secrets -n minio-operator console-sa-secret | grep 'token:' | awk '{print $2}' | pbcopy
kustomize build github.com/minio/operator/resources/\?ref\=v5.0.3 > operator.yaml