diff --git a/Makefile b/Makefile index d26a05dc544..1524d478a98 100644 --- a/Makefile +++ b/Makefile @@ -70,13 +70,11 @@ regen-crd: @${GOPATH}/bin/controller-gen crd:maxDescLen=0,generateEmbeddedObjectMeta=true webhook paths="./..." output:crd:artifacts:config=$(KUSTOMIZE_CRDS) @sed 's#namespace: minio-operator#namespace: {{ .Release.Namespace }}#g' resources/base/crds/minio.min.io_tenants.yaml > $(HELM_TEMPLATES)/minio.min.io_tenants.yaml @sed 's#namespace: minio-operator#namespace: {{ .Release.Namespace }}#g' resources/base/crds/sts.min.io_policybindings.yaml > $(HELM_TEMPLATES)/sts.min.io_policybindings.yaml - @sed 's#namespace: minio-operator#namespace: {{ .Release.Namespace }}#g' resources/base/crds/job.min.io_miniojobs.yaml > $(HELM_TEMPLATES)/job.min.io_jobs.yaml regen-crd-docs: @echo "Installing crd-ref-docs" && GO111MODULE=on go install -v github.com/elastic/crd-ref-docs@latest @${GOPATH}/bin/crd-ref-docs --source-path=./pkg/apis/minio.min.io/v2 --config=docs/templates/config.yaml --renderer=asciidoctor --output-path=docs/tenant_crd.adoc --templates-dir=docs/templates/asciidoctor/ @${GOPATH}/bin/crd-ref-docs --source-path=./pkg/apis/sts.min.io/v1beta1 --config=docs/templates/config.yaml --renderer=asciidoctor --output-path=docs/policybinding_crd.adoc --templates-dir=docs/templates/asciidoctor/ - @${GOPATH}/bin/crd-ref-docs --source-path=./pkg/apis/job.min.io/v1alpha1 --config=docs/templates/config.yaml --renderer=asciidoctor --output-path=docs/job_crd.adoc --templates-dir=docs/templates/asciidoctor/ generate-code: @./k8s/update-codegen.sh diff --git a/docs/job_crd.adoc b/docs/job_crd.adoc deleted file mode 100644 index 0f1a0b7cfcb..00000000000 --- a/docs/job_crd.adoc +++ /dev/null @@ -1,287 +0,0 @@ -// Generated documentation. Please do not edit. -:anchor_prefix: k8s-api - -[id="{p}-api-reference"] -== API Reference - -:minio-image: https://hub.docker.com/r/minio/minio/tags[minio/minio:RELEASE.2024-10-02T17-50-41Z] -:kes-image: https://hub.docker.com/r/minio/kes/tags[minio/kes:2024-09-11T07-22-50Z] -:mc-image: https://hub.docker.com/r/minio/mc/tags[minio/mc:RELEASE.2024-10-02T08-27-28Z] - - -[id="{anchor_prefix}-job-min-io-v1alpha1"] -=== job.min.io/v1alpha1 - -Package v1alpha1 - The following parameters are specific to the `job.min.io/v1alpha1` MinIOJob CRD API. - -MinIOJob is an automated InfrastructureAsCode integrated with Minio Operator STS to configure MinIO Tenants. - - - -[id="{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-commandspec"] -==== CommandSpec - -CommandSpec (`spec`) defines the configuration of a MinioClient Command. - -.Appears In: -**** -- xref:{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-miniojobspec[$$MinIOJobSpec$$] -**** - -[cols="25a,75a", options="header"] -|=== -| Field | Description - -|*`op`* __string__ -|Operation is the MinioClient Action - -|*`name`* __string__ -|Name is the Command Name, optional, required if want to reference it with `DependsOn` - -|*`args`* __object (keys:string, values:string)__ -|Args Arguments to pass to the action - -|*`command`* __string array__ -|Command Execute All User-Defined Commands - -|*`dependsOn`* __string array__ -|DependsOn List of named `command` in this MinioJob that have to be scheduled and executed before this command runs - -|*`resources`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#resourcerequirements-v1-core[$$ResourceRequirements$$]__ -|Compute Resources required by this container. -Cannot be updated. -More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - -|*`envFrom`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#envfromsource-v1-core[$$EnvFromSource$$] array__ -|List of sources to populate environment variables in the container. -The keys defined within a source must be a C_IDENTIFIER. All invalid keys -will be reported as an event when the container is starting. When a key exists in multiple -sources, the value associated with the last source will take precedence. -Values defined by an Env with a duplicate key will take precedence. -Cannot be updated. - -|*`env`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#envvar-v1-core[$$EnvVar$$] array__ -|List of environment variables to set in the container. -Cannot be updated. - -|*`volumeMounts`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#volumemount-v1-core[$$VolumeMount$$] array__ -|Pod volumes to mount into the container's filesystem. -Cannot be updated. - -|*`volumes`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#volume-v1-core[$$Volume$$] array__ -|List of volumes that can be mounted by containers belonging to the pod. -More info: https://kubernetes.io/docs/concepts/storage/volumes - -|=== - - -[id="{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-commandstatus"] -==== CommandStatus - -CommandStatus Status of MinioJob command execution - -.Appears In: -**** -- xref:{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-miniojobstatus[$$MinIOJobStatus$$] -**** - -[cols="25a,75a", options="header"] -|=== -| Field | Description - -|*`name`* __string__ -| - -|*`result`* __string__ -|*Required* + - -|*`message`* __string__ -| - -|=== - - -[id="{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-execution"] -==== Execution (string) - -Execution is the MinIO Job level execution policy - -.Appears In: -**** -- xref:{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-miniojobspec[$$MinIOJobSpec$$] -**** - - - -[id="{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-failurestrategy"] -==== FailureStrategy (string) - -FailureStrategy is the failure strategy at MinIO Job level - -.Appears In: -**** -- xref:{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-miniojobspec[$$MinIOJobSpec$$] -**** - - - -[id="{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-miniojob"] -==== MinIOJob - -MinIOJob is a top-level type. A client is created for it - -.Appears In: -**** -- xref:{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-miniojoblist[$$MinIOJobList$$] -**** - -[cols="25a,75a", options="header"] -|=== -| Field | Description - -|*`metadata`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#objectmeta-v1-meta[$$ObjectMeta$$]__ -|Refer to Kubernetes API documentation for fields of `metadata`. - - -|*`spec`* __xref:{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-miniojobspec[$$MinIOJobSpec$$]__ -|*Required* + - - -The root field for the MinIOJob object. - -|=== - - - - -[id="{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-miniojobspec"] -==== MinIOJobSpec - -MinIOJobSpec (`spec`) defines the configuration of a MinIOJob object. + - -.Appears In: -**** -- xref:{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-miniojob[$$MinIOJob$$] -**** - -[cols="25a,75a", options="header"] -|=== -| Field | Description - -|*`serviceAccountName`* __string__ -|*Required* + - - -Service Account name for the jobs to run - -|*`tenant`* __xref:{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-tenantref[$$TenantRef$$]__ -|*Required* + - - -TenantRef Reference for minio Tenant to eun the jobs against - -|*`execution`* __xref:{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-execution[$$Execution$$]__ -|Execution order of the jobs, either `parallel` or `sequential`. -Defaults to `parallel` if not provided. - -|*`failureStrategy`* __xref:{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-failurestrategy[$$FailureStrategy$$]__ -|FailureStrategy is the forward plan in case of the failure of one or more MinioJob pods -Either `stopOnFailure` or `continueOnFailure`, defaults to `continueOnFailure`. - -|*`insecure`* __boolean__ -|Insecure is boolean to enable/disable TLS verification - -|*`commands`* __xref:{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-commandspec[$$CommandSpec$$] array__ -|*Required* + - - -Commands List of MinioClient commands - -|*`mcImage`* __string__ -|The Docker image to use when deploying `mc` pods. Defaults to {mc-image}. + - -|*`imagePullPolicy`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#pullpolicy-v1-core[$$PullPolicy$$]__ -|*Optional* + - - -The pull policy for the MinIO Docker image. Specify one of the following: + - - -* `Always` + - - -* `Never` + - - -* `IfNotPresent` (Default) + - - -Refer Kubernetes documentation for details https://kubernetes.io/docs/concepts/containers/images#updating-images - -|*`imagePullSecret`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#localobjectreference-v1-core[$$LocalObjectReference$$] array__ -|*Optional* + - - -Specify the secret key to use for pulling images from a private Docker repository. + - -|*`securityContext`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#podsecuritycontext-v1-core[$$PodSecurityContext$$]__ -|*Optional* + - - -Specify the https://kubernetes.io/docs/tasks/configure-pod-container/security-context/[Security Context] of pods in the pool. The Operator supports only the following pod security fields: + - - -* `fsGroup` + - - -* `fsGroupChangePolicy` + - - -* `runAsGroup` + - - -* `runAsNonRoot` + - - -* `runAsUser` + - -|*`containerSecurityContext`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#securitycontext-v1-core[$$SecurityContext$$]__ -|Specify the https://kubernetes.io/docs/tasks/configure-pod-container/security-context/[Security Context] of containers in the pool. The Operator supports only the following container security fields: + - - -* `runAsGroup` + - - -* `runAsNonRoot` + - - -* `runAsUser` + - -|=== - - - - -[id="{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-tenantref"] -==== TenantRef - -TenantRef Is the reference to the target tenant of the jobs - -.Appears In: -**** -- xref:{anchor_prefix}-github-com-minio-operator-pkg-apis-job-min-io-v1alpha1-miniojobspec[$$MinIOJobSpec$$] -**** - -[cols="25a,75a", options="header"] -|=== -| Field | Description - -|*`name`* __string__ -|*Required* + - -|*`namespace`* __string__ -|*Required* + - -|=== - - diff --git a/docs/minio-job.md b/docs/minio-job.md deleted file mode 100644 index f8931b8a17c..00000000000 --- a/docs/minio-job.md +++ /dev/null @@ -1,225 +0,0 @@ -# MinioJob is a Kubernetes Job that runs mc commands - -Requirements: -- Operator Enabled STS - -Tips: -MinioJob will use `myminio` as reference tenant `ALIAS` - -here is an example of a MinioJob: -```yaml -apiVersion: v1 -kind: ServiceAccount -metadata: - name: mc-job-sa ---- -apiVersion: sts.min.io/v1alpha1 -kind: PolicyBinding -metadata: - name: mc-job-binding -spec: - application: - serviceaccount: mc-job-sa - policies: - - consoleAdmin ---- -apiVersion: v1 -kind: Secret -metadata: - name: mytestsecret -data: - PASSWORD: cGVkcm8xMjM= # echo pedro123 | base64 ---- -apiVersion: v1 -kind: Secret -metadata: - name: mytestsecretenvs -data: - USER: ZGFuaWVs # echo daniel | base64 - PASSWORD: ZGFuaWVsMTIz # echo daniel123 | base64 ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: mytestconfig -data: - policy.json: | - { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:*" - ], - "Resource": [ - "arn:aws:s3:::memes", - "arn:aws:s3:::memes/*" - ] - } - ] - } ---- -apiVersion: job.min.io/v1alpha1 -kind: MinIOJob -metadata: - name: minio-test-job -spec: -# mcImage: quay.io/minio/mc:RELEASE.2024-10-02T08-27-28Z - serviceAccountName: mc-job-sa - securityContext: {} - containerSecurityContext: {} - tenant: - name: mytest-minio - commands: - - op: make-bucket - args: - name: memes - - name: add-my-user-1 - op: admin/user/add - args: - user: $(USER) - password: $(PASSWORD) - envFrom: - - secretRef: - name: mytestsecretenvs - - name: add-my-user-2 - op: admin/user/add - args: - user: pedro - password: $(PASSWORD) - env: - - name: PASSWORD - valueFrom: - secretKeyRef: - name: mytestsecret - key: PASSWORD - - name: add-my-policy - op: admin/policy/create - args: - name: memes-access - policy: /temp/policy.json - volumeMounts: - - name: policy - mountPath: /temp - volumes: - - name: policy - configMap: - name: mytestconfig - items: - - key: policy.json - path: policy.json - - op: admin/policy/attach - dependsOn: - - add-my-user-1 - - add-my-user-2 - - add-my-policy - args: - policy: memes-access - user: daniel - - op: admin/policy/attach - dependsOn: - - add-my-user-1 - - add-my-user-2 - - add-my-policy - args: - policy: memes-access - user: pedro - - op: stat - command: - - "mc" - - "stat" - - "myminio/memes" -``` -The MinioJob is a Kubernetes Job that runs mc commands. It uses the MinIO client (mc) to interact with the MinIO server. -## mcImage -Optional, defaults to `quay.io/minio/mc:RELEASE.2024-10-02T08-27-28Z` -The `mcImage` field specifies the Docker image that will be used to run the mc commands. -## serviceAccountName -The `serviceAccountName` field specifies the name of the Kubernetes ServiceAccount that will be used to run the mc commands. In this case, the ServiceAccount is `mc-job-sa`. -## securityContext -example: -```yaml -runAsUser: 1000 -runAsGroup: 1000 -fsGroup: 1000 -fsGroupChangePolicy: "OnRootMismatch" -runAsNonRoot: true -allowPrivilegeEscalation: false -capabilities: - drop: - - ALL -``` -The `securityContext` field specifies the security context that will be used to run the mc commands. -## containerSecurityContext -The `containerSecurityContext` field specifies the security context that will be used to run the `mc` commands in the container. -## tenant -```yaml -name: tenantName -namespace: tenantNamespace -``` -The target tenant that the job will run against. -## commands -### args -if you set this field, the `mc` command will be executed with the arguments. -`op` must be one of these: -`mb`,`make-bucket`, `admin/user/add`,`admin/policy/create`,`admin/policy/attach`, `admin/config/set`, `support/callhome`,`license/register` -```yaml -op: make-bucket -args: - name: memes - --with-locks: "" -``` -Will do a job like `mc mb --with-locks myminio/memes` -```yaml -name: add-my-policy -op: admin/policy/create -args: - name: memes-access -policy: /temp/policy.json -volumeMounts: -- name: policy - mountPath: /temp -volumes: -- name: policy - configMap: - name: mytestconfig - items: - - key: policy.json - path: policy.json -``` -Will do a job like `mc admin policy create myminio memes-access /temp/policy.json` -### command -The `command` field specifies the command that will be executed by the `mc` command. -`args` must be empty. -`op` optional, can be set to the main command name. -``` -op: stat -command: - - "mc" - - "stat" - - "myminio/memes" -``` -or -``` -command: - - "mc" - - "stat" - - "myminio/memes" -``` -Will do a job like `mc stat myminio/memes` -### env/envFrom/volumeMounts/volumes -The `env/envFrom/volumeMounts/volumes` fields specify the environment variables/volumes that will be used by the `mc` command -### resources -```yaml -resources: - requests: - cpu: "100m" - memory: "128Mi" - limits: - cpu: "500m" - memory: "256Mi" -``` -The `resources` field specifies the resource requirements that will be used by the container. -### dependsOn -The `dependsOn` field specifies the commands that must be executed before the current command. \ No newline at end of file diff --git a/helm/operator/templates/job.min.io_jobs.yaml b/helm/operator/templates/job.min.io_jobs.yaml deleted file mode 100644 index 64f9bafe2e5..00000000000 --- a/helm/operator/templates/job.min.io_jobs.yaml +++ /dev/null @@ -1,1203 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.15.0 - operator.min.io/version: v6.0.4 - name: miniojobs.job.min.io -spec: - group: job.min.io - names: - kind: MinIOJob - listKind: MinIOJobList - plural: miniojobs - shortNames: - - miniojob - singular: miniojob - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .status.phase - name: Phase - type: string - - jsonPath: .status.message - name: Message - type: string - name: v1alpha1 - schema: - openAPIV3Schema: - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - spec: - properties: - commands: - items: - properties: - args: - additionalProperties: - type: string - type: object - command: - items: - type: string - type: array - dependsOn: - items: - type: string - type: array - env: - items: - properties: - name: - type: string - value: - type: string - valueFrom: - properties: - configMapKeyRef: - properties: - key: - type: string - name: - default: "" - type: string - optional: - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic - secretKeyRef: - properties: - key: - type: string - name: - default: "" - type: string - optional: - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - type: object - required: - - name - type: object - type: array - envFrom: - items: - properties: - configMapRef: - properties: - name: - default: "" - type: string - optional: - type: boolean - type: object - x-kubernetes-map-type: atomic - prefix: - type: string - secretRef: - properties: - name: - default: "" - type: string - optional: - type: boolean - type: object - x-kubernetes-map-type: atomic - type: object - type: array - name: - type: string - op: - type: string - resources: - properties: - claims: - items: - properties: - name: - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - type: object - volumeMounts: - items: - properties: - mountPath: - type: string - mountPropagation: - type: string - name: - type: string - readOnly: - type: boolean - recursiveReadOnly: - type: string - subPath: - type: string - subPathExpr: - type: string - required: - - mountPath - - name - type: object - type: array - volumes: - items: - properties: - awsElasticBlockStore: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - readOnly: - type: boolean - volumeID: - type: string - required: - - volumeID - type: object - azureDisk: - properties: - cachingMode: - type: string - diskName: - type: string - diskURI: - type: string - fsType: - type: string - kind: - type: string - readOnly: - type: boolean - required: - - diskName - - diskURI - type: object - azureFile: - properties: - readOnly: - type: boolean - secretName: - type: string - shareName: - type: string - required: - - secretName - - shareName - type: object - cephfs: - properties: - monitors: - items: - type: string - type: array - x-kubernetes-list-type: atomic - path: - type: string - readOnly: - type: boolean - secretFile: - type: string - secretRef: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - user: - type: string - required: - - monitors - type: object - cinder: - properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - volumeID: - type: string - required: - - volumeID - type: object - configMap: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - x-kubernetes-list-type: atomic - name: - default: "" - type: string - optional: - type: boolean - type: object - x-kubernetes-map-type: atomic - csi: - properties: - driver: - type: string - fsType: - type: string - nodePublishSecretRef: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - readOnly: - type: boolean - volumeAttributes: - additionalProperties: - type: string - type: object - required: - - driver - type: object - downwardAPI: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - mode: - format: int32 - type: integer - path: - type: string - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic - required: - - path - type: object - type: array - x-kubernetes-list-type: atomic - type: object - emptyDir: - properties: - medium: - type: string - sizeLimit: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - ephemeral: - properties: - volumeClaimTemplate: - properties: - metadata: - properties: - annotations: - additionalProperties: - type: string - type: object - finalizers: - items: - type: string - type: array - labels: - additionalProperties: - type: string - type: object - name: - type: string - namespace: - type: string - type: object - spec: - properties: - accessModes: - items: - type: string - type: array - x-kubernetes-list-type: atomic - dataSource: - properties: - apiGroup: - type: string - kind: - type: string - name: - type: string - required: - - kind - - name - type: object - x-kubernetes-map-type: atomic - dataSourceRef: - properties: - apiGroup: - type: string - kind: - type: string - name: - type: string - namespace: - type: string - required: - - kind - - name - type: object - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - type: object - selector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - type: object - type: object - x-kubernetes-map-type: atomic - storageClassName: - type: string - volumeAttributesClassName: - type: string - volumeMode: - type: string - volumeName: - type: string - type: object - required: - - spec - type: object - type: object - fc: - properties: - fsType: - type: string - lun: - format: int32 - type: integer - readOnly: - type: boolean - targetWWNs: - items: - type: string - type: array - x-kubernetes-list-type: atomic - wwids: - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - flexVolume: - properties: - driver: - type: string - fsType: - type: string - options: - additionalProperties: - type: string - type: object - readOnly: - type: boolean - secretRef: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - required: - - driver - type: object - flocker: - properties: - datasetName: - type: string - datasetUUID: - type: string - type: object - gcePersistentDisk: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - pdName: - type: string - readOnly: - type: boolean - required: - - pdName - type: object - gitRepo: - properties: - directory: - type: string - repository: - type: string - revision: - type: string - required: - - repository - type: object - glusterfs: - properties: - endpoints: - type: string - path: - type: string - readOnly: - type: boolean - required: - - endpoints - - path - type: object - hostPath: - properties: - path: - type: string - type: - type: string - required: - - path - type: object - iscsi: - properties: - chapAuthDiscovery: - type: boolean - chapAuthSession: - type: boolean - fsType: - type: string - initiatorName: - type: string - iqn: - type: string - iscsiInterface: - type: string - lun: - format: int32 - type: integer - portals: - items: - type: string - type: array - x-kubernetes-list-type: atomic - readOnly: - type: boolean - secretRef: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - targetPortal: - type: string - required: - - iqn - - lun - - targetPortal - type: object - name: - type: string - nfs: - properties: - path: - type: string - readOnly: - type: boolean - server: - type: string - required: - - path - - server - type: object - persistentVolumeClaim: - properties: - claimName: - type: string - readOnly: - type: boolean - required: - - claimName - type: object - photonPersistentDisk: - properties: - fsType: - type: string - pdID: - type: string - required: - - pdID - type: object - portworxVolume: - properties: - fsType: - type: string - readOnly: - type: boolean - volumeID: - type: string - required: - - volumeID - type: object - projected: - properties: - defaultMode: - format: int32 - type: integer - sources: - items: - properties: - clusterTrustBundle: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - type: object - type: object - x-kubernetes-map-type: atomic - name: - type: string - optional: - type: boolean - path: - type: string - signerName: - type: string - required: - - path - type: object - configMap: - properties: - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - x-kubernetes-list-type: atomic - name: - default: "" - type: string - optional: - type: boolean - type: object - x-kubernetes-map-type: atomic - downwardAPI: - properties: - items: - items: - properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - mode: - format: int32 - type: integer - path: - type: string - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic - required: - - path - type: object - type: array - x-kubernetes-list-type: atomic - type: object - secret: - properties: - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - x-kubernetes-list-type: atomic - name: - default: "" - type: string - optional: - type: boolean - type: object - x-kubernetes-map-type: atomic - serviceAccountToken: - properties: - audience: - type: string - expirationSeconds: - format: int64 - type: integer - path: - type: string - required: - - path - type: object - type: object - type: array - x-kubernetes-list-type: atomic - type: object - quobyte: - properties: - group: - type: string - readOnly: - type: boolean - registry: - type: string - tenant: - type: string - user: - type: string - volume: - type: string - required: - - registry - - volume - type: object - rbd: - properties: - fsType: - type: string - image: - type: string - keyring: - type: string - monitors: - items: - type: string - type: array - x-kubernetes-list-type: atomic - pool: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - user: - type: string - required: - - image - - monitors - type: object - scaleIO: - properties: - fsType: - type: string - gateway: - type: string - protectionDomain: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - sslEnabled: - type: boolean - storageMode: - type: string - storagePool: - type: string - system: - type: string - volumeName: - type: string - required: - - gateway - - secretRef - - system - type: object - secret: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - x-kubernetes-list-type: atomic - optional: - type: boolean - secretName: - type: string - type: object - storageos: - properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - volumeName: - type: string - volumeNamespace: - type: string - type: object - vsphereVolume: - properties: - fsType: - type: string - storagePolicyID: - type: string - storagePolicyName: - type: string - volumePath: - type: string - required: - - volumePath - type: object - required: - - name - type: object - type: array - type: object - type: array - containerSecurityContext: - properties: - allowPrivilegeEscalation: - type: boolean - appArmorProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - capabilities: - properties: - add: - items: - type: string - type: array - x-kubernetes-list-type: atomic - drop: - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - privileged: - type: boolean - procMount: - type: string - readOnlyRootFilesystem: - type: boolean - runAsGroup: - format: int64 - type: integer - runAsNonRoot: - type: boolean - runAsUser: - format: int64 - type: integer - seLinuxOptions: - properties: - level: - type: string - role: - type: string - type: - type: string - user: - type: string - type: object - seccompProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - windowsOptions: - properties: - gmsaCredentialSpec: - type: string - gmsaCredentialSpecName: - type: string - hostProcess: - type: boolean - runAsUserName: - type: string - type: object - type: object - execution: - default: parallel - enum: - - parallel - - sequential - type: string - failureStrategy: - default: continueOnFailure - enum: - - continueOnFailure - - stopOnFailure - type: string - imagePullPolicy: - type: string - imagePullSecret: - items: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - type: array - insecure: - type: boolean - mcImage: - default: quay.io/minio/mc:RELEASE.2024-10-02T08-27-28Z - type: string - securityContext: - properties: - appArmorProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - fsGroup: - format: int64 - type: integer - fsGroupChangePolicy: - type: string - runAsGroup: - format: int64 - type: integer - runAsNonRoot: - type: boolean - runAsUser: - format: int64 - type: integer - seLinuxOptions: - properties: - level: - type: string - role: - type: string - type: - type: string - user: - type: string - type: object - seccompProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - supplementalGroups: - items: - format: int64 - type: integer - type: array - x-kubernetes-list-type: atomic - sysctls: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - windowsOptions: - properties: - gmsaCredentialSpec: - type: string - gmsaCredentialSpecName: - type: string - hostProcess: - type: boolean - runAsUserName: - type: string - type: object - type: object - serviceAccountName: - type: string - tenant: - properties: - name: - type: string - namespace: - type: string - required: - - name - - namespace - type: object - required: - - commands - - serviceAccountName - - tenant - type: object - status: - properties: - commands: - items: - properties: - message: - type: string - name: - type: string - result: - type: string - required: - - result - type: object - type: array - message: - type: string - phase: - type: string - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/pkg/apis/job.min.io/register.go b/pkg/apis/job.min.io/register.go deleted file mode 100644 index 6f9dd18c333..00000000000 --- a/pkg/apis/job.min.io/register.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2022, MinIO, Inc. -// -// This code is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License, version 3, -// as published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License, version 3, -// along with this program. If not, see - -package operator - -// MinIOJob group name. -const ( - GroupName = "job.min.io" -) diff --git a/pkg/apis/job.min.io/v1alpha1/doc.go b/pkg/apis/job.min.io/v1alpha1/doc.go deleted file mode 100644 index a1a16c638e3..00000000000 --- a/pkg/apis/job.min.io/v1alpha1/doc.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2023, MinIO, Inc. -// -// This code is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License, version 3, -// as published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License, version 3, -// along with this program. If not, see - -// +k8s:deepcopy-gen=package,register -// go:generate controller-gen crd:trivialVersions=true paths=. output:dir=. - -// Package v1alpha1 - The following parameters are specific to the `job.min.io/v1alpha1` MinIOJob CRD API. -// -// MinIOJob is an automated InfrastructureAsCode integrated with Minio Operator STS to configure MinIO Tenants. -// +groupName=job.min.io -// +versionName=v1alpha1 -package v1alpha1 diff --git a/pkg/apis/job.min.io/v1alpha1/register.go b/pkg/apis/job.min.io/v1alpha1/register.go deleted file mode 100644 index 9e761c14276..00000000000 --- a/pkg/apis/job.min.io/v1alpha1/register.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2022, MinIO, Inc. -// -// This code is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License, version 3, -// as published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License, version 3, -// along with this program. If not, see - -package v1alpha1 - -import ( - operator "github.com/minio/operator/pkg/apis/job.min.io" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// Version specifies the API Version -const Version = "v1alpha1" - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: operator.GroupName, Version: Version} - -// Kind takes an unqualified kind and returns back a Group qualified GroupKind -func Kind(kind string) schema.GroupKind { - return SchemeGroupVersion.WithKind(kind).GroupKind() -} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - // SchemeBuilder collects the scheme builder functions for the MinIO - // Operator API. - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - - // AddToScheme applies the SchemeBuilder functions to a specified scheme. - AddToScheme = SchemeBuilder.AddToScheme -) - -// Adds the list of known types to Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &MinIOJob{}, - &MinIOJobList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/pkg/apis/job.min.io/v1alpha1/types.go b/pkg/apis/job.min.io/v1alpha1/types.go deleted file mode 100644 index 08ea2da170b..00000000000 --- a/pkg/apis/job.min.io/v1alpha1/types.go +++ /dev/null @@ -1,232 +0,0 @@ -package v1alpha1 - -import ( - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// Execution is the MinIO Job level execution policy -type Execution string - -const ( - // Parallel Run MC Jobs in parallel - Parallel Execution = "parallel" - // Sequential Run MC Jobs in sequential mode - Sequential Execution = "sequential" -) - -// FailureStrategy is the failure strategy at MinIO Job level -type FailureStrategy string - -const ( - // ContinueOnFailure indicates to MinIO Job to continue execution of following commands even in the case of the - // failure of a command - ContinueOnFailure FailureStrategy = "continueOnFailure" - - // StopOnFailure indicates to MinIO Job to stop execution of following commands even in the case of the failure - // of a command - StopOnFailure FailureStrategy = "stopOnFailure" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:defaulter-gen=true -// +kubebuilder:subresource:status -// +kubebuilder:resource:scope=Namespaced,shortName=miniojob,singular=miniojob -// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase` -// +kubebuilder:printcolumn:name="Message",type=string,JSONPath=`.status.message` -// +kubebuilder:metadata:annotations=operator.min.io/version=v6.0.4 - -// MinIOJob is a top-level type. A client is created for it -type MinIOJob struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // *Required* + - // - // The root field for the MinIOJob object. - Spec MinIOJobSpec `json:"spec,omitempty"` - - // Status provides details of the state of the MinIOJob steps - // +optional - Status MinIOJobStatus `json:"status,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// MinIOJobList is a top-level list type. -type MinIOJobList struct { - metav1.TypeMeta `json:",inline"` - // +optional - metav1.ListMeta `json:"metadata,omitempty"` - - Items []MinIOJob `json:"items"` -} - -// MinIOJobSpec (`spec`) defines the configuration of a MinIOJob object. + -type MinIOJobSpec struct { - // *Required* + - // - // Service Account name for the jobs to run - ServiceAccountName string `json:"serviceAccountName"` - - // *Required* + - // - // TenantRef Reference for minio Tenant to eun the jobs against - TenantRef TenantRef `json:"tenant"` - - // Execution order of the jobs, either `parallel` or `sequential`. - // Defaults to `parallel` if not provided. - // +optional - // +kubebuilder:default=parallel - // +kubebuilder:validation:Enum=parallel;sequential; - Execution Execution `json:"execution"` - - // FailureStrategy is the forward plan in case of the failure of one or more MinioJob pods - // Either `stopOnFailure` or `continueOnFailure`, defaults to `continueOnFailure`. - // +optional - // +kubebuilder:default=continueOnFailure - // +kubebuilder:validation:Enum=continueOnFailure;stopOnFailure; - FailureStrategy FailureStrategy `json:"failureStrategy"` - - // Insecure is boolean to enable/disable TLS verification - // +optional - Insecure *bool `json:"insecure"` - - // *Required* + - // - // Commands List of MinioClient commands - Commands []CommandSpec `json:"commands"` - - // The Docker image to use when deploying `mc` pods. Defaults to {mc-image}. + - // +optional - // +kubebuilder:default="quay.io/minio/mc:RELEASE.2024-10-02T08-27-28Z" - MCImage string `json:"mcImage,omitempty"` - - // *Optional* + - // - // The pull policy for the MinIO Docker image. Specify one of the following: + - // - // * `Always` + - // - // * `Never` + - // - // * `IfNotPresent` (Default) + - // - // Refer Kubernetes documentation for details https://kubernetes.io/docs/concepts/containers/images#updating-images - ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"` - - // *Optional* + - // - // Specify the secret key to use for pulling images from a private Docker repository. + - // +optional - ImagePullSecret []corev1.LocalObjectReference `json:"imagePullSecret,omitempty"` - - // *Optional* + - // - // Specify the https://kubernetes.io/docs/tasks/configure-pod-container/security-context/[Security Context] of pods in the pool. The Operator supports only the following pod security fields: + - // - // * `fsGroup` + - // - // * `fsGroupChangePolicy` + - // - // * `runAsGroup` + - // - // * `runAsNonRoot` + - // - // * `runAsUser` + - // - // +optional - SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"` - // Specify the https://kubernetes.io/docs/tasks/configure-pod-container/security-context/[Security Context] of containers in the pool. The Operator supports only the following container security fields: + - // - // * `runAsGroup` + - // - // * `runAsNonRoot` + - // - // * `runAsUser` + - // - // +optional - ContainerSecurityContext *corev1.SecurityContext `json:"containerSecurityContext,omitempty"` -} - -// CommandSpec (`spec`) defines the configuration of a MinioClient Command. -type CommandSpec struct { - // +optional - // - // Operation is the MinioClient Action - Operation string `json:"op"` - - // Name is the Command Name, optional, required if want to reference it with `DependsOn` - // +optional - Name string `json:"name,omitempty"` - - // Args Arguments to pass to the action - // +optional - Args map[string]string `json:"args,omitempty"` - - // Command Execute All User-Defined Commands - // +optional - Command []string `json:"command,omitempty"` - - // DependsOn List of named `command` in this MinioJob that have to be scheduled and executed before this command runs - // +optional - DependsOn []string `json:"dependsOn,omitempty"` - - // Compute Resources required by this container. - // Cannot be updated. - // More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - // +optional - Resources corev1.ResourceRequirements `json:"resources,omitempty"` - - // List of sources to populate environment variables in the container. - // The keys defined within a source must be a C_IDENTIFIER. All invalid keys - // will be reported as an event when the container is starting. When a key exists in multiple - // sources, the value associated with the last source will take precedence. - // Values defined by an Env with a duplicate key will take precedence. - // Cannot be updated. - // +optional - EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"` - // List of environment variables to set in the container. - // Cannot be updated. - // +optional - Env []corev1.EnvVar `json:"env,omitempty"` - - // Pod volumes to mount into the container's filesystem. - // Cannot be updated. - // +optional - VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"` - - // List of volumes that can be mounted by containers belonging to the pod. - // More info: https://kubernetes.io/docs/concepts/storage/volumes - // +optional - Volumes []corev1.Volume `json:"volumes,omitempty"` -} - -// TenantRef Is the reference to the target tenant of the jobs -type TenantRef struct { - // *Required* + - Name string `json:"name"` - // *Required* + - Namespace string `json:"namespace"` -} - -// MinIOJobStatus Status of MinioJob resource -type MinIOJobStatus struct { - // +optional - Phase string `json:"phase"` - // +optional - CommandsStatus []CommandStatus `json:"commands"` - // +optional - Message string `json:"message"` -} - -// CommandStatus Status of MinioJob command execution -type CommandStatus struct { - // +optional - Name string `json:"name"` - // *Required* + - Result string `json:"result"` - // +optional - Message string `json:"message"` -} diff --git a/pkg/apis/job.min.io/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/job.min.io/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index a8c7e5f0f95..00000000000 --- a/pkg/apis/job.min.io/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,247 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1 "k8s.io/api/core/v1" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CommandSpec) DeepCopyInto(out *CommandSpec) { - *out = *in - if in.Args != nil { - in, out := &in.Args, &out.Args - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Command != nil { - in, out := &in.Command, &out.Command - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.DependsOn != nil { - in, out := &in.DependsOn, &out.DependsOn - *out = make([]string, len(*in)) - copy(*out, *in) - } - in.Resources.DeepCopyInto(&out.Resources) - if in.EnvFrom != nil { - in, out := &in.EnvFrom, &out.EnvFrom - *out = make([]v1.EnvFromSource, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Env != nil { - in, out := &in.Env, &out.Env - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.VolumeMounts != nil { - in, out := &in.VolumeMounts, &out.VolumeMounts - *out = make([]v1.VolumeMount, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Volumes != nil { - in, out := &in.Volumes, &out.Volumes - *out = make([]v1.Volume, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommandSpec. -func (in *CommandSpec) DeepCopy() *CommandSpec { - if in == nil { - return nil - } - out := new(CommandSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CommandStatus) DeepCopyInto(out *CommandStatus) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommandStatus. -func (in *CommandStatus) DeepCopy() *CommandStatus { - if in == nil { - return nil - } - out := new(CommandStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MinIOJob) DeepCopyInto(out *MinIOJob) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MinIOJob. -func (in *MinIOJob) DeepCopy() *MinIOJob { - if in == nil { - return nil - } - out := new(MinIOJob) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *MinIOJob) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MinIOJobList) DeepCopyInto(out *MinIOJobList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]MinIOJob, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MinIOJobList. -func (in *MinIOJobList) DeepCopy() *MinIOJobList { - if in == nil { - return nil - } - out := new(MinIOJobList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *MinIOJobList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MinIOJobSpec) DeepCopyInto(out *MinIOJobSpec) { - *out = *in - out.TenantRef = in.TenantRef - if in.Insecure != nil { - in, out := &in.Insecure, &out.Insecure - *out = new(bool) - **out = **in - } - if in.Commands != nil { - in, out := &in.Commands, &out.Commands - *out = make([]CommandSpec, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.ImagePullSecret != nil { - in, out := &in.ImagePullSecret, &out.ImagePullSecret - *out = make([]v1.LocalObjectReference, len(*in)) - copy(*out, *in) - } - if in.SecurityContext != nil { - in, out := &in.SecurityContext, &out.SecurityContext - *out = new(v1.PodSecurityContext) - (*in).DeepCopyInto(*out) - } - if in.ContainerSecurityContext != nil { - in, out := &in.ContainerSecurityContext, &out.ContainerSecurityContext - *out = new(v1.SecurityContext) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MinIOJobSpec. -func (in *MinIOJobSpec) DeepCopy() *MinIOJobSpec { - if in == nil { - return nil - } - out := new(MinIOJobSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MinIOJobStatus) DeepCopyInto(out *MinIOJobStatus) { - *out = *in - if in.CommandsStatus != nil { - in, out := &in.CommandsStatus, &out.CommandsStatus - *out = make([]CommandStatus, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MinIOJobStatus. -func (in *MinIOJobStatus) DeepCopy() *MinIOJobStatus { - if in == nil { - return nil - } - out := new(MinIOJobStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TenantRef) DeepCopyInto(out *TenantRef) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TenantRef. -func (in *TenantRef) DeepCopy() *TenantRef { - if in == nil { - return nil - } - out := new(TenantRef) - in.DeepCopyInto(out) - return out -} diff --git a/pkg/apis/job.min.io/v1alpha1/zz_generated.defaults.go b/pkg/apis/job.min.io/v1alpha1/zz_generated.defaults.go deleted file mode 100644 index 1c8e5bbc2b8..00000000000 --- a/pkg/apis/job.min.io/v1alpha1/zz_generated.defaults.go +++ /dev/null @@ -1,33 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by defaulter-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// RegisterDefaults adds defaulters functions to the given scheme. -// Public to allow building arbitrary schemes. -// All generated defaulters are covering - they call all nested defaulters. -func RegisterDefaults(scheme *runtime.Scheme) error { - return nil -} diff --git a/pkg/client/applyconfiguration/job.min.io/v1alpha1/commandspec.go b/pkg/client/applyconfiguration/job.min.io/v1alpha1/commandspec.go deleted file mode 100644 index 0b9ae4923c9..00000000000 --- a/pkg/client/applyconfiguration/job.min.io/v1alpha1/commandspec.go +++ /dev/null @@ -1,142 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1 "k8s.io/api/core/v1" -) - -// CommandSpecApplyConfiguration represents an declarative configuration of the CommandSpec type for use -// with apply. -type CommandSpecApplyConfiguration struct { - Operation *string `json:"op,omitempty"` - Name *string `json:"name,omitempty"` - Args map[string]string `json:"args,omitempty"` - Command []string `json:"command,omitempty"` - DependsOn []string `json:"dependsOn,omitempty"` - Resources *v1.ResourceRequirements `json:"resources,omitempty"` - EnvFrom []v1.EnvFromSource `json:"envFrom,omitempty"` - Env []v1.EnvVar `json:"env,omitempty"` - VolumeMounts []v1.VolumeMount `json:"volumeMounts,omitempty"` - Volumes []v1.Volume `json:"volumes,omitempty"` -} - -// CommandSpecApplyConfiguration constructs an declarative configuration of the CommandSpec type for use with -// apply. -func CommandSpec() *CommandSpecApplyConfiguration { - return &CommandSpecApplyConfiguration{} -} - -// WithOperation sets the Operation field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Operation field is set to the value of the last call. -func (b *CommandSpecApplyConfiguration) WithOperation(value string) *CommandSpecApplyConfiguration { - b.Operation = &value - return b -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *CommandSpecApplyConfiguration) WithName(value string) *CommandSpecApplyConfiguration { - b.Name = &value - return b -} - -// WithArgs puts the entries into the Args field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Args field, -// overwriting an existing map entries in Args field with the same key. -func (b *CommandSpecApplyConfiguration) WithArgs(entries map[string]string) *CommandSpecApplyConfiguration { - if b.Args == nil && len(entries) > 0 { - b.Args = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Args[k] = v - } - return b -} - -// WithCommand adds the given value to the Command field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Command field. -func (b *CommandSpecApplyConfiguration) WithCommand(values ...string) *CommandSpecApplyConfiguration { - for i := range values { - b.Command = append(b.Command, values[i]) - } - return b -} - -// WithDependsOn adds the given value to the DependsOn field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the DependsOn field. -func (b *CommandSpecApplyConfiguration) WithDependsOn(values ...string) *CommandSpecApplyConfiguration { - for i := range values { - b.DependsOn = append(b.DependsOn, values[i]) - } - return b -} - -// WithResources sets the Resources field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Resources field is set to the value of the last call. -func (b *CommandSpecApplyConfiguration) WithResources(value v1.ResourceRequirements) *CommandSpecApplyConfiguration { - b.Resources = &value - return b -} - -// WithEnvFrom adds the given value to the EnvFrom field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the EnvFrom field. -func (b *CommandSpecApplyConfiguration) WithEnvFrom(values ...v1.EnvFromSource) *CommandSpecApplyConfiguration { - for i := range values { - b.EnvFrom = append(b.EnvFrom, values[i]) - } - return b -} - -// WithEnv adds the given value to the Env field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Env field. -func (b *CommandSpecApplyConfiguration) WithEnv(values ...v1.EnvVar) *CommandSpecApplyConfiguration { - for i := range values { - b.Env = append(b.Env, values[i]) - } - return b -} - -// WithVolumeMounts adds the given value to the VolumeMounts field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the VolumeMounts field. -func (b *CommandSpecApplyConfiguration) WithVolumeMounts(values ...v1.VolumeMount) *CommandSpecApplyConfiguration { - for i := range values { - b.VolumeMounts = append(b.VolumeMounts, values[i]) - } - return b -} - -// WithVolumes adds the given value to the Volumes field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Volumes field. -func (b *CommandSpecApplyConfiguration) WithVolumes(values ...v1.Volume) *CommandSpecApplyConfiguration { - for i := range values { - b.Volumes = append(b.Volumes, values[i]) - } - return b -} diff --git a/pkg/client/applyconfiguration/job.min.io/v1alpha1/commandstatus.go b/pkg/client/applyconfiguration/job.min.io/v1alpha1/commandstatus.go deleted file mode 100644 index 6513f2394f3..00000000000 --- a/pkg/client/applyconfiguration/job.min.io/v1alpha1/commandstatus.go +++ /dev/null @@ -1,57 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// CommandStatusApplyConfiguration represents an declarative configuration of the CommandStatus type for use -// with apply. -type CommandStatusApplyConfiguration struct { - Name *string `json:"name,omitempty"` - Result *string `json:"result,omitempty"` - Message *string `json:"message,omitempty"` -} - -// CommandStatusApplyConfiguration constructs an declarative configuration of the CommandStatus type for use with -// apply. -func CommandStatus() *CommandStatusApplyConfiguration { - return &CommandStatusApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *CommandStatusApplyConfiguration) WithName(value string) *CommandStatusApplyConfiguration { - b.Name = &value - return b -} - -// WithResult sets the Result field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Result field is set to the value of the last call. -func (b *CommandStatusApplyConfiguration) WithResult(value string) *CommandStatusApplyConfiguration { - b.Result = &value - return b -} - -// WithMessage sets the Message field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Message field is set to the value of the last call. -func (b *CommandStatusApplyConfiguration) WithMessage(value string) *CommandStatusApplyConfiguration { - b.Message = &value - return b -} diff --git a/pkg/client/applyconfiguration/job.min.io/v1alpha1/miniojob.go b/pkg/client/applyconfiguration/job.min.io/v1alpha1/miniojob.go deleted file mode 100644 index fd3e5f46f1a..00000000000 --- a/pkg/client/applyconfiguration/job.min.io/v1alpha1/miniojob.go +++ /dev/null @@ -1,219 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - v1 "k8s.io/client-go/applyconfigurations/meta/v1" -) - -// MinIOJobApplyConfiguration represents an declarative configuration of the MinIOJob type for use -// with apply. -type MinIOJobApplyConfiguration struct { - v1.TypeMetaApplyConfiguration `json:",inline"` - *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - Spec *MinIOJobSpecApplyConfiguration `json:"spec,omitempty"` - Status *MinIOJobStatusApplyConfiguration `json:"status,omitempty"` -} - -// MinIOJob constructs an declarative configuration of the MinIOJob type for use with -// apply. -func MinIOJob(name, namespace string) *MinIOJobApplyConfiguration { - b := &MinIOJobApplyConfiguration{} - b.WithName(name) - b.WithNamespace(namespace) - b.WithKind("MinIOJob") - b.WithAPIVersion("job.min.io/v1alpha1") - return b -} - -// WithKind sets the Kind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Kind field is set to the value of the last call. -func (b *MinIOJobApplyConfiguration) WithKind(value string) *MinIOJobApplyConfiguration { - b.Kind = &value - return b -} - -// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the APIVersion field is set to the value of the last call. -func (b *MinIOJobApplyConfiguration) WithAPIVersion(value string) *MinIOJobApplyConfiguration { - b.APIVersion = &value - return b -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *MinIOJobApplyConfiguration) WithName(value string) *MinIOJobApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Name = &value - return b -} - -// WithGenerateName sets the GenerateName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the GenerateName field is set to the value of the last call. -func (b *MinIOJobApplyConfiguration) WithGenerateName(value string) *MinIOJobApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.GenerateName = &value - return b -} - -// WithNamespace sets the Namespace field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Namespace field is set to the value of the last call. -func (b *MinIOJobApplyConfiguration) WithNamespace(value string) *MinIOJobApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Namespace = &value - return b -} - -// WithUID sets the UID field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the UID field is set to the value of the last call. -func (b *MinIOJobApplyConfiguration) WithUID(value types.UID) *MinIOJobApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.UID = &value - return b -} - -// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ResourceVersion field is set to the value of the last call. -func (b *MinIOJobApplyConfiguration) WithResourceVersion(value string) *MinIOJobApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.ResourceVersion = &value - return b -} - -// WithGeneration sets the Generation field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Generation field is set to the value of the last call. -func (b *MinIOJobApplyConfiguration) WithGeneration(value int64) *MinIOJobApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.Generation = &value - return b -} - -// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CreationTimestamp field is set to the value of the last call. -func (b *MinIOJobApplyConfiguration) WithCreationTimestamp(value metav1.Time) *MinIOJobApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.CreationTimestamp = &value - return b -} - -// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionTimestamp field is set to the value of the last call. -func (b *MinIOJobApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *MinIOJobApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionTimestamp = &value - return b -} - -// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. -func (b *MinIOJobApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MinIOJobApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - b.DeletionGracePeriodSeconds = &value - return b -} - -// WithLabels puts the entries into the Labels field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Labels field, -// overwriting an existing map entries in Labels field with the same key. -func (b *MinIOJobApplyConfiguration) WithLabels(entries map[string]string) *MinIOJobApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Labels == nil && len(entries) > 0 { - b.Labels = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Labels[k] = v - } - return b -} - -// WithAnnotations puts the entries into the Annotations field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, the entries provided by each call will be put on the Annotations field, -// overwriting an existing map entries in Annotations field with the same key. -func (b *MinIOJobApplyConfiguration) WithAnnotations(entries map[string]string) *MinIOJobApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - if b.Annotations == nil && len(entries) > 0 { - b.Annotations = make(map[string]string, len(entries)) - } - for k, v := range entries { - b.Annotations[k] = v - } - return b -} - -// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the OwnerReferences field. -func (b *MinIOJobApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *MinIOJobApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - if values[i] == nil { - panic("nil value passed to WithOwnerReferences") - } - b.OwnerReferences = append(b.OwnerReferences, *values[i]) - } - return b -} - -// WithFinalizers adds the given value to the Finalizers field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Finalizers field. -func (b *MinIOJobApplyConfiguration) WithFinalizers(values ...string) *MinIOJobApplyConfiguration { - b.ensureObjectMetaApplyConfigurationExists() - for i := range values { - b.Finalizers = append(b.Finalizers, values[i]) - } - return b -} - -func (b *MinIOJobApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { - if b.ObjectMetaApplyConfiguration == nil { - b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} - } -} - -// WithSpec sets the Spec field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Spec field is set to the value of the last call. -func (b *MinIOJobApplyConfiguration) WithSpec(value *MinIOJobSpecApplyConfiguration) *MinIOJobApplyConfiguration { - b.Spec = value - return b -} - -// WithStatus sets the Status field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Status field is set to the value of the last call. -func (b *MinIOJobApplyConfiguration) WithStatus(value *MinIOJobStatusApplyConfiguration) *MinIOJobApplyConfiguration { - b.Status = value - return b -} diff --git a/pkg/client/applyconfiguration/job.min.io/v1alpha1/miniojobspec.go b/pkg/client/applyconfiguration/job.min.io/v1alpha1/miniojobspec.go deleted file mode 100644 index 292bc8880ee..00000000000 --- a/pkg/client/applyconfiguration/job.min.io/v1alpha1/miniojobspec.go +++ /dev/null @@ -1,141 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - jobminiov1alpha1 "github.com/minio/operator/pkg/apis/job.min.io/v1alpha1" - v1 "k8s.io/api/core/v1" -) - -// MinIOJobSpecApplyConfiguration represents an declarative configuration of the MinIOJobSpec type for use -// with apply. -type MinIOJobSpecApplyConfiguration struct { - ServiceAccountName *string `json:"serviceAccountName,omitempty"` - TenantRef *TenantRefApplyConfiguration `json:"tenant,omitempty"` - Execution *jobminiov1alpha1.Execution `json:"execution,omitempty"` - FailureStrategy *jobminiov1alpha1.FailureStrategy `json:"failureStrategy,omitempty"` - Insecure *bool `json:"insecure,omitempty"` - Commands []CommandSpecApplyConfiguration `json:"commands,omitempty"` - MCImage *string `json:"mcImage,omitempty"` - ImagePullPolicy *v1.PullPolicy `json:"imagePullPolicy,omitempty"` - ImagePullSecret []v1.LocalObjectReference `json:"imagePullSecret,omitempty"` - SecurityContext *v1.PodSecurityContext `json:"securityContext,omitempty"` - ContainerSecurityContext *v1.SecurityContext `json:"containerSecurityContext,omitempty"` -} - -// MinIOJobSpecApplyConfiguration constructs an declarative configuration of the MinIOJobSpec type for use with -// apply. -func MinIOJobSpec() *MinIOJobSpecApplyConfiguration { - return &MinIOJobSpecApplyConfiguration{} -} - -// WithServiceAccountName sets the ServiceAccountName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ServiceAccountName field is set to the value of the last call. -func (b *MinIOJobSpecApplyConfiguration) WithServiceAccountName(value string) *MinIOJobSpecApplyConfiguration { - b.ServiceAccountName = &value - return b -} - -// WithTenantRef sets the TenantRef field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the TenantRef field is set to the value of the last call. -func (b *MinIOJobSpecApplyConfiguration) WithTenantRef(value *TenantRefApplyConfiguration) *MinIOJobSpecApplyConfiguration { - b.TenantRef = value - return b -} - -// WithExecution sets the Execution field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Execution field is set to the value of the last call. -func (b *MinIOJobSpecApplyConfiguration) WithExecution(value jobminiov1alpha1.Execution) *MinIOJobSpecApplyConfiguration { - b.Execution = &value - return b -} - -// WithFailureStrategy sets the FailureStrategy field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the FailureStrategy field is set to the value of the last call. -func (b *MinIOJobSpecApplyConfiguration) WithFailureStrategy(value jobminiov1alpha1.FailureStrategy) *MinIOJobSpecApplyConfiguration { - b.FailureStrategy = &value - return b -} - -// WithInsecure sets the Insecure field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Insecure field is set to the value of the last call. -func (b *MinIOJobSpecApplyConfiguration) WithInsecure(value bool) *MinIOJobSpecApplyConfiguration { - b.Insecure = &value - return b -} - -// WithCommands adds the given value to the Commands field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Commands field. -func (b *MinIOJobSpecApplyConfiguration) WithCommands(values ...*CommandSpecApplyConfiguration) *MinIOJobSpecApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithCommands") - } - b.Commands = append(b.Commands, *values[i]) - } - return b -} - -// WithMCImage sets the MCImage field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the MCImage field is set to the value of the last call. -func (b *MinIOJobSpecApplyConfiguration) WithMCImage(value string) *MinIOJobSpecApplyConfiguration { - b.MCImage = &value - return b -} - -// WithImagePullPolicy sets the ImagePullPolicy field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ImagePullPolicy field is set to the value of the last call. -func (b *MinIOJobSpecApplyConfiguration) WithImagePullPolicy(value v1.PullPolicy) *MinIOJobSpecApplyConfiguration { - b.ImagePullPolicy = &value - return b -} - -// WithImagePullSecret adds the given value to the ImagePullSecret field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the ImagePullSecret field. -func (b *MinIOJobSpecApplyConfiguration) WithImagePullSecret(values ...v1.LocalObjectReference) *MinIOJobSpecApplyConfiguration { - for i := range values { - b.ImagePullSecret = append(b.ImagePullSecret, values[i]) - } - return b -} - -// WithSecurityContext sets the SecurityContext field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the SecurityContext field is set to the value of the last call. -func (b *MinIOJobSpecApplyConfiguration) WithSecurityContext(value v1.PodSecurityContext) *MinIOJobSpecApplyConfiguration { - b.SecurityContext = &value - return b -} - -// WithContainerSecurityContext sets the ContainerSecurityContext field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ContainerSecurityContext field is set to the value of the last call. -func (b *MinIOJobSpecApplyConfiguration) WithContainerSecurityContext(value v1.SecurityContext) *MinIOJobSpecApplyConfiguration { - b.ContainerSecurityContext = &value - return b -} diff --git a/pkg/client/applyconfiguration/job.min.io/v1alpha1/miniojobstatus.go b/pkg/client/applyconfiguration/job.min.io/v1alpha1/miniojobstatus.go deleted file mode 100644 index 77f86f7aeca..00000000000 --- a/pkg/client/applyconfiguration/job.min.io/v1alpha1/miniojobstatus.go +++ /dev/null @@ -1,62 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// MinIOJobStatusApplyConfiguration represents an declarative configuration of the MinIOJobStatus type for use -// with apply. -type MinIOJobStatusApplyConfiguration struct { - Phase *string `json:"phase,omitempty"` - CommandsStatus []CommandStatusApplyConfiguration `json:"commands,omitempty"` - Message *string `json:"message,omitempty"` -} - -// MinIOJobStatusApplyConfiguration constructs an declarative configuration of the MinIOJobStatus type for use with -// apply. -func MinIOJobStatus() *MinIOJobStatusApplyConfiguration { - return &MinIOJobStatusApplyConfiguration{} -} - -// WithPhase sets the Phase field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Phase field is set to the value of the last call. -func (b *MinIOJobStatusApplyConfiguration) WithPhase(value string) *MinIOJobStatusApplyConfiguration { - b.Phase = &value - return b -} - -// WithCommandsStatus adds the given value to the CommandsStatus field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the CommandsStatus field. -func (b *MinIOJobStatusApplyConfiguration) WithCommandsStatus(values ...*CommandStatusApplyConfiguration) *MinIOJobStatusApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithCommandsStatus") - } - b.CommandsStatus = append(b.CommandsStatus, *values[i]) - } - return b -} - -// WithMessage sets the Message field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Message field is set to the value of the last call. -func (b *MinIOJobStatusApplyConfiguration) WithMessage(value string) *MinIOJobStatusApplyConfiguration { - b.Message = &value - return b -} diff --git a/pkg/client/applyconfiguration/job.min.io/v1alpha1/tenantref.go b/pkg/client/applyconfiguration/job.min.io/v1alpha1/tenantref.go deleted file mode 100644 index be69e6c184e..00000000000 --- a/pkg/client/applyconfiguration/job.min.io/v1alpha1/tenantref.go +++ /dev/null @@ -1,48 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// TenantRefApplyConfiguration represents an declarative configuration of the TenantRef type for use -// with apply. -type TenantRefApplyConfiguration struct { - Name *string `json:"name,omitempty"` - Namespace *string `json:"namespace,omitempty"` -} - -// TenantRefApplyConfiguration constructs an declarative configuration of the TenantRef type for use with -// apply. -func TenantRef() *TenantRefApplyConfiguration { - return &TenantRefApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *TenantRefApplyConfiguration) WithName(value string) *TenantRefApplyConfiguration { - b.Name = &value - return b -} - -// WithNamespace sets the Namespace field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Namespace field is set to the value of the last call. -func (b *TenantRefApplyConfiguration) WithNamespace(value string) *TenantRefApplyConfiguration { - b.Namespace = &value - return b -} diff --git a/pkg/client/applyconfiguration/utils.go b/pkg/client/applyconfiguration/utils.go index 1dd2f545ea7..ebcea32724f 100644 --- a/pkg/client/applyconfiguration/utils.go +++ b/pkg/client/applyconfiguration/utils.go @@ -19,13 +19,11 @@ package applyconfiguration import ( - v1alpha1 "github.com/minio/operator/pkg/apis/job.min.io/v1alpha1" v2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - stsminiov1alpha1 "github.com/minio/operator/pkg/apis/sts.min.io/v1alpha1" + v1alpha1 "github.com/minio/operator/pkg/apis/sts.min.io/v1alpha1" v1beta1 "github.com/minio/operator/pkg/apis/sts.min.io/v1beta1" - jobminiov1alpha1 "github.com/minio/operator/pkg/client/applyconfiguration/job.min.io/v1alpha1" miniominiov2 "github.com/minio/operator/pkg/client/applyconfiguration/minio.min.io/v2" - applyconfigurationstsminiov1alpha1 "github.com/minio/operator/pkg/client/applyconfiguration/sts.min.io/v1alpha1" + stsminiov1alpha1 "github.com/minio/operator/pkg/client/applyconfiguration/sts.min.io/v1alpha1" stsminiov1beta1 "github.com/minio/operator/pkg/client/applyconfiguration/sts.min.io/v1beta1" schema "k8s.io/apimachinery/pkg/runtime/schema" ) @@ -34,21 +32,7 @@ import ( // apply configuration type exists for the given GroupVersionKind. func ForKind(kind schema.GroupVersionKind) interface{} { switch kind { - // Group=job.min.io, Version=v1alpha1 - case v1alpha1.SchemeGroupVersion.WithKind("CommandSpec"): - return &jobminiov1alpha1.CommandSpecApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("CommandStatus"): - return &jobminiov1alpha1.CommandStatusApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("MinIOJob"): - return &jobminiov1alpha1.MinIOJobApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("MinIOJobSpec"): - return &jobminiov1alpha1.MinIOJobSpecApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("MinIOJobStatus"): - return &jobminiov1alpha1.MinIOJobStatusApplyConfiguration{} - case v1alpha1.SchemeGroupVersion.WithKind("TenantRef"): - return &jobminiov1alpha1.TenantRefApplyConfiguration{} - - // Group=minio.min.io, Version=v2 + // Group=minio.min.io, Version=v2 case v2.SchemeGroupVersion.WithKind("Bucket"): return &miniominiov2.BucketApplyConfiguration{} case v2.SchemeGroupVersion.WithKind("CertificateConfig"): @@ -93,16 +77,16 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &miniominiov2.TierUsageApplyConfiguration{} // Group=sts.min.io, Version=v1alpha1 - case stsminiov1alpha1.SchemeGroupVersion.WithKind("Application"): - return &applyconfigurationstsminiov1alpha1.ApplicationApplyConfiguration{} - case stsminiov1alpha1.SchemeGroupVersion.WithKind("PolicyBinding"): - return &applyconfigurationstsminiov1alpha1.PolicyBindingApplyConfiguration{} - case stsminiov1alpha1.SchemeGroupVersion.WithKind("PolicyBindingSpec"): - return &applyconfigurationstsminiov1alpha1.PolicyBindingSpecApplyConfiguration{} - case stsminiov1alpha1.SchemeGroupVersion.WithKind("PolicyBindingStatus"): - return &applyconfigurationstsminiov1alpha1.PolicyBindingStatusApplyConfiguration{} - case stsminiov1alpha1.SchemeGroupVersion.WithKind("PolicyBindingUsage"): - return &applyconfigurationstsminiov1alpha1.PolicyBindingUsageApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Application"): + return &stsminiov1alpha1.ApplicationApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("PolicyBinding"): + return &stsminiov1alpha1.PolicyBindingApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("PolicyBindingSpec"): + return &stsminiov1alpha1.PolicyBindingSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("PolicyBindingStatus"): + return &stsminiov1alpha1.PolicyBindingStatusApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("PolicyBindingUsage"): + return &stsminiov1alpha1.PolicyBindingUsageApplyConfiguration{} // Group=sts.min.io, Version=v1beta1 case v1beta1.SchemeGroupVersion.WithKind("Application"): diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index fc6929e3ba0..6b1ab779cde 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -22,7 +22,6 @@ import ( "fmt" "net/http" - jobv1alpha1 "github.com/minio/operator/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1" miniov2 "github.com/minio/operator/pkg/client/clientset/versioned/typed/minio.min.io/v2" stsv1alpha1 "github.com/minio/operator/pkg/client/clientset/versioned/typed/sts.min.io/v1alpha1" stsv1beta1 "github.com/minio/operator/pkg/client/clientset/versioned/typed/sts.min.io/v1beta1" @@ -33,7 +32,6 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface - JobV1alpha1() jobv1alpha1.JobV1alpha1Interface MinioV2() miniov2.MinioV2Interface StsV1alpha1() stsv1alpha1.StsV1alpha1Interface StsV1beta1() stsv1beta1.StsV1beta1Interface @@ -42,17 +40,11 @@ type Interface interface { // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient - jobV1alpha1 *jobv1alpha1.JobV1alpha1Client minioV2 *miniov2.MinioV2Client stsV1alpha1 *stsv1alpha1.StsV1alpha1Client stsV1beta1 *stsv1beta1.StsV1beta1Client } -// JobV1alpha1 retrieves the JobV1alpha1Client -func (c *Clientset) JobV1alpha1() jobv1alpha1.JobV1alpha1Interface { - return c.jobV1alpha1 -} - // MinioV2 retrieves the MinioV2Client func (c *Clientset) MinioV2() miniov2.MinioV2Interface { return c.minioV2 @@ -112,10 +104,6 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, var cs Clientset var err error - cs.jobV1alpha1, err = jobv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } cs.minioV2, err = miniov2.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -149,7 +137,6 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.jobV1alpha1 = jobv1alpha1.New(c) cs.minioV2 = miniov2.New(c) cs.stsV1alpha1 = stsv1alpha1.New(c) cs.stsV1beta1 = stsv1beta1.New(c) diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 77bd26d8b97..d0ec5adc5c3 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -20,8 +20,6 @@ package fake import ( clientset "github.com/minio/operator/pkg/client/clientset/versioned" - jobv1alpha1 "github.com/minio/operator/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1" - fakejobv1alpha1 "github.com/minio/operator/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/fake" miniov2 "github.com/minio/operator/pkg/client/clientset/versioned/typed/minio.min.io/v2" fakeminiov2 "github.com/minio/operator/pkg/client/clientset/versioned/typed/minio.min.io/v2/fake" stsv1alpha1 "github.com/minio/operator/pkg/client/clientset/versioned/typed/sts.min.io/v1alpha1" @@ -85,11 +83,6 @@ var ( _ testing.FakeClient = &Clientset{} ) -// JobV1alpha1 retrieves the JobV1alpha1Client -func (c *Clientset) JobV1alpha1() jobv1alpha1.JobV1alpha1Interface { - return &fakejobv1alpha1.FakeJobV1alpha1{Fake: &c.Fake} -} - // MinioV2 retrieves the MinioV2Client func (c *Clientset) MinioV2() miniov2.MinioV2Interface { return &fakeminiov2.FakeMinioV2{Fake: &c.Fake} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index a16b9b7bcb5..e9e3862e180 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -19,7 +19,6 @@ package fake import ( - jobv1alpha1 "github.com/minio/operator/pkg/apis/job.min.io/v1alpha1" miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" stsv1alpha1 "github.com/minio/operator/pkg/apis/sts.min.io/v1alpha1" stsv1beta1 "github.com/minio/operator/pkg/apis/sts.min.io/v1beta1" @@ -34,7 +33,6 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - jobv1alpha1.AddToScheme, miniov2.AddToScheme, stsv1alpha1.AddToScheme, stsv1beta1.AddToScheme, diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index 315169d2ae1..5642bb02a3b 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -19,7 +19,6 @@ package scheme import ( - jobv1alpha1 "github.com/minio/operator/pkg/apis/job.min.io/v1alpha1" miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" stsv1alpha1 "github.com/minio/operator/pkg/apis/sts.min.io/v1alpha1" stsv1beta1 "github.com/minio/operator/pkg/apis/sts.min.io/v1beta1" @@ -34,7 +33,6 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - jobv1alpha1.AddToScheme, miniov2.AddToScheme, stsv1alpha1.AddToScheme, stsv1beta1.AddToScheme, diff --git a/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/doc.go deleted file mode 100644 index 02387217b31..00000000000 --- a/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1alpha1 diff --git a/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/fake/doc.go deleted file mode 100644 index dfb88f23596..00000000000 --- a/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/fake/fake_job.min.io_client.go b/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/fake/fake_job.min.io_client.go deleted file mode 100644 index d2b30ccd379..00000000000 --- a/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/fake/fake_job.min.io_client.go +++ /dev/null @@ -1,40 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1alpha1 "github.com/minio/operator/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeJobV1alpha1 struct { - *testing.Fake -} - -func (c *FakeJobV1alpha1) MinIOJobs(namespace string) v1alpha1.MinIOJobInterface { - return &FakeMinIOJobs{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeJobV1alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/fake/fake_miniojob.go b/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/fake/fake_miniojob.go deleted file mode 100644 index 47f4cb0fe94..00000000000 --- a/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/fake/fake_miniojob.go +++ /dev/null @@ -1,189 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - json "encoding/json" - "fmt" - - v1alpha1 "github.com/minio/operator/pkg/apis/job.min.io/v1alpha1" - jobminiov1alpha1 "github.com/minio/operator/pkg/client/applyconfiguration/job.min.io/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeMinIOJobs implements MinIOJobInterface -type FakeMinIOJobs struct { - Fake *FakeJobV1alpha1 - ns string -} - -var miniojobsResource = v1alpha1.SchemeGroupVersion.WithResource("miniojobs") - -var miniojobsKind = v1alpha1.SchemeGroupVersion.WithKind("MinIOJob") - -// Get takes name of the minIOJob, and returns the corresponding minIOJob object, and an error if there is any. -func (c *FakeMinIOJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MinIOJob, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(miniojobsResource, c.ns, name), &v1alpha1.MinIOJob{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.MinIOJob), err -} - -// List takes label and field selectors, and returns the list of MinIOJobs that match those selectors. -func (c *FakeMinIOJobs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MinIOJobList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(miniojobsResource, miniojobsKind, c.ns, opts), &v1alpha1.MinIOJobList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.MinIOJobList{ListMeta: obj.(*v1alpha1.MinIOJobList).ListMeta} - for _, item := range obj.(*v1alpha1.MinIOJobList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested minIOJobs. -func (c *FakeMinIOJobs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(miniojobsResource, c.ns, opts)) - -} - -// Create takes the representation of a minIOJob and creates it. Returns the server's representation of the minIOJob, and an error, if there is any. -func (c *FakeMinIOJobs) Create(ctx context.Context, minIOJob *v1alpha1.MinIOJob, opts v1.CreateOptions) (result *v1alpha1.MinIOJob, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(miniojobsResource, c.ns, minIOJob), &v1alpha1.MinIOJob{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.MinIOJob), err -} - -// Update takes the representation of a minIOJob and updates it. Returns the server's representation of the minIOJob, and an error, if there is any. -func (c *FakeMinIOJobs) Update(ctx context.Context, minIOJob *v1alpha1.MinIOJob, opts v1.UpdateOptions) (result *v1alpha1.MinIOJob, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(miniojobsResource, c.ns, minIOJob), &v1alpha1.MinIOJob{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.MinIOJob), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeMinIOJobs) UpdateStatus(ctx context.Context, minIOJob *v1alpha1.MinIOJob, opts v1.UpdateOptions) (*v1alpha1.MinIOJob, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(miniojobsResource, "status", c.ns, minIOJob), &v1alpha1.MinIOJob{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.MinIOJob), err -} - -// Delete takes name of the minIOJob and deletes it. Returns an error if one occurs. -func (c *FakeMinIOJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(miniojobsResource, c.ns, name, opts), &v1alpha1.MinIOJob{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeMinIOJobs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(miniojobsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.MinIOJobList{}) - return err -} - -// Patch applies the patch and returns the patched minIOJob. -func (c *FakeMinIOJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MinIOJob, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(miniojobsResource, c.ns, name, pt, data, subresources...), &v1alpha1.MinIOJob{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.MinIOJob), err -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied minIOJob. -func (c *FakeMinIOJobs) Apply(ctx context.Context, minIOJob *jobminiov1alpha1.MinIOJobApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MinIOJob, err error) { - if minIOJob == nil { - return nil, fmt.Errorf("minIOJob provided to Apply must not be nil") - } - data, err := json.Marshal(minIOJob) - if err != nil { - return nil, err - } - name := minIOJob.Name - if name == nil { - return nil, fmt.Errorf("minIOJob.Name must be provided to Apply") - } - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(miniojobsResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.MinIOJob{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.MinIOJob), err -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *FakeMinIOJobs) ApplyStatus(ctx context.Context, minIOJob *jobminiov1alpha1.MinIOJobApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MinIOJob, err error) { - if minIOJob == nil { - return nil, fmt.Errorf("minIOJob provided to Apply must not be nil") - } - data, err := json.Marshal(minIOJob) - if err != nil { - return nil, err - } - name := minIOJob.Name - if name == nil { - return nil, fmt.Errorf("minIOJob.Name must be provided to Apply") - } - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(miniojobsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.MinIOJob{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.MinIOJob), err -} diff --git a/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/generated_expansion.go deleted file mode 100644 index 273dc418805..00000000000 --- a/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/generated_expansion.go +++ /dev/null @@ -1,21 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -type MinIOJobExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/job.min.io_client.go b/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/job.min.io_client.go deleted file mode 100644 index 54ce1cec604..00000000000 --- a/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/job.min.io_client.go +++ /dev/null @@ -1,107 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "net/http" - - v1alpha1 "github.com/minio/operator/pkg/apis/job.min.io/v1alpha1" - "github.com/minio/operator/pkg/client/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type JobV1alpha1Interface interface { - RESTClient() rest.Interface - MinIOJobsGetter -} - -// JobV1alpha1Client is used to interact with features provided by the job.min.io group. -type JobV1alpha1Client struct { - restClient rest.Interface -} - -func (c *JobV1alpha1Client) MinIOJobs(namespace string) MinIOJobInterface { - return newMinIOJobs(c, namespace) -} - -// NewForConfig creates a new JobV1alpha1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*JobV1alpha1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - httpClient, err := rest.HTTPClientFor(&config) - if err != nil { - return nil, err - } - return NewForConfigAndClient(&config, httpClient) -} - -// NewForConfigAndClient creates a new JobV1alpha1Client for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*JobV1alpha1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientForConfigAndClient(&config, h) - if err != nil { - return nil, err - } - return &JobV1alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new JobV1alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *JobV1alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new JobV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *JobV1alpha1Client { - return &JobV1alpha1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1alpha1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *JobV1alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/miniojob.go b/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/miniojob.go deleted file mode 100644 index 50d564b03e6..00000000000 --- a/pkg/client/clientset/versioned/typed/job.min.io/v1alpha1/miniojob.go +++ /dev/null @@ -1,256 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - json "encoding/json" - "fmt" - "time" - - v1alpha1 "github.com/minio/operator/pkg/apis/job.min.io/v1alpha1" - jobminiov1alpha1 "github.com/minio/operator/pkg/client/applyconfiguration/job.min.io/v1alpha1" - scheme "github.com/minio/operator/pkg/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// MinIOJobsGetter has a method to return a MinIOJobInterface. -// A group's client should implement this interface. -type MinIOJobsGetter interface { - MinIOJobs(namespace string) MinIOJobInterface -} - -// MinIOJobInterface has methods to work with MinIOJob resources. -type MinIOJobInterface interface { - Create(ctx context.Context, minIOJob *v1alpha1.MinIOJob, opts v1.CreateOptions) (*v1alpha1.MinIOJob, error) - Update(ctx context.Context, minIOJob *v1alpha1.MinIOJob, opts v1.UpdateOptions) (*v1alpha1.MinIOJob, error) - UpdateStatus(ctx context.Context, minIOJob *v1alpha1.MinIOJob, opts v1.UpdateOptions) (*v1alpha1.MinIOJob, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.MinIOJob, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.MinIOJobList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MinIOJob, err error) - Apply(ctx context.Context, minIOJob *jobminiov1alpha1.MinIOJobApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MinIOJob, err error) - ApplyStatus(ctx context.Context, minIOJob *jobminiov1alpha1.MinIOJobApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MinIOJob, err error) - MinIOJobExpansion -} - -// minIOJobs implements MinIOJobInterface -type minIOJobs struct { - client rest.Interface - ns string -} - -// newMinIOJobs returns a MinIOJobs -func newMinIOJobs(c *JobV1alpha1Client, namespace string) *minIOJobs { - return &minIOJobs{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the minIOJob, and returns the corresponding minIOJob object, and an error if there is any. -func (c *minIOJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MinIOJob, err error) { - result = &v1alpha1.MinIOJob{} - err = c.client.Get(). - Namespace(c.ns). - Resource("miniojobs"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of MinIOJobs that match those selectors. -func (c *minIOJobs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MinIOJobList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.MinIOJobList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("miniojobs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested minIOJobs. -func (c *minIOJobs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("miniojobs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a minIOJob and creates it. Returns the server's representation of the minIOJob, and an error, if there is any. -func (c *minIOJobs) Create(ctx context.Context, minIOJob *v1alpha1.MinIOJob, opts v1.CreateOptions) (result *v1alpha1.MinIOJob, err error) { - result = &v1alpha1.MinIOJob{} - err = c.client.Post(). - Namespace(c.ns). - Resource("miniojobs"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(minIOJob). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a minIOJob and updates it. Returns the server's representation of the minIOJob, and an error, if there is any. -func (c *minIOJobs) Update(ctx context.Context, minIOJob *v1alpha1.MinIOJob, opts v1.UpdateOptions) (result *v1alpha1.MinIOJob, err error) { - result = &v1alpha1.MinIOJob{} - err = c.client.Put(). - Namespace(c.ns). - Resource("miniojobs"). - Name(minIOJob.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(minIOJob). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *minIOJobs) UpdateStatus(ctx context.Context, minIOJob *v1alpha1.MinIOJob, opts v1.UpdateOptions) (result *v1alpha1.MinIOJob, err error) { - result = &v1alpha1.MinIOJob{} - err = c.client.Put(). - Namespace(c.ns). - Resource("miniojobs"). - Name(minIOJob.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(minIOJob). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the minIOJob and deletes it. Returns an error if one occurs. -func (c *minIOJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("miniojobs"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *minIOJobs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("miniojobs"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched minIOJob. -func (c *minIOJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MinIOJob, err error) { - result = &v1alpha1.MinIOJob{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("miniojobs"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied minIOJob. -func (c *minIOJobs) Apply(ctx context.Context, minIOJob *jobminiov1alpha1.MinIOJobApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MinIOJob, err error) { - if minIOJob == nil { - return nil, fmt.Errorf("minIOJob provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(minIOJob) - if err != nil { - return nil, err - } - name := minIOJob.Name - if name == nil { - return nil, fmt.Errorf("minIOJob.Name must be provided to Apply") - } - result = &v1alpha1.MinIOJob{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("miniojobs"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *minIOJobs) ApplyStatus(ctx context.Context, minIOJob *jobminiov1alpha1.MinIOJobApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MinIOJob, err error) { - if minIOJob == nil { - return nil, fmt.Errorf("minIOJob provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(minIOJob) - if err != nil { - return nil, err - } - - name := minIOJob.Name - if name == nil { - return nil, fmt.Errorf("minIOJob.Name must be provided to Apply") - } - - result = &v1alpha1.MinIOJob{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("miniojobs"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index ef0d992b62f..195bce08851 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -25,7 +25,6 @@ import ( versioned "github.com/minio/operator/pkg/client/clientset/versioned" internalinterfaces "github.com/minio/operator/pkg/client/informers/externalversions/internalinterfaces" - jobminio "github.com/minio/operator/pkg/client/informers/externalversions/job.min.io" miniominio "github.com/minio/operator/pkg/client/informers/externalversions/minio.min.io" stsminio "github.com/minio/operator/pkg/client/informers/externalversions/sts.min.io" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -255,15 +254,10 @@ type SharedInformerFactory interface { // client. InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer - Job() jobminio.Interface Minio() miniominio.Interface Sts() stsminio.Interface } -func (f *sharedInformerFactory) Job() jobminio.Interface { - return jobminio.New(f, f.namespace, f.tweakListOptions) -} - func (f *sharedInformerFactory) Minio() miniominio.Interface { return miniominio.New(f, f.namespace, f.tweakListOptions) } diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 1a373236219..c871aeb7fde 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -21,9 +21,8 @@ package externalversions import ( "fmt" - v1alpha1 "github.com/minio/operator/pkg/apis/job.min.io/v1alpha1" v2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - stsminiov1alpha1 "github.com/minio/operator/pkg/apis/sts.min.io/v1alpha1" + v1alpha1 "github.com/minio/operator/pkg/apis/sts.min.io/v1alpha1" v1beta1 "github.com/minio/operator/pkg/apis/sts.min.io/v1beta1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" @@ -55,16 +54,12 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=job.min.io, Version=v1alpha1 - case v1alpha1.SchemeGroupVersion.WithResource("miniojobs"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Job().V1alpha1().MinIOJobs().Informer()}, nil - - // Group=minio.min.io, Version=v2 + // Group=minio.min.io, Version=v2 case v2.SchemeGroupVersion.WithResource("tenants"): return &genericInformer{resource: resource.GroupResource(), informer: f.Minio().V2().Tenants().Informer()}, nil // Group=sts.min.io, Version=v1alpha1 - case stsminiov1alpha1.SchemeGroupVersion.WithResource("policybindings"): + case v1alpha1.SchemeGroupVersion.WithResource("policybindings"): return &genericInformer{resource: resource.GroupResource(), informer: f.Sts().V1alpha1().PolicyBindings().Informer()}, nil // Group=sts.min.io, Version=v1beta1 diff --git a/pkg/client/informers/externalversions/job.min.io/interface.go b/pkg/client/informers/externalversions/job.min.io/interface.go deleted file mode 100644 index 36fcfc2203c..00000000000 --- a/pkg/client/informers/externalversions/job.min.io/interface.go +++ /dev/null @@ -1,46 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by informer-gen. DO NOT EDIT. - -package job - -import ( - internalinterfaces "github.com/minio/operator/pkg/client/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/minio/operator/pkg/client/informers/externalversions/job.min.io/v1alpha1" -) - -// Interface provides access to each of this group's versions. -type Interface interface { - // V1alpha1 provides access to shared informers for resources in V1alpha1. - V1alpha1() v1alpha1.Interface -} - -type group struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// V1alpha1 returns a new v1alpha1.Interface. -func (g *group) V1alpha1() v1alpha1.Interface { - return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/pkg/client/informers/externalversions/job.min.io/v1alpha1/interface.go b/pkg/client/informers/externalversions/job.min.io/v1alpha1/interface.go deleted file mode 100644 index cca70283091..00000000000 --- a/pkg/client/informers/externalversions/job.min.io/v1alpha1/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - internalinterfaces "github.com/minio/operator/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // MinIOJobs returns a MinIOJobInformer. - MinIOJobs() MinIOJobInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// MinIOJobs returns a MinIOJobInformer. -func (v *version) MinIOJobs() MinIOJobInformer { - return &minIOJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/pkg/client/informers/externalversions/job.min.io/v1alpha1/miniojob.go b/pkg/client/informers/externalversions/job.min.io/v1alpha1/miniojob.go deleted file mode 100644 index eeb68c5729d..00000000000 --- a/pkg/client/informers/externalversions/job.min.io/v1alpha1/miniojob.go +++ /dev/null @@ -1,90 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - time "time" - - jobminiov1alpha1 "github.com/minio/operator/pkg/apis/job.min.io/v1alpha1" - versioned "github.com/minio/operator/pkg/client/clientset/versioned" - internalinterfaces "github.com/minio/operator/pkg/client/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/minio/operator/pkg/client/listers/job.min.io/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// MinIOJobInformer provides access to a shared informer and lister for -// MinIOJobs. -type MinIOJobInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.MinIOJobLister -} - -type minIOJobInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewMinIOJobInformer constructs a new informer for MinIOJob type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewMinIOJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredMinIOJobInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredMinIOJobInformer constructs a new informer for MinIOJob type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredMinIOJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.JobV1alpha1().MinIOJobs(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.JobV1alpha1().MinIOJobs(namespace).Watch(context.TODO(), options) - }, - }, - &jobminiov1alpha1.MinIOJob{}, - resyncPeriod, - indexers, - ) -} - -func (f *minIOJobInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredMinIOJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *minIOJobInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&jobminiov1alpha1.MinIOJob{}, f.defaultInformer) -} - -func (f *minIOJobInformer) Lister() v1alpha1.MinIOJobLister { - return v1alpha1.NewMinIOJobLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/listers/job.min.io/v1alpha1/expansion_generated.go b/pkg/client/listers/job.min.io/v1alpha1/expansion_generated.go deleted file mode 100644 index e16de7b695b..00000000000 --- a/pkg/client/listers/job.min.io/v1alpha1/expansion_generated.go +++ /dev/null @@ -1,27 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha1 - -// MinIOJobListerExpansion allows custom methods to be added to -// MinIOJobLister. -type MinIOJobListerExpansion interface{} - -// MinIOJobNamespaceListerExpansion allows custom methods to be added to -// MinIOJobNamespaceLister. -type MinIOJobNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/job.min.io/v1alpha1/miniojob.go b/pkg/client/listers/job.min.io/v1alpha1/miniojob.go deleted file mode 100644 index b10b80a3610..00000000000 --- a/pkg/client/listers/job.min.io/v1alpha1/miniojob.go +++ /dev/null @@ -1,99 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/minio/operator/pkg/apis/job.min.io/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// MinIOJobLister helps list MinIOJobs. -// All objects returned here must be treated as read-only. -type MinIOJobLister interface { - // List lists all MinIOJobs in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.MinIOJob, err error) - // MinIOJobs returns an object that can list and get MinIOJobs. - MinIOJobs(namespace string) MinIOJobNamespaceLister - MinIOJobListerExpansion -} - -// minIOJobLister implements the MinIOJobLister interface. -type minIOJobLister struct { - indexer cache.Indexer -} - -// NewMinIOJobLister returns a new MinIOJobLister. -func NewMinIOJobLister(indexer cache.Indexer) MinIOJobLister { - return &minIOJobLister{indexer: indexer} -} - -// List lists all MinIOJobs in the indexer. -func (s *minIOJobLister) List(selector labels.Selector) (ret []*v1alpha1.MinIOJob, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.MinIOJob)) - }) - return ret, err -} - -// MinIOJobs returns an object that can list and get MinIOJobs. -func (s *minIOJobLister) MinIOJobs(namespace string) MinIOJobNamespaceLister { - return minIOJobNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// MinIOJobNamespaceLister helps list and get MinIOJobs. -// All objects returned here must be treated as read-only. -type MinIOJobNamespaceLister interface { - // List lists all MinIOJobs in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.MinIOJob, err error) - // Get retrieves the MinIOJob from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.MinIOJob, error) - MinIOJobNamespaceListerExpansion -} - -// minIOJobNamespaceLister implements the MinIOJobNamespaceLister -// interface. -type minIOJobNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all MinIOJobs in the indexer for a given namespace. -func (s minIOJobNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.MinIOJob, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.MinIOJob)) - }) - return ret, err -} - -// Get retrieves the MinIOJob from the indexer for a given namespace and name. -func (s minIOJobNamespaceLister) Get(name string) (*v1alpha1.MinIOJob, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("miniojob"), name) - } - return obj.(*v1alpha1.MinIOJob), nil -} diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index 2bfc6542533..2b60fa7ea92 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -36,7 +36,6 @@ import ( "k8s.io/klog/v2" - "github.com/minio/operator/pkg/apis/job.min.io/v1alpha1" v2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" stsv1beta1 "github.com/minio/operator/pkg/apis/sts.min.io/v1beta1" clientset "github.com/minio/operator/pkg/client/clientset/versioned" @@ -77,7 +76,6 @@ func init() { // StartOperator starts the MinIO Operator controller func StartOperator(kubeconfig string) { _ = v2.AddToScheme(scheme.Scheme) - _ = v1alpha1.AddToScheme(scheme.Scheme) _ = stsv1beta1.AddToScheme(scheme.Scheme) _ = stsv1alpha1.AddToScheme(scheme.Scheme) klog.Info("Starting MinIO Operator") @@ -169,7 +167,6 @@ func StartOperator(kubeconfig string) { kubeInformerFactory, minioInformerFactory.Minio().V2().Tenants(), minioInformerFactory.Sts().V1beta1().PolicyBindings(), - minioInformerFactory.Job().V1alpha1().MinIOJobs(), kubeInformerFactoryInOperatorNamespace, ) diff --git a/pkg/controller/job-controller.go b/pkg/controller/job-controller.go deleted file mode 100644 index f0f9fcd905d..00000000000 --- a/pkg/controller/job-controller.go +++ /dev/null @@ -1,334 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package controller - -import ( - "context" - "fmt" - "reflect" - "sync" - "time" - - "github.com/minio/minio-go/v7/pkg/set" - "github.com/minio/operator/pkg/apis/job.min.io/v1alpha1" - miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - stsv1beta1 "github.com/minio/operator/pkg/apis/sts.min.io/v1beta1" - jobinformers "github.com/minio/operator/pkg/client/informers/externalversions/job.min.io/v1alpha1" - joblisters "github.com/minio/operator/pkg/client/listers/job.min.io/v1alpha1" - "github.com/minio/operator/pkg/utils/miniojob" - batchjobv1 "k8s.io/api/batch/v1" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/api/meta" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/runtime" - batchv1 "k8s.io/client-go/informers/batch/v1" - "k8s.io/client-go/kubernetes" - k8sjoblisters "k8s.io/client-go/listers/batch/v1" - "k8s.io/client-go/tools/cache" - "k8s.io/client-go/tools/record" - "k8s.io/client-go/util/workqueue" - "k8s.io/klog/v2" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -// JobController struct watches the Kubernetes API for changes to Tenant resources -type JobController struct { - namespacesToWatch set.StringSet - minioJobLister joblisters.MinIOJobLister - minioJobHasSynced cache.InformerSynced - jobLister k8sjoblisters.JobLister - jobHasSynced cache.InformerSynced - recorder record.EventRecorder - workqueue workqueue.RateLimitingInterface - k8sClient client.Client -} - -// runWorker is a long-running function that will continually call the -// processNextWorkItem function in order to read and process a message on the -// workqueue. -func (c *JobController) runJobWorker() { - defer runtime.HandleCrash() - for processNextItem(c.workqueue, c.SyncHandler) { - } -} - -func (c *JobController) enqueueJob(obj interface{}) { - key, err := cache.MetaNamespaceKeyFunc(obj) - if err != nil { - runtime.HandleError(err) - return - } - if !c.namespacesToWatch.IsEmpty() { - meta, err := meta.Accessor(obj) - if err != nil { - runtime.HandleError(err) - return - } - if !c.namespacesToWatch.Contains(meta.GetNamespace()) { - klog.Infof("Ignoring tenant `%s` in namespace that is not watched by this controller.", key) - return - } - } - // key = default/mc-job-1 - c.workqueue.AddRateLimited(key) -} - -// NewJobController returns a new Operator Controller -func NewJobController( - minioJobInformer jobinformers.MinIOJobInformer, - jobInformer batchv1.JobInformer, - namespacesToWatch set.StringSet, - _ kubernetes.Interface, - recorder record.EventRecorder, - workqueue workqueue.RateLimitingInterface, - k8sClient client.Client, -) *JobController { - controller := &JobController{ - namespacesToWatch: namespacesToWatch, - minioJobLister: minioJobInformer.Lister(), - minioJobHasSynced: minioJobInformer.Informer().HasSynced, - jobLister: jobInformer.Lister(), - jobHasSynced: jobInformer.Informer().HasSynced, - recorder: recorder, - workqueue: workqueue, - k8sClient: k8sClient, - } - - // Set up an event handler for when resources change - minioJobInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: controller.enqueueJob, - UpdateFunc: func(old, new interface{}) { - oldJob := old.(*v1alpha1.MinIOJob) - newJob := new.(*v1alpha1.MinIOJob) - if oldJob.ResourceVersion == newJob.ResourceVersion { - return - } - controller.enqueueJob(new) - }, - DeleteFunc: controller.enqueueJob, - }) - - jobInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ - UpdateFunc: func(_, new interface{}) { - newJob := new.(*batchjobv1.Job) - jobName, ok := newJob.Labels[miniojob.MinioJobName] - if !ok { - return - } - jobCRName, ok := newJob.Labels[miniojob.MinioJobCRName] - if !ok { - return - } - val, ok := globalIntervalJobStatus.Load(fmt.Sprintf("%s/%s", newJob.GetNamespace(), jobCRName)) - if ok { - intervalJob := val.(*miniojob.MinIOIntervalJob) - command, ok := intervalJob.CommandMap[jobName] - if ok { - if newJob.Status.Succeeded > 0 { - command.SetStatus(true, "") - } else { - for _, condition := range newJob.Status.Conditions { - if condition.Type == batchjobv1.JobFailed { - command.SetStatus(false, condition.Message) - break - } - } - } - } - } - controller.HandleObject(newJob) - }, - DeleteFunc: controller.enqueueJob, - }) - return controller -} - -// HasSynced is to determine if obj is synced -func (c *JobController) HasSynced() cache.InformerSynced { - return c.minioJobHasSynced -} - -// HandleObject will take any resource implementing metav1.Object and attempt -// to find the CRD resource that 'owns' it. -func (c *JobController) HandleObject(obj metav1.Object) { - JobCRDResourceKind := "MinIOJob" - if ownerRef := metav1.GetControllerOf(obj); ownerRef != nil { - switch ownerRef.Kind { - case JobCRDResourceKind: - job, err := c.minioJobLister.MinIOJobs(obj.GetNamespace()).Get(ownerRef.Name) - if err != nil { - klog.V(4).Info("Ignore orphaned object", "object", klog.KObj(job), JobCRDResourceKind, ownerRef.Name) - return - } - c.enqueueJob(job) - default: - return - } - return - } -} - -// SyncHandler compares the current Job state with the desired, and attempts to -// converge the two. It then updates the Status block of the Job resource -// with the current status of the resource. -func (c *JobController) SyncHandler(key string) (_ Result, err error) { - // Convert the namespace/name string into a distinct namespace and name - if key == "" { - runtime.HandleError(fmt.Errorf("Invalid resource key: %s", key)) - return WrapResult(Result{}, nil) - } - namespace, jobName := key2NamespaceName(key) - ctx := context.Background() - jobCR := v1alpha1.MinIOJob{ - ObjectMeta: metav1.ObjectMeta{ - Name: jobName, - Namespace: namespace, - }, - } - err = c.k8sClient.Get(ctx, client.ObjectKeyFromObject(&jobCR), &jobCR) - if err != nil { - // job cr have gone - globalIntervalJobStatus.Delete(fmt.Sprintf("%s/%s", jobCR.Namespace, jobCR.Name)) - if errors.IsNotFound(err) { - return WrapResult(Result{}, nil) - } - return WrapResult(Result{}, err) - } - - // if job cr is Success, do nothing - if jobCR.Status.Phase == miniojob.MinioJobPhaseSuccess { - // delete the job status - globalIntervalJobStatus.Delete(fmt.Sprintf("%s/%s", jobCR.Namespace, jobCR.Name)) - return WrapResult(Result{}, nil) - } - - defer func() { - if err != nil { - if jobCR.Status.Phase != miniojob.MinioJobPhaseSuccess { - jobCR.Status.Phase = miniojob.MinioJobPhaseError - jobCR.Status.Message = err.Error() - err = c.updateJobStatus(ctx, &jobCR) - } - } - }() - - if !IsSTSEnabled() { - c.recorder.Eventf(&jobCR, corev1.EventTypeWarning, "STSDisabled", "JobCR cannot work with STS disabled") - return WrapResult(Result{}, fmt.Errorf("JobCR cannot work with STS disabled")) - } - - // get tenant - tenant := &miniov2.Tenant{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: jobCR.Spec.TenantRef.Namespace, - Name: jobCR.Spec.TenantRef.Name, - }, - } - err = c.k8sClient.Get(ctx, client.ObjectKeyFromObject(tenant), tenant) - if err != nil { - return WrapResult(Result{}, fmt.Errorf("get tenant %s/%s error: %w", jobCR.Spec.TenantRef.Namespace, jobCR.Spec.TenantRef.Name, err)) - } - if tenant.Status.HealthStatus != miniov2.HealthStatusGreen { - return WrapResult(Result{RequeueAfter: time.Second * 5}, fmt.Errorf("get tenant %s/%s error: %w", jobCR.Spec.TenantRef.Namespace, jobCR.Spec.TenantRef.Name, err)) - } - // check sa - pbs := &stsv1beta1.PolicyBindingList{} - err = c.k8sClient.List(ctx, pbs, client.InNamespace(tenant.Namespace)) - if err != nil { - return WrapResult(Result{}, fmt.Errorf("list policybinding error: %w", err)) - } - if len(pbs.Items) == 0 { - return WrapResult(Result{}, fmt.Errorf("no policybinding found")) - } - saFound := false - for _, pb := range pbs.Items { - if pb.Spec.Application.Namespace == jobCR.Namespace && pb.Spec.Application.ServiceAccount == jobCR.Spec.ServiceAccountName { - saFound = true - } - } - if !saFound { - return WrapResult(Result{}, fmt.Errorf("no serviceaccount found")) - } - intervalJob, err := checkMinIOJob(&jobCR) - if err != nil { - return WrapResult(Result{}, err) - } - err = intervalJob.CreateCommandJob(ctx, c.k8sClient, STSDefaultPort, tenant) - if err != nil { - return WrapResult(Result{}, fmt.Errorf("create job error: %w", err)) - } - // update status - jobCR.Status = intervalJob.GetMinioJobStatus(ctx) - err = c.updateJobStatus(ctx, &jobCR) - return WrapResult(Result{}, err) -} - -func (c *JobController) updateJobStatus(ctx context.Context, job *v1alpha1.MinIOJob) error { - return c.k8sClient.Status().Update(ctx, job) -} - -func checkMinIOJob(jobCR *v1alpha1.MinIOJob) (intervalJob *miniojob.MinIOIntervalJob, err error) { - defer func() { - if err != nil { - globalIntervalJobStatus.Delete(fmt.Sprintf("%s/%s", jobCR.Namespace, jobCR.Name)) - } - }() - val, found := globalIntervalJobStatus.Load(fmt.Sprintf("%s/%s", jobCR.Namespace, jobCR.Name)) - if found { - intervalJob = val.(*miniojob.MinIOIntervalJob) - if reflect.DeepEqual(intervalJob.JobCR.Spec, jobCR.Spec) { - intervalJob.JobCR.UID = jobCR.UID - return intervalJob, nil - } - } - intervalJob = &miniojob.MinIOIntervalJob{ - JobCR: jobCR.DeepCopy(), - Command: []*miniojob.MinIOIntervalJobCommand{}, - CommandMap: map[string]*miniojob.MinIOIntervalJobCommand{}, - } - if jobCR.Spec.TenantRef.Namespace == "" { - return intervalJob, fmt.Errorf("tenant namespace is empty") - } - if jobCR.Spec.TenantRef.Name == "" { - return intervalJob, fmt.Errorf("tenant name is empty") - } - if jobCR.Spec.ServiceAccountName == "" { - return intervalJob, fmt.Errorf("serviceaccount name is empty") - } - for index, val := range jobCR.Spec.Commands { - jobCommand, err := miniojob.GenerateMinIOIntervalJobCommand(val, index) - if err != nil { - return intervalJob, err - } - intervalJob.Command = append(intervalJob.Command, jobCommand) - intervalJob.CommandMap[jobCommand.JobName] = jobCommand - } - // check all dependon - for _, command := range intervalJob.Command { - for _, dep := range command.CommandSpec.DependsOn { - _, found := intervalJob.CommandMap[dep] - if !found { - return intervalJob, fmt.Errorf("dependent job %s not found", dep) - } - } - } - globalIntervalJobStatus.Store(fmt.Sprintf("%s/%s", jobCR.Namespace, jobCR.Name), intervalJob) - return intervalJob, nil -} - -var globalIntervalJobStatus = sync.Map{} diff --git a/pkg/controller/main-controller.go b/pkg/controller/main-controller.go index dc3f7d8592b..7e70059f52d 100644 --- a/pkg/controller/main-controller.go +++ b/pkg/controller/main-controller.go @@ -74,7 +74,6 @@ import ( miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" clientset "github.com/minio/operator/pkg/client/clientset/versioned" minioscheme "github.com/minio/operator/pkg/client/clientset/versioned/scheme" - jobinformers "github.com/minio/operator/pkg/client/informers/externalversions/job.min.io/v1alpha1" informers "github.com/minio/operator/pkg/client/informers/externalversions/minio.min.io/v2" stsInformers "github.com/minio/operator/pkg/client/informers/externalversions/sts.min.io/v1beta1" "github.com/minio/operator/pkg/resources/statefulsets" @@ -203,11 +202,6 @@ type Controller struct { // policyBindingListerSynced returns true if the PolicyBinding shared informer // has synced at least once. policyBindingListerSynced cache.InformerSynced - - // controllers denotes the list of components controlled - // by the controller. Each component is itself - // a controller. This handle is for supporting the abstraction. - controllers []*JobController } // EventType is Event type to handle @@ -239,13 +233,11 @@ func NewController( kubeInformerFactory kubeinformers.SharedInformerFactory, tenantInformer informers.TenantInformer, policyBindingInformer stsInformers.PolicyBindingInformer, - minioJobInformer jobinformers.MinIOJobInformer, kubeInformerFactoryInOperatorNamespace kubeinformers.SharedInformerFactory, ) *Controller { statefulSetInformer := kubeInformerFactory.Apps().V1().StatefulSets() deploymentInformer := kubeInformerFactory.Apps().V1().Deployments() serviceInformer := kubeInformerFactory.Core().V1().Services() - jobInformer := kubeInformerFactory.Batch().V1().Jobs() secretInformer := kubeInformerFactoryInOperatorNamespace.Core().V1().Secrets() // Create event broadcaster @@ -290,17 +282,6 @@ func NewController( hostsTemplate: hostsTemplate, operatorVersion: operatorVersion, policyBindingListerSynced: policyBindingInformer.Informer().HasSynced, - controllers: []*JobController{ - NewJobController( - minioJobInformer, - jobInformer, - namespacesToWatch, - kubeClientSet, - recorder, - queue.NewRateLimitingQueueWithConfig(MinIOControllerRateLimiter(), queue.RateLimitingQueueConfig{Name: "MinioJobs"}), - k8sClient, - ), - }, } // Initialize operator HTTP upgrade server handlers @@ -455,18 +436,9 @@ func leaderRun(ctx context.Context, c *Controller, threadiness int, stopCh <-cha if ok := cache.WaitForCacheSync(stopCh, c.statefulSetListerSynced, c.deploymentListerSynced, c.tenantsSynced, c.policyBindingListerSynced, c.secretListerSynced); !ok { panic("failed to wait for caches to sync") } - // Wait for the caches to be synced before starting workers - for _, jobController := range c.controllers { - if ok := cache.WaitForCacheSync(stopCh, jobController.minioJobHasSynced, jobController.jobHasSynced); !ok { - panic("failed to wait for caches to sync") - } - } - klog.Info("Starting workers and Job workers") - JobController := c.controllers[0] // Launch two workers to process Job resources for i := 0; i < threadiness; i++ { - go wait.Until(JobController.runJobWorker, time.Second, stopCh) go wait.Until(c.runWorker, time.Second, stopCh) } @@ -596,12 +568,8 @@ func (c *Controller) Start(threadiness int, stopCh <-chan struct{}) error { } else { c.kubeClientSet.CoreV1().Pods(leaseLockNamespace).Patch(ctx, c.podName, types.JSONPatchType, payloadBytes, metav1.PatchOptions{}) } - // Even if Stop() is called twice, stopping it here ensures the sync handler no longer is handling events, - // in case SIGTERM fails or the controller takes longer to exit. c.Stop() - if err := syscall.Kill(os.Getpid(), syscall.SIGTERM); err != nil { - klog.Errorf("error sending SIGTERM: %v", err) - } + cancel() }, OnNewLeader: func(identity string) { // we're notified when new leader elected diff --git a/pkg/utils/miniojob/minioJob.go b/pkg/utils/miniojob/minioJob.go deleted file mode 100644 index ed89120fcf3..00000000000 --- a/pkg/utils/miniojob/minioJob.go +++ /dev/null @@ -1,194 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package miniojob - -import ( - "fmt" - "sort" - "strings" -) - -// Arg - parse the arg result -type Arg struct { - Command string -} - -// FieldsFunc - alias function -type FieldsFunc func(args map[string]string) (Arg, error) - -// Key - key=value|value1,value2,value3 -func Key(key string) FieldsFunc { - return KeyFormat(key, "$0") -} - -// FLAGS - --key=""|value|value1,value2,value3 -func FLAGS(ignoreKeys ...string) FieldsFunc { - return prefixKeyFormat("-", ignoreKeys...) -} - -// ALIAS - myminio -func ALIAS() FieldsFunc { - return Static("myminio") -} - -// Static - some static value -func Static(val string) FieldsFunc { - return func(_ map[string]string) (Arg, error) { - return Arg{Command: val}, nil - } -} - -// KeyValue - match key and putout the key, like endpoint="https://webhook-1.example.net" -func KeyValue(key string) FieldsFunc { - return func(args map[string]string) (out Arg, err error) { - if args == nil { - return out, fmt.Errorf("args is nil") - } - val, ok := args[key] - if !ok { - return out, fmt.Errorf("key %s not found", key) - } - out.Command = fmt.Sprintf(`%s="%s"`, key, val) - delete(args, key) - return out, nil - } -} - -// Option - ignore the error -func Option(opt FieldsFunc) FieldsFunc { - return func(args map[string]string) (out Arg, err error) { - if args == nil { - return out, nil - } - out, _ = opt(args) - return out, nil - } -} - -// KeyFormat - match key and get outPut to replace $0 to output the value -// if format not contain $0, will add $0 to the end -func KeyFormat(key string, format string) FieldsFunc { - return func(args map[string]string) (out Arg, err error) { - if args == nil { - return out, fmt.Errorf("args is nil") - } - if !strings.Contains(format, "$0") { - format = fmt.Sprintf("%s %s", format, "$0") - } - val, ok := args[key] - if !ok { - return out, fmt.Errorf("key %s not found", key) - } - out.Command = strings.ReplaceAll(format, "$0", strings.ReplaceAll(val, ",", " ")) - delete(args, key) - return out, nil - } -} - -// OthersKeyValues - get all the key values -func OthersKeyValues(_ ...string) FieldsFunc { - return func(args map[string]string) (out Arg, err error) { - if args == nil { - return out, fmt.Errorf("args is nil") - } - data := []string{} - for key, val := range args { - if val != "" { - data = append(data, fmt.Sprintf(`%s="%s"`, key, val)) - } else { - data = append(data, key) - } - delete(args, key) - } - sort.Slice(data, func(i, j int) bool { - return data[i] < data[j] - }) - return Arg{Command: strings.Join(data, " ")}, nil - } -} - -// OneOf - one of the funcs must be found -// mc admin policy attach OneOf(--user | --group) = mc admin policy attach --user user or mc admin policy attach --group group -func OneOf(funcs ...FieldsFunc) FieldsFunc { - return func(args map[string]string) (out Arg, err error) { - if args == nil { - return out, fmt.Errorf("args is nil") - } - for _, fn := range funcs { - if out, err = fn(args); err == nil { - return out, nil - } - } - return out, fmt.Errorf("not found") - } -} - -// Sanitize - no space for the command -// mc mb Sanitize(alias / bucketName) = mc mb alias/bucketName -func Sanitize(funcs ...FieldsFunc) FieldsFunc { - return func(args map[string]string) (out Arg, err error) { - if args == nil { - return out, fmt.Errorf("args is nil") - } - commands := []string{} - for _, func1 := range funcs { - if out, err = func1(args); err != nil { - return out, err - } - if out.Command == "" { - return out, fmt.Errorf("command is empty") - } - commands = append(commands, out.Command) - } - return Arg{Command: strings.Join(commands, "")}, nil - } -} - -var prefixKeyFormat = func(pkey string, ignoreKeys ...string) FieldsFunc { - return func(args map[string]string) (out Arg, err error) { - if args == nil { - return out, fmt.Errorf("args is nil") - } - igrnoreKeyMap := make(map[string]bool) - for _, key := range ignoreKeys { - if !strings.HasPrefix(key, pkey) { - key = fmt.Sprintf("%s%s%s", pkey, pkey, key) - } - igrnoreKeyMap[key] = true - } - data := []string{} - for key, val := range args { - if strings.HasPrefix(key, pkey) && !igrnoreKeyMap[key] { - if val == "" { - data = append(data, key) - } else { - for _, singalVal := range strings.Split(val, ",") { - if strings.TrimSpace(singalVal) != "" { - data = append(data, fmt.Sprintf("%s=%s", key, singalVal)) - } - } - } - delete(args, key) - } - } - // avoid flags change the order - sort.Slice(data, func(i, j int) bool { - return data[i] < data[j] - }) - return Arg{Command: strings.Join(data, " ")}, nil - } -} diff --git a/pkg/utils/miniojob/minioJob_test.go b/pkg/utils/miniojob/minioJob_test.go deleted file mode 100644 index 15977d407a0..00000000000 --- a/pkg/utils/miniojob/minioJob_test.go +++ /dev/null @@ -1,359 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package miniojob - -import ( - "testing" - - "github.com/minio/operator/pkg/apis/job.min.io/v1alpha1" -) - -func TestParser(t *testing.T) { - args := map[string]string{ - "--user": "a1,b2,c3,d4", - "user": "a,b,c,d", - "group": "group1,group2,group3", - "password": "somepassword", - "--with-locks": "", - "--region": "us-west-2", - "policy": ` { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:*" - ], - "Resource": [ - "arn:aws:s3:::memes", - "arn:aws:s3:::memes/*" - ] - } - ] - }`, - "name": "mybucketName", - } - testCase := []struct { - command FieldsFunc - args map[string]string - expect Arg - expectError bool - }{ - { - command: FLAGS("--user"), - args: copyArgs(args), - expect: Arg{Command: "--region=us-west-2 --with-locks"}, - expectError: false, - }, - { - command: FLAGS("user"), - args: copyArgs(args), - expect: Arg{Command: "--region=us-west-2 --with-locks"}, - expectError: false, - }, - { - command: Key("password"), - args: copyArgs(args), - expect: Arg{Command: "somepassword"}, - expectError: false, - }, - { - command: KeyFormat("user", "--user $0"), - args: copyArgs(args), - expect: Arg{Command: "--user a b c d"}, - expectError: false, - }, - { - command: KeyFormat("user", "--user"), - args: copyArgs(args), - expect: Arg{Command: "--user a b c d"}, - expectError: false, - }, - { - command: ALIAS(), - args: copyArgs(args), - expect: Arg{Command: "myminio"}, - expectError: false, - }, - { - command: Static("test-static"), - args: copyArgs(args), - expect: Arg{Command: "test-static"}, - expectError: false, - }, - { - command: OneOf(KeyFormat("user", "--user"), KeyFormat("group", "--group")), - args: copyArgs(args), - expect: Arg{Command: "--user a b c d"}, - expectError: false, - }, - { - command: OneOf(KeyFormat("miss_user", "--user"), KeyFormat("group", "--group")), - args: copyArgs(args), - expect: Arg{Command: "--group group1 group2 group3"}, - expectError: false, - }, - { - command: OneOf(KeyFormat("miss_user", "--user"), KeyFormat("miss_group", "--group")), - args: copyArgs(args), - expect: Arg{Command: "--group group1 group2 group3"}, - expectError: true, - }, - { - command: Sanitize(ALIAS(), Static("/"), Key("name")), - args: copyArgs(args), - expect: Arg{Command: "myminio/mybucketName"}, - expectError: false, - }, - } - for _, tc := range testCase { - cmd, err := tc.command(tc.args) - if tc.expectError && err == nil { - t.Fatalf("expectCommand error") - } - if !tc.expectError && err != nil { - t.Fatalf("expectCommand not a error") - } - if !tc.expectError { - if tc.expect.Command != "" && cmd.Command != tc.expect.Command { - t.Fatalf("expectCommand %s, but got %s", tc.expect.Command, cmd.Command) - } - } - } -} - -func TestAdminPolicyCreate(t *testing.T) { - mcCommand := "admin/policy/create" - testCase := []struct { - name string - spec v1alpha1.CommandSpec - expectError bool - expectCommand string - }{ - { - name: "testFull", - spec: v1alpha1.CommandSpec{ - Operation: mcCommand, - Args: map[string]string{ - "name": "mypolicy", - "policy": "JsonContent", - }, - }, - expectCommand: "myminio mypolicy JsonContent", - }, - { - name: "testError1", - spec: v1alpha1.CommandSpec{ - Operation: mcCommand, - Args: map[string]string{ - "name": "mypolicy", - }, - }, - expectCommand: "", - expectError: true, - }, - { - name: "testError2", - spec: v1alpha1.CommandSpec{ - Operation: mcCommand, - Args: map[string]string{ - "policy": "JsonContent", - }, - }, - expectCommand: "", - expectError: true, - }, - } - for _, tc := range testCase { - command, err := GenerateMinIOIntervalJobCommand(tc.spec, 0) - if !tc.expectError { - if err != nil { - t.Fatal(err) - } - if command.Command != tc.expectCommand { - t.Fatalf("[%s] expectCommand %s, but got %s", tc.name, tc.expectCommand, command.Command) - } - } else { - if err == nil { - t.Fatalf("[%s] expectCommand error", tc.name) - } - } - } -} - -func TestMCConfigSet(t *testing.T) { - mcCommand := "admin/config/set" - testCase := []struct { - name string - spec v1alpha1.CommandSpec - expectCommand string - expectError bool - }{ - { - name: "testFull", - spec: v1alpha1.CommandSpec{ - Operation: mcCommand, - Args: map[string]string{ - "webhookName": "webhook1", - "endpoint": "endpoint1", - "auth_token": "token1", - "client_cert": "cert1", - "client_key": "key1", - }, - }, - expectCommand: "myminio webhook1 endpoint=\"endpoint1\" auth_token=\"token1\" client_cert=\"cert1\" client_key=\"key1\"", - }, - { - name: "notify_mysql", - spec: v1alpha1.CommandSpec{ - Operation: mcCommand, - Args: map[string]string{ - "webhookName": "notify_mysql", - "dsn_string": "username:password@tcp(mysql.example.com:3306)/miniodb", - "table": "minioevents", - "format": "namespace", - }, - }, - expectCommand: "myminio notify_mysql dsn_string=\"username:password@tcp(mysql.example.com:3306)/miniodb\" format=\"namespace\" table=\"minioevents\"", - }, - { - name: "notify_amqp", - spec: v1alpha1.CommandSpec{ - Operation: mcCommand, - Args: map[string]string{ - "webhookName": "notify_amqp:primary", - "url": "user:password@amqp://amqp-endpoint.example.net:5672", - }, - }, - expectCommand: "myminio notify_amqp:primary url=\"user:password@amqp://amqp-endpoint.example.net:5672\"", - }, - { - name: "notify_elasticsearch", - spec: v1alpha1.CommandSpec{ - Operation: mcCommand, - Args: map[string]string{ - "webhookName": "notify_elasticsearch:primary", - "url": "user:password@https://elasticsearch-endpoint.example.net:9200", - "index": "bucketevents", - "format": "namespace", - }, - }, - expectCommand: "myminio notify_elasticsearch:primary format=\"namespace\" index=\"bucketevents\" url=\"user:password@https://elasticsearch-endpoint.example.net:9200\"", - }, - { - name: "identity_ldap", - spec: v1alpha1.CommandSpec{ - Operation: mcCommand, - Args: map[string]string{ - "webhookName": "identity_ldap", - "enabled": "true", - "server_addr": "ad-ldap.example.net/", - "lookup_bind_dn": "cn=miniolookupuser,dc=example,dc=net", - "lookup_bind_dn_password": "userpassword", - "user_dn_search_base_dn": "dc=example,dc=net", - "user_dn_search_filter": "(&(objectCategory=user)(sAMAccountName=%s))", - }, - }, - expectCommand: "myminio identity_ldap enabled=\"true\" lookup_bind_dn=\"cn=miniolookupuser,dc=example,dc=net\" lookup_bind_dn_password=\"userpassword\" server_addr=\"ad-ldap.example.net/\" user_dn_search_base_dn=\"dc=example,dc=net\" user_dn_search_filter=\"(&(objectCategory=user)(sAMAccountName=%s))\"", - }, - } - for _, tc := range testCase { - command, err := GenerateMinIOIntervalJobCommand(tc.spec, 0) - if !tc.expectError { - if err != nil { - t.Fatal(err) - } - if command.Command != tc.expectCommand { - t.Fatalf("[%s] expectCommand %s, but got %s", tc.name, tc.expectCommand, command.Command) - } - } else { - if err == nil { - t.Fatalf("[%s] expectCommand error", tc.name) - } - } - } -} - -func TestSupportcallhome(t *testing.T) { - mcCommand := "support/callhome" - testCase := []struct { - name string - spec v1alpha1.CommandSpec - expectCommand string - expectError bool - }{ - { - name: "testEnable", - spec: v1alpha1.CommandSpec{ - Operation: mcCommand, - Args: map[string]string{ - "action": "enable", - "--logs": "", - "--diag": "", - }, - }, - expectCommand: "enable myminio --diag --logs", - }, - { - name: "testDisable", - spec: v1alpha1.CommandSpec{ - Operation: mcCommand, - Args: map[string]string{ - "action": "disable", - "--logs": "", - "--diag": "", - }, - }, - expectCommand: "disable myminio --diag --logs", - }, - { - name: "testNoAction", - spec: v1alpha1.CommandSpec{ - Operation: mcCommand, - Args: map[string]string{ - "--logs": "", - "--diag": "", - }, - }, - expectCommand: "", - expectError: true, - }, - } - for _, tc := range testCase { - command, err := GenerateMinIOIntervalJobCommand(tc.spec, 0) - if !tc.expectError { - if err != nil { - t.Fatal(err) - } - if command.Command != tc.expectCommand { - t.Fatalf("[%s] expectCommand %s, but got %s", tc.name, tc.expectCommand, command.Command) - } - } else { - if err == nil { - t.Fatalf("[%s] expectCommand error", tc.name) - } - } - } -} - -func copyArgs(args map[string]string) map[string]string { - newArgs := make(map[string]string) - for key, val := range args { - newArgs[key] = val - } - return newArgs -} diff --git a/pkg/utils/miniojob/types.go b/pkg/utils/miniojob/types.go deleted file mode 100644 index 31c7ef936d5..00000000000 --- a/pkg/utils/miniojob/types.go +++ /dev/null @@ -1,512 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2024 MinIO, Inc. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package miniojob - -import ( - "context" - "fmt" - "strings" - "sync" - - "github.com/minio/operator/pkg/apis/job.min.io/v1alpha1" - miniov2 "github.com/minio/operator/pkg/apis/minio.min.io/v2" - "github.com/minio/operator/pkg/certs" - "github.com/minio/operator/pkg/runtime" - batchjobv1 "k8s.io/api/batch/v1" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "sigs.k8s.io/controller-runtime/pkg/client" -) - -const ( - // DefaultMCImage - job mc image - DefaultMCImage = "quay.io/minio/mc:RELEASE.2024-10-02T08-27-28Z" - // MinioJobName - job name - MinioJobName = "job.min.io/job-name" - // MinioJobCRName - job cr name - MinioJobCRName = "job.min.io/job-cr-name" - // MinioJobPhaseError - error - MinioJobPhaseError = "Error" - // MinioJobPhaseSuccess - Success - MinioJobPhaseSuccess = "Success" - // MinioJobPhaseRunning - running - MinioJobPhaseRunning = "Running" - // MinioJobPhaseFailed - failed - MinioJobPhaseFailed = "Failed" -) - -var operationAlias = map[string]string{ - "make-bucket": "mb", - "admin/policy/add": "admin/policy/create", -} - -// JobOperation - job operation -var JobOperation = map[string][]FieldsFunc{ - "mb": {FLAGS(), Sanitize(ALIAS(), Static("/"), Key("name")), Static("--ignore-existing")}, - "admin/user/add": {ALIAS(), Key("user"), Key("password")}, - "admin/policy/create": {ALIAS(), Key("name"), Key("policy")}, - "admin/policy/attach": {ALIAS(), Key("policy"), OneOf(KeyFormat("user", "--user"), KeyFormat("group", "--group"))}, - "admin/config/set": {ALIAS(), Key("webhookName"), Option(KeyValue("endpoint")), OthersKeyValues()}, - "support/callhome": {Key("action"), ALIAS(), FLAGS()}, - "license/register": {ALIAS(), OthersKeyValues()}, -} - -// OperationAliasToMC - convert operation to mc operation -func OperationAliasToMC(operation string) (op string, found bool) { - for k, v := range operationAlias { - if k == operation { - return v, true - } - if v == operation { - return v, true - } - } - // operation like admin/policy/attach match nothing. - // but it's a valid operation - if strings.Contains(operation, "/") { - return operation, true - } - // operation like replace match nothing - // it's not a valid operation - return "", false -} - -// MinIOIntervalJobCommand - Job run command -type MinIOIntervalJobCommand struct { - mutex sync.RWMutex - CommandSpec v1alpha1.CommandSpec - JobName string - MCOperation string - Command string - Succeeded bool - Message string - Created bool -} - -// SetStatus - set job command status -func (jobCommand *MinIOIntervalJobCommand) SetStatus(success bool, message string) { - if jobCommand == nil { - return - } - jobCommand.mutex.Lock() - jobCommand.Succeeded = success - jobCommand.Message = message - jobCommand.mutex.Unlock() -} - -// Success - check job command status -func (jobCommand *MinIOIntervalJobCommand) Success() bool { - if jobCommand == nil { - return false - } - jobCommand.mutex.Lock() - defer jobCommand.mutex.Unlock() - return jobCommand.Succeeded -} - -// createJob - create job -func (jobCommand *MinIOIntervalJobCommand) createJob(_ context.Context, _ client.Client, jobCR *v1alpha1.MinIOJob, stsPort int, t *miniov2.Tenant) (objs []client.Object) { - if jobCommand == nil { - return nil - } - jobCommand.mutex.RLock() - if jobCommand.Created || jobCommand.Succeeded { - jobCommand.mutex.RUnlock() - return nil - } - jobCommand.mutex.RUnlock() - jobCommands := []string{} - insecure := false - if len(jobCommand.CommandSpec.Command) == 0 { - commands := []string{"mc"} - commands = append(commands, strings.SplitN(jobCommand.MCOperation, "/", -1)...) - commands = append(commands, strings.SplitN(jobCommand.Command, " ", -1)...) - for _, command := range commands { - trimmedCommand := strings.TrimSpace(command) - if trimmedCommand != "" { - jobCommands = append(jobCommands, trimmedCommand) - } - } - } else { - jobCommands = append(jobCommands, jobCommand.CommandSpec.Command...) - } - - for _, command := range jobCommands { - if command == "--insecure" { - insecure = true - } - } - - if jobCR.Spec.Insecure != nil && *jobCR.Spec.Insecure && !insecure { - jobCommands = append(jobCommands, "--insecure") - insecure = true - } - - mcImage := jobCR.Spec.MCImage - if mcImage == "" { - mcImage = DefaultMCImage - } - baseVolumeMounts := []corev1.VolumeMount{ - { - Name: "config-dir", - MountPath: "/.mc", - }, - } - baseVolumes := []corev1.Volume{ - { - Name: "config-dir", - VolumeSource: corev1.VolumeSource{ - EmptyDir: &corev1.EmptyDirVolumeSource{}, - }, - }, - } - // if auto cert is not enabled and insecure is not enabled and tenant tls is enabled, add cert volumes - if !t.AutoCert() && !insecure && t.TLS() { - certsVolumes, certsVolumeMounts := getCertVolumes(t) - baseVolumeMounts = append(baseVolumeMounts, certsVolumeMounts...) - baseVolumes = append(baseVolumes, certsVolumes...) - } - - baseVolumeMounts = append(baseVolumeMounts, jobCommand.CommandSpec.VolumeMounts...) - baseVolumes = append(baseVolumes, jobCommand.CommandSpec.Volumes...) - - baseEnvFrom := []corev1.EnvFromSource{ - { - SecretRef: &corev1.SecretEnvSource{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: fmt.Sprintf("%s-job-secret", jobCR.Name), - }, - }, - }, - } - baseEnvFrom = append(baseEnvFrom, jobCommand.CommandSpec.EnvFrom...) - scheme := "http" - if t.TLS() { - scheme = "https" - } - secret := &corev1.Secret{ - ObjectMeta: metav1.ObjectMeta{ - Name: fmt.Sprintf("%s-job-secret", jobCR.Name), - Namespace: jobCR.Namespace, - }, - StringData: map[string]string{ - "MC_HOST_myminio": fmt.Sprintf("%s://$(ACCESS_KEY):$(SECRET_KEY)@minio.%s.svc.%s", scheme, t.Namespace, miniov2.GetClusterDomain()), - "MC_STS_ENDPOINT_myminio": fmt.Sprintf("https://sts.%s.svc.%s:%d/sts/%s", miniov2.GetNSFromFile(), miniov2.GetClusterDomain(), stsPort, t.Namespace), - "MC_WEB_IDENTITY_TOKEN_FILE_myminio": "/var/run/secrets/kubernetes.io/serviceaccount/token", - }, - } - objs = append(objs, secret) - job := &batchjobv1.Job{ - ObjectMeta: metav1.ObjectMeta{ - Name: fmt.Sprintf("%s-%s", jobCR.Name, jobCommand.JobName), - Namespace: jobCR.Namespace, - Labels: map[string]string{ - MinioJobName: jobCommand.JobName, - MinioJobCRName: jobCR.Name, - }, - Annotations: map[string]string{ - "job.min.io/operation": jobCommand.MCOperation, - }, - }, - Spec: batchjobv1.JobSpec{ - Template: corev1.PodTemplateSpec{ - ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - MinioJobName: jobCommand.JobName, - }, - }, - Spec: corev1.PodSpec{ - ServiceAccountName: jobCR.Spec.ServiceAccountName, - Containers: []corev1.Container{ - { - Name: "mc", - Image: mcImage, - ImagePullPolicy: jobCR.Spec.ImagePullPolicy, - Env: jobCommand.CommandSpec.Env, - EnvFrom: baseEnvFrom, - Command: jobCommands, - SecurityContext: jobCR.Spec.ContainerSecurityContext, - VolumeMounts: baseVolumeMounts, - Resources: jobCommand.CommandSpec.Resources, - }, - }, - ImagePullSecrets: jobCR.Spec.ImagePullSecret, - SecurityContext: jobCR.Spec.SecurityContext, - Volumes: baseVolumes, - }, - }, - }, - } - if jobCR.Spec.FailureStrategy == v1alpha1.StopOnFailure { - job.Spec.Template.Spec.RestartPolicy = corev1.RestartPolicyNever - } else { - job.Spec.Template.Spec.RestartPolicy = corev1.RestartPolicyOnFailure - } - objs = append(objs, job) - return objs -} - -// CreateJob - create job -func (jobCommand *MinIOIntervalJobCommand) CreateJob(ctx context.Context, k8sClient client.Client, jobCR *v1alpha1.MinIOJob, stsPort int, t *miniov2.Tenant) error { - for _, obj := range jobCommand.createJob(ctx, k8sClient, jobCR, stsPort, t) { - if obj == nil { - continue - } - _, err := runtime.NewObjectSyncer(ctx, k8sClient, jobCR, func() error { - return nil - }, obj, runtime.SyncTypeCreateOrUpdate).Sync(ctx) - if err != nil { - return err - } - } - jobCommand.mutex.Lock() - jobCommand.Created = true - jobCommand.mutex.Unlock() - return nil -} - -// MinIOIntervalJob - Interval Job -type MinIOIntervalJob struct { - // to see if that change - JobCR *v1alpha1.MinIOJob - Command []*MinIOIntervalJobCommand - CommandMap map[string]*MinIOIntervalJobCommand -} - -// GetMinioJobStatus - get job status -func (intervalJob *MinIOIntervalJob) GetMinioJobStatus(_ context.Context) v1alpha1.MinIOJobStatus { - status := v1alpha1.MinIOJobStatus{} - failed := false - running := false - message := "" - for _, command := range intervalJob.Command { - command.mutex.RLock() - if command.Succeeded { - status.CommandsStatus = append(status.CommandsStatus, v1alpha1.CommandStatus{ - Name: command.JobName, - Result: "Success", - Message: command.Message, - }) - } else { - failed = true - message = command.Message - // if Success is false and message is empty, it means the job is running - if command.Message == "" { - running = true - status.CommandsStatus = append(status.CommandsStatus, v1alpha1.CommandStatus{ - Name: command.JobName, - Result: "running", - Message: command.Message, - }) - } else { - status.CommandsStatus = append(status.CommandsStatus, v1alpha1.CommandStatus{ - Name: command.JobName, - Result: "failed", - Message: command.Message, - }) - } - } - command.mutex.RUnlock() - } - if running { - status.Phase = MinioJobPhaseRunning - } else { - if failed { - status.Phase = MinioJobPhaseFailed - status.Message = message - } else { - status.Phase = MinioJobPhaseSuccess - } - } - return status -} - -// CreateCommandJob - create command job -func (intervalJob *MinIOIntervalJob) CreateCommandJob(ctx context.Context, k8sClient client.Client, stsPort int, t *miniov2.Tenant) error { - for _, command := range intervalJob.Command { - if len(command.CommandSpec.DependsOn) == 0 { - err := command.CreateJob(ctx, k8sClient, intervalJob.JobCR, stsPort, t) - if err != nil { - return err - } - } else { - allDepsSuccess := true - for _, dep := range command.CommandSpec.DependsOn { - status, found := intervalJob.CommandMap[dep] - if !found { - return fmt.Errorf("dependent job %s not found", dep) - } - if !status.Success() { - allDepsSuccess = false - break - } - } - if allDepsSuccess { - err := command.CreateJob(ctx, k8sClient, intervalJob.JobCR, stsPort, t) - if err != nil { - return err - } - } - } - } - return nil -} - -// GenerateMinIOIntervalJobCommand - generate command -func GenerateMinIOIntervalJobCommand(commandSpec v1alpha1.CommandSpec, commandIndex int) (*MinIOIntervalJobCommand, error) { - jobCommand := &MinIOIntervalJobCommand{ - JobName: commandSpec.Name, - CommandSpec: commandSpec, - } - if len(commandSpec.Command) == 0 { - mcCommand, found := OperationAliasToMC(commandSpec.Operation) - if !found { - return nil, fmt.Errorf("operation %s is not supported", commandSpec.Operation) - } - argsFuncs, found := JobOperation[mcCommand] - if !found { - return nil, fmt.Errorf("operation %s is not supported", mcCommand) - } - commands := []string{} - for _, argsFunc := range argsFuncs { - jobArg, err := argsFunc(commandSpec.Args) - if err != nil { - return nil, err - } - if jobArg.Command != "" { - commands = append(commands, jobArg.Command) - } - - } - jobCommand.MCOperation = mcCommand - jobCommand.Command = strings.Join(commands, " ") - } - // some commands need to have a empty name - if jobCommand.JobName == "" { - jobCommand.JobName = fmt.Sprintf("command-%d", commandIndex) - } - return jobCommand, nil -} - -// getCertVolumes - get cert volumes -// from statefulsets.NewPool implementation -func getCertVolumes(t *miniov2.Tenant) (certsVolumes []corev1.Volume, certsVolumeMounts []corev1.VolumeMount) { - var certVolumeSources []corev1.VolumeProjection - for index, secret := range t.Spec.ExternalCertSecret { - crtMountPath := fmt.Sprintf("hostname-%d/%s", index, certs.PublicCertFile) - caMountPath := fmt.Sprintf("CAs/hostname-%d.crt", index) - - if index == 0 { - crtMountPath = certs.PublicCertFile - caMountPath = fmt.Sprintf("%s/%s", certs.CertsCADir, certs.PublicCertFile) - } - - var serverCertPaths []corev1.KeyToPath - if secret.Type == "kubernetes.io/tls" { - serverCertPaths = []corev1.KeyToPath{ - {Key: certs.TLSCertFile, Path: crtMountPath}, - {Key: certs.TLSCertFile, Path: caMountPath}, - } - } else if secret.Type == "cert-manager.io/v1alpha2" || secret.Type == "cert-manager.io/v1" { - serverCertPaths = []corev1.KeyToPath{ - {Key: certs.TLSCertFile, Path: crtMountPath}, - {Key: certs.CAPublicCertFile, Path: caMountPath}, - } - } else { - serverCertPaths = []corev1.KeyToPath{ - {Key: certs.PublicCertFile, Path: crtMountPath}, - {Key: certs.PublicCertFile, Path: caMountPath}, - } - } - certVolumeSources = append(certVolumeSources, corev1.VolumeProjection{ - Secret: &corev1.SecretProjection{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: secret.Name, - }, - Items: serverCertPaths, - }, - }) - } - for index, secret := range t.Spec.ExternalClientCertSecrets { - crtMountPath := fmt.Sprintf("client-%d/client.crt", index) - var clientKeyPairPaths []corev1.KeyToPath - if secret.Type == "kubernetes.io/tls" { - clientKeyPairPaths = []corev1.KeyToPath{ - {Key: certs.TLSCertFile, Path: crtMountPath}, - } - } else if secret.Type == "cert-manager.io/v1alpha2" || secret.Type == "cert-manager.io/v1" { - clientKeyPairPaths = []corev1.KeyToPath{ - {Key: certs.TLSCertFile, Path: crtMountPath}, - {Key: certs.CAPublicCertFile, Path: fmt.Sprintf("%s/client-ca-%d.crt", certs.CertsCADir, index)}, - } - } else { - clientKeyPairPaths = []corev1.KeyToPath{ - {Key: certs.PublicCertFile, Path: crtMountPath}, - } - } - certVolumeSources = append(certVolumeSources, corev1.VolumeProjection{ - Secret: &corev1.SecretProjection{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: secret.Name, - }, - Items: clientKeyPairPaths, - }, - }) - } - for index, secret := range t.Spec.ExternalCaCertSecret { - var caCertPaths []corev1.KeyToPath - // This covers both secrets of type "kubernetes.io/tls" and - // "cert-manager.io/v1alpha2" because of same keys in both. - if secret.Type == "kubernetes.io/tls" { - caCertPaths = []corev1.KeyToPath{ - {Key: certs.TLSCertFile, Path: fmt.Sprintf("%s/ca-%d.crt", certs.CertsCADir, index)}, - } - } else if secret.Type == "cert-manager.io/v1alpha2" || secret.Type == "cert-manager.io/v1" { - caCertPaths = []corev1.KeyToPath{ - {Key: certs.CAPublicCertFile, Path: fmt.Sprintf("%s/ca-%d.crt", certs.CertsCADir, index)}, - } - } else { - caCertPaths = []corev1.KeyToPath{ - {Key: certs.PublicCertFile, Path: fmt.Sprintf("%s/ca-%d.crt", certs.CertsCADir, index)}, - } - } - certVolumeSources = append(certVolumeSources, corev1.VolumeProjection{ - Secret: &corev1.SecretProjection{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: secret.Name, - }, - Items: caCertPaths, - }, - }) - } - - if len(certVolumeSources) > 0 { - certsVolumes = append(certsVolumes, corev1.Volume{ - Name: "certs", - VolumeSource: corev1.VolumeSource{ - Projected: &corev1.ProjectedVolumeSource{ - Sources: certVolumeSources, - }, - }, - }) - certsVolumeMounts = append(certsVolumeMounts, corev1.VolumeMount{ - Name: "certs", - MountPath: "/root/.mc/certs", - }) - } - return certsVolumes, certsVolumeMounts -} diff --git a/release.sh b/release.sh index 0c60ce45f02..0436b378496 100755 --- a/release.sh +++ b/release.sh @@ -27,7 +27,6 @@ MC_RELEASE=$(get_latest_release minio/mc) MINIO_CURRENT_RELEASE=$(sed -nr 's/.*(minio\/minio\:)([v]?.*)"/\2/p' pkg/apis/minio.min.io/v2/constants.go) KES_CURRENT_RELEASE=$(sed -nr 's/.*(minio\/kes\:)([v]?.*)"/\2/p' pkg/apis/minio.min.io/v2/constants.go) -MC_CURRENT_RELEASE=$(sed -nr 's/.*(minio\/mc\:)([v]?.*)"/\2/p' pkg/utils/miniojob/types.go) files=( "README.md" @@ -48,7 +47,6 @@ files=( "pkg/controller/operator.go" "resources/base/deployment.yaml" "testing/console-tenant+kes.sh" - "pkg/utils/miniojob/types.go" ) CURRENT_RELEASE=$(get_latest_release minio/operator) diff --git a/resources/base/crds/job.min.io_miniojobs.yaml b/resources/base/crds/job.min.io_miniojobs.yaml deleted file mode 100644 index 64f9bafe2e5..00000000000 --- a/resources/base/crds/job.min.io_miniojobs.yaml +++ /dev/null @@ -1,1203 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.15.0 - operator.min.io/version: v6.0.4 - name: miniojobs.job.min.io -spec: - group: job.min.io - names: - kind: MinIOJob - listKind: MinIOJobList - plural: miniojobs - shortNames: - - miniojob - singular: miniojob - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .status.phase - name: Phase - type: string - - jsonPath: .status.message - name: Message - type: string - name: v1alpha1 - schema: - openAPIV3Schema: - properties: - apiVersion: - type: string - kind: - type: string - metadata: - type: object - spec: - properties: - commands: - items: - properties: - args: - additionalProperties: - type: string - type: object - command: - items: - type: string - type: array - dependsOn: - items: - type: string - type: array - env: - items: - properties: - name: - type: string - value: - type: string - valueFrom: - properties: - configMapKeyRef: - properties: - key: - type: string - name: - default: "" - type: string - optional: - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic - secretKeyRef: - properties: - key: - type: string - name: - default: "" - type: string - optional: - type: boolean - required: - - key - type: object - x-kubernetes-map-type: atomic - type: object - required: - - name - type: object - type: array - envFrom: - items: - properties: - configMapRef: - properties: - name: - default: "" - type: string - optional: - type: boolean - type: object - x-kubernetes-map-type: atomic - prefix: - type: string - secretRef: - properties: - name: - default: "" - type: string - optional: - type: boolean - type: object - x-kubernetes-map-type: atomic - type: object - type: array - name: - type: string - op: - type: string - resources: - properties: - claims: - items: - properties: - name: - type: string - required: - - name - type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - type: object - volumeMounts: - items: - properties: - mountPath: - type: string - mountPropagation: - type: string - name: - type: string - readOnly: - type: boolean - recursiveReadOnly: - type: string - subPath: - type: string - subPathExpr: - type: string - required: - - mountPath - - name - type: object - type: array - volumes: - items: - properties: - awsElasticBlockStore: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - readOnly: - type: boolean - volumeID: - type: string - required: - - volumeID - type: object - azureDisk: - properties: - cachingMode: - type: string - diskName: - type: string - diskURI: - type: string - fsType: - type: string - kind: - type: string - readOnly: - type: boolean - required: - - diskName - - diskURI - type: object - azureFile: - properties: - readOnly: - type: boolean - secretName: - type: string - shareName: - type: string - required: - - secretName - - shareName - type: object - cephfs: - properties: - monitors: - items: - type: string - type: array - x-kubernetes-list-type: atomic - path: - type: string - readOnly: - type: boolean - secretFile: - type: string - secretRef: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - user: - type: string - required: - - monitors - type: object - cinder: - properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - volumeID: - type: string - required: - - volumeID - type: object - configMap: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - x-kubernetes-list-type: atomic - name: - default: "" - type: string - optional: - type: boolean - type: object - x-kubernetes-map-type: atomic - csi: - properties: - driver: - type: string - fsType: - type: string - nodePublishSecretRef: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - readOnly: - type: boolean - volumeAttributes: - additionalProperties: - type: string - type: object - required: - - driver - type: object - downwardAPI: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - mode: - format: int32 - type: integer - path: - type: string - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic - required: - - path - type: object - type: array - x-kubernetes-list-type: atomic - type: object - emptyDir: - properties: - medium: - type: string - sizeLimit: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - ephemeral: - properties: - volumeClaimTemplate: - properties: - metadata: - properties: - annotations: - additionalProperties: - type: string - type: object - finalizers: - items: - type: string - type: array - labels: - additionalProperties: - type: string - type: object - name: - type: string - namespace: - type: string - type: object - spec: - properties: - accessModes: - items: - type: string - type: array - x-kubernetes-list-type: atomic - dataSource: - properties: - apiGroup: - type: string - kind: - type: string - name: - type: string - required: - - kind - - name - type: object - x-kubernetes-map-type: atomic - dataSourceRef: - properties: - apiGroup: - type: string - kind: - type: string - name: - type: string - namespace: - type: string - required: - - kind - - name - type: object - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - type: object - type: object - selector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - type: object - type: object - x-kubernetes-map-type: atomic - storageClassName: - type: string - volumeAttributesClassName: - type: string - volumeMode: - type: string - volumeName: - type: string - type: object - required: - - spec - type: object - type: object - fc: - properties: - fsType: - type: string - lun: - format: int32 - type: integer - readOnly: - type: boolean - targetWWNs: - items: - type: string - type: array - x-kubernetes-list-type: atomic - wwids: - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - flexVolume: - properties: - driver: - type: string - fsType: - type: string - options: - additionalProperties: - type: string - type: object - readOnly: - type: boolean - secretRef: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - required: - - driver - type: object - flocker: - properties: - datasetName: - type: string - datasetUUID: - type: string - type: object - gcePersistentDisk: - properties: - fsType: - type: string - partition: - format: int32 - type: integer - pdName: - type: string - readOnly: - type: boolean - required: - - pdName - type: object - gitRepo: - properties: - directory: - type: string - repository: - type: string - revision: - type: string - required: - - repository - type: object - glusterfs: - properties: - endpoints: - type: string - path: - type: string - readOnly: - type: boolean - required: - - endpoints - - path - type: object - hostPath: - properties: - path: - type: string - type: - type: string - required: - - path - type: object - iscsi: - properties: - chapAuthDiscovery: - type: boolean - chapAuthSession: - type: boolean - fsType: - type: string - initiatorName: - type: string - iqn: - type: string - iscsiInterface: - type: string - lun: - format: int32 - type: integer - portals: - items: - type: string - type: array - x-kubernetes-list-type: atomic - readOnly: - type: boolean - secretRef: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - targetPortal: - type: string - required: - - iqn - - lun - - targetPortal - type: object - name: - type: string - nfs: - properties: - path: - type: string - readOnly: - type: boolean - server: - type: string - required: - - path - - server - type: object - persistentVolumeClaim: - properties: - claimName: - type: string - readOnly: - type: boolean - required: - - claimName - type: object - photonPersistentDisk: - properties: - fsType: - type: string - pdID: - type: string - required: - - pdID - type: object - portworxVolume: - properties: - fsType: - type: string - readOnly: - type: boolean - volumeID: - type: string - required: - - volumeID - type: object - projected: - properties: - defaultMode: - format: int32 - type: integer - sources: - items: - properties: - clusterTrustBundle: - properties: - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - operator: - type: string - values: - items: - type: string - type: array - x-kubernetes-list-type: atomic - required: - - key - - operator - type: object - type: array - x-kubernetes-list-type: atomic - matchLabels: - additionalProperties: - type: string - type: object - type: object - x-kubernetes-map-type: atomic - name: - type: string - optional: - type: boolean - path: - type: string - signerName: - type: string - required: - - path - type: object - configMap: - properties: - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - x-kubernetes-list-type: atomic - name: - default: "" - type: string - optional: - type: boolean - type: object - x-kubernetes-map-type: atomic - downwardAPI: - properties: - items: - items: - properties: - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - required: - - fieldPath - type: object - x-kubernetes-map-type: atomic - mode: - format: int32 - type: integer - path: - type: string - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - resource: - type: string - required: - - resource - type: object - x-kubernetes-map-type: atomic - required: - - path - type: object - type: array - x-kubernetes-list-type: atomic - type: object - secret: - properties: - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - x-kubernetes-list-type: atomic - name: - default: "" - type: string - optional: - type: boolean - type: object - x-kubernetes-map-type: atomic - serviceAccountToken: - properties: - audience: - type: string - expirationSeconds: - format: int64 - type: integer - path: - type: string - required: - - path - type: object - type: object - type: array - x-kubernetes-list-type: atomic - type: object - quobyte: - properties: - group: - type: string - readOnly: - type: boolean - registry: - type: string - tenant: - type: string - user: - type: string - volume: - type: string - required: - - registry - - volume - type: object - rbd: - properties: - fsType: - type: string - image: - type: string - keyring: - type: string - monitors: - items: - type: string - type: array - x-kubernetes-list-type: atomic - pool: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - user: - type: string - required: - - image - - monitors - type: object - scaleIO: - properties: - fsType: - type: string - gateway: - type: string - protectionDomain: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - sslEnabled: - type: boolean - storageMode: - type: string - storagePool: - type: string - system: - type: string - volumeName: - type: string - required: - - gateway - - secretRef - - system - type: object - secret: - properties: - defaultMode: - format: int32 - type: integer - items: - items: - properties: - key: - type: string - mode: - format: int32 - type: integer - path: - type: string - required: - - key - - path - type: object - type: array - x-kubernetes-list-type: atomic - optional: - type: boolean - secretName: - type: string - type: object - storageos: - properties: - fsType: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - volumeName: - type: string - volumeNamespace: - type: string - type: object - vsphereVolume: - properties: - fsType: - type: string - storagePolicyID: - type: string - storagePolicyName: - type: string - volumePath: - type: string - required: - - volumePath - type: object - required: - - name - type: object - type: array - type: object - type: array - containerSecurityContext: - properties: - allowPrivilegeEscalation: - type: boolean - appArmorProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - capabilities: - properties: - add: - items: - type: string - type: array - x-kubernetes-list-type: atomic - drop: - items: - type: string - type: array - x-kubernetes-list-type: atomic - type: object - privileged: - type: boolean - procMount: - type: string - readOnlyRootFilesystem: - type: boolean - runAsGroup: - format: int64 - type: integer - runAsNonRoot: - type: boolean - runAsUser: - format: int64 - type: integer - seLinuxOptions: - properties: - level: - type: string - role: - type: string - type: - type: string - user: - type: string - type: object - seccompProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - windowsOptions: - properties: - gmsaCredentialSpec: - type: string - gmsaCredentialSpecName: - type: string - hostProcess: - type: boolean - runAsUserName: - type: string - type: object - type: object - execution: - default: parallel - enum: - - parallel - - sequential - type: string - failureStrategy: - default: continueOnFailure - enum: - - continueOnFailure - - stopOnFailure - type: string - imagePullPolicy: - type: string - imagePullSecret: - items: - properties: - name: - default: "" - type: string - type: object - x-kubernetes-map-type: atomic - type: array - insecure: - type: boolean - mcImage: - default: quay.io/minio/mc:RELEASE.2024-10-02T08-27-28Z - type: string - securityContext: - properties: - appArmorProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - fsGroup: - format: int64 - type: integer - fsGroupChangePolicy: - type: string - runAsGroup: - format: int64 - type: integer - runAsNonRoot: - type: boolean - runAsUser: - format: int64 - type: integer - seLinuxOptions: - properties: - level: - type: string - role: - type: string - type: - type: string - user: - type: string - type: object - seccompProfile: - properties: - localhostProfile: - type: string - type: - type: string - required: - - type - type: object - supplementalGroups: - items: - format: int64 - type: integer - type: array - x-kubernetes-list-type: atomic - sysctls: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - x-kubernetes-list-type: atomic - windowsOptions: - properties: - gmsaCredentialSpec: - type: string - gmsaCredentialSpecName: - type: string - hostProcess: - type: boolean - runAsUserName: - type: string - type: object - type: object - serviceAccountName: - type: string - tenant: - properties: - name: - type: string - namespace: - type: string - required: - - name - - namespace - type: object - required: - - commands - - serviceAccountName - - tenant - type: object - status: - properties: - commands: - items: - properties: - message: - type: string - name: - type: string - result: - type: string - required: - - result - type: object - type: array - message: - type: string - phase: - type: string - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/resources/base/crds/kustomization.yaml b/resources/base/crds/kustomization.yaml index 1387d04ee1b..56f94ce4cfb 100644 --- a/resources/base/crds/kustomization.yaml +++ b/resources/base/crds/kustomization.yaml @@ -3,4 +3,3 @@ kind: Kustomization resources: - minio.min.io_tenants.yaml - sts.min.io_policybindings.yaml - - job.min.io_miniojobs.yaml