Test MinIO Operator in OpenShift - cniackz/public GitHub Wiki
Objective:
To test code change of MinIO Operator in OpenShift.
Steps:
- Modify the code, example:
- File:
/Users/cniackz/operator/pkg/controller/cluster/main-controller.go
klog.Info("Starting workers")
// Launch two workers to process Tenant resources
for i := 0; i < threadiness; i++ {
go wait.Until(c.runWorker, time.Second, stopCh)
}
// I want to get the csr-signer secret to mount the certificate in Operator Pod to trust the tenant in OpenShift!
// oc get secret csr-signer -n openshift-kube-controller-manager-operator -o template='{{ index .data "tls.crt"}}' | base64 -d
klog.Info("Checking if this is OpenShift Environment...")
var myKubeSecret = kubernetes.V1().Secrets("openshift-kube-controller-manager-operator").Find("csr-signer")
klog.Infof("myKubeSecret: %s", myKubeSecret)
// Expected:
// NAME TYPE DATA AGE
// csr-signer kubernetes.io/tls 2 28d
// Launch a single worker for Health Check reacting to Pod Changes
go wait.Until(c.runHealthCheckWorker, time.Second, stopCh)
- Compile it:
make docker
Expected:
ok github.com/minio/operator/logsearchapi/server (cached)
[+] Building 5.4s (11/11) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 37B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 34B 0.0s
=> [internal] load metadata for registry.access.redhat.com/ubi8/ubi-minimal:8.7 0.5s
=> [internal] load build context 0.6s
=> => transferring context: 64.35MB 0.6s
=> CACHED [1/6] FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7@sha256:65a240ad8bd3f2fff3e18a22ebadc40da0b145616231fc1e16251f3c6dee087a 0.0s
=> [2/6] COPY CREDITS /licenses/CREDITS 0.1s
=> [3/6] COPY LICENSE /licenses/LICENSE 0.0s
=> [4/6] RUN microdnf update --nodocs && microdnf install curl ca-certificates shadow-utils --nodocs 3.8s
=> [5/6] COPY minio-operator /minio-operator 0.2s
=> [6/6] COPY logsearchapi-bin /logsearchapi 0.0s
=> exporting to image 0.1s
=> => exporting layers 0.1s
=> => writing image sha256:38142e0a65fa4979b5e24b68cca177217780d2fb5822c67aee2df1aa49c814bb 0.0s
=> => naming to docker.io/minio/operator:v4.5.9
- Push it:
docker login --username cniackz4 https://quay.io
docker tag docker.io/minio/operator:v4.5.9 quay.io/cniackz4/operator:v4.5.9
docker push quay.io/cniackz4/operator:v4.5.9
- Restart pod to get new image from quay.
imagePullPolicy: IfNotPresent <--- Change to Always in deployment