Skip to content

How to test MinIOJob

Cesar Celis Hernandez edited this page Apr 15, 2024 · 3 revisions

Steps:

  1. Create a cluster in kind:
createcluster
  1. Compile latest operator code:
cd ~/operator
make
  1. Copy latest image to nodes:
kind load docker-image <image>
  1. Install Operator:
installoperator
  1. Enable STS:
kubectl -n minio-operator set env deployment/minio-operator OPERATOR_STS_ENABLED=on
  1. Set latest image on Operator deployment

  2. Deploy tenant:

kustomize build github.com/minio/operator/examples/kustomization/sts-example/tenant > tenant.yaml
kubectl apply -f tenant.yaml
  1. Deploy MinIOJob:
apiVersion: v1
kind: ServiceAccount
metadata:
  name: mc-job-sa
  namespace: minio-tenant-1
---
apiVersion: sts.min.io/v1alpha1
kind: PolicyBinding
metadata:
  name: mc-job-bingding
  namespace: minio-tenant-1
spec:
  application:
    serviceaccount: mc-job-sa
    namespace: minio-tenant-1
  policies:
    - consoleAdmin
---
apiVersion: job.min.io/v1alpha1
kind: MinIOJob
metadata:
  name: minio-test-job
  namespace: minio-tenant-1
spec:
  serviceAccountName: mc-job-sa
  tenant:
    name: myminio
    namespace: minio-tenant-1
  commands:
    - op: make-bucket
      args:
        name: memes
Screenshot 2024-04-15 at 3 04 27 PM
I0415 19:03:35.602797       1 sync.go:151] created key minio-tenant-1/minio-test-job-command-0 kind batch/v1, Kind=Job diff [ObjectMeta.UID:  != 750caea4-b341-451e-89c1-76b5b02a8a5e ObjectMeta.ResourceVersion:  != 2310 ObjectMeta.Generation: 0 != 1 ObjectMeta.CreationTimestamp.Time: 0001-01-01 00:00:00 +0000 UTC != 2024-04-15 19:03:35 +0000 UTC ObjectMeta.OwnerReferences: <nil slice> != [{job.min.io/v1alpha1 MinIOJob minio-test-job 2393f76c-ccd0-49a0-acdc-1be4b1a454f8 0x4000f3cf48 0x4000f3cf49}] ObjectMeta.ManagedFields: <nil slice> != [{minio-operator Update batch/v1 2024-04-15 19:03:35 +0000 UTC FieldsV1 {"f:metadata":{"f:annotations":{".":{},"f:job.min.io/operation":{}},"f:labels":{".":{},"f:job.min.io/job-cr-name":{},"f:job.min.io/job-name":{}},"f:ownerReferences":{".":{},"k:{\"uid\":\"2393f76c-ccd0-49a0-acdc-1be4b1a454f8\"}":{}}},"f:spec":{"f:backoffLimit":{},"f:completionMode":{},"f:completions":{},"f:manualSelector":{},"f:parallelism":{},"f:podReplacementPolicy":{},"f:suspend":{},"f:template":{"f:metadata":{"f:labels":{".":{},"f:job.min.io/job-name":{}}},"f:spec":{"f:containers":{"k:{\"name\":\"mc\"}":{".":{},"f:command":{},"f:env":{".":{},"k:{\"name\":\"MC_HOST_myminio\"}":{".":{},"f:name":{},"f:value":{}},"k:{\"name\":\"MC_STS_ENDPOINT_myminio\"}":{".":{},"f:name":{},"f:value":{}},"k:{\"name\":\"MC_WEB_IDENTITY_TOKEN_FILE_myminio\"}":{".":{},"f:name":{},"f:value":{}}},"f:image":{},"f:imagePullPolicy":{},"f:name":{},"f:resources":{},"f:terminationMessagePath":{},"f:terminationMessagePolicy":{}}},"f:dnsPolicy":{},"f:restartPolicy":{},"f:schedulerName":{},"f:securityContext":{},"f:serviceAccount":{},"f:serviceAccountName":{},"f:terminationGracePeriodSeconds":{}}}}} }] Spec.Parallelism: <nil pointer> != int32 Spec.Completions: <nil pointer> != int32 Spec.BackoffLimit: <nil pointer> != int32 Spec.Selector: <nil pointer> != v1.LabelSelector]
$ k get pods -n minio-tenant-1
NAME                             READY   STATUS      RESTARTS   AGE
minio-test-job-command-0-7xtnb   0/1     Completed   0          5m20s <---- Our guy!
myminio-pool-0-0                 2/2     Running     0          11m
myminio-pool-0-1                 2/2     Running     0          11m
myminio-pool-0-2                 2/2     Running     0          11m
myminio-pool-0-3                 2/2     Running     0          11m
Screenshot 2024-04-15 at 3 09 28 PM