diff --git a/docs/tenant_crd.adoc b/docs/tenant_crd.adoc index 030f7e80af3..d2241ab0fa2 100644 --- a/docs/tenant_crd.adoc +++ b/docs/tenant_crd.adoc @@ -364,13 +364,13 @@ Specify an object containing the following fields: + |*Optional* + - Specify the GCP default credentials to be used for KES to authenticate to GCP key store +Specify the GCP default credentials to be used for KES to authenticate to GCP key store |*`gcpWorkloadIdentityPool`* __string__ |*Optional* + - Specify the name of the workload identity pool (This is required for generating service account token) +Specify the name of the workload identity pool (This is required for generating service account token) |*`annotations`* __object (keys:string, values:string)__ |*Optional* + @@ -1091,6 +1091,9 @@ See the https://min.io/docs/minio/kubernetes/upstream/operations/install-deploy- |*`startup`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#probe-v1-core[$$Probe$$]__ |Startup Probe allows to configure a max grace period for a pod to start before getting traffic routed to it. +|*`lifecycle`* __link:https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#lifecycle-v1-core[$$Lifecycle$$]__ +|Lifecycle hooks for container. + |*`features`* __xref:{anchor_prefix}-github-com-minio-operator-pkg-apis-minio-min-io-v2-features[$$Features$$]__ |S3 related features can be disabled or enabled such as `bucketDNS` etc. diff --git a/helm/operator/templates/minio.min.io_tenants.yaml b/helm/operator/templates/minio.min.io_tenants.yaml index 9282ca6250a..cf9395f4a61 100644 --- a/helm/operator/templates/minio.min.io_tenants.yaml +++ b/helm/operator/templates/minio.min.io_tenants.yaml @@ -2378,6 +2378,109 @@ spec: required: - kesSecret type: object + lifecycle: + properties: + postStart: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object liveness: properties: exec: diff --git a/helm/tenant/templates/tenant.yaml b/helm/tenant/templates/tenant.yaml index 56116b90771..a855b087c99 100644 --- a/helm/tenant/templates/tenant.yaml +++ b/helm/tenant/templates/tenant.yaml @@ -120,6 +120,9 @@ spec: {{- with (dig "startup" (dict) .) }} startup: {{- toYaml . | nindent 4 }} {{- end }} + {{- with (dig "lifecycle" (dict) .) }} + lifecycle: {{- toYaml . | nindent 4 }} + {{- end }} {{- with (dig "exposeServices" (dict) .) }} exposeServices: {{- toYaml . | nindent 4 }} {{- end }} diff --git a/helm/tenant/values.yaml b/helm/tenant/values.yaml index aeb80120cc7..90cf5483659 100644 --- a/helm/tenant/values.yaml +++ b/helm/tenant/values.yaml @@ -314,6 +314,9 @@ tenant: # Refer startup: { } ### + # The `Lifecycle hooks `__ for container. + lifecycle: { } + ### # Directs the Operator to deploy the MinIO S3 API and Console services as LoadBalancer objects. # # If the Kubernetes cluster has a configured LoadBalancer, it can attempt to route traffic to those services automatically. diff --git a/pkg/apis/minio.min.io/v2/types.go b/pkg/apis/minio.min.io/v2/types.go index 831aa936818..cc576deb59b 100644 --- a/pkg/apis/minio.min.io/v2/types.go +++ b/pkg/apis/minio.min.io/v2/types.go @@ -257,6 +257,10 @@ type TenantSpec struct { // +optional Startup *corev1.Probe `json:"startup,omitempty"` + // Lifecycle hooks for container. + // +optional + Lifecycle *corev1.Lifecycle `json:"lifecycle,omitempty"` + // S3 related features can be disabled or enabled such as `bucketDNS` etc. Features *Features `json:"features,omitempty"` // *Optional* + diff --git a/pkg/resources/statefulsets/minio-statefulset.go b/pkg/resources/statefulsets/minio-statefulset.go index 8b69231f162..b0ca892cb85 100644 --- a/pkg/resources/statefulsets/minio-statefulset.go +++ b/pkg/resources/statefulsets/minio-statefulset.go @@ -351,6 +351,7 @@ func poolMinioServerContainer(t *miniov2.Tenant, skipEnvVars map[string][]byte, LivenessProbe: t.Spec.Liveness, ReadinessProbe: t.Spec.Readiness, StartupProbe: t.Spec.Startup, + Lifecycle: t.Spec.Lifecycle, SecurityContext: poolContainerSecurityContext(pool), } } diff --git a/resources/base/crds/minio.min.io_tenants.yaml b/resources/base/crds/minio.min.io_tenants.yaml index 9282ca6250a..cf9395f4a61 100644 --- a/resources/base/crds/minio.min.io_tenants.yaml +++ b/resources/base/crds/minio.min.io_tenants.yaml @@ -2378,6 +2378,109 @@ spec: required: - kesSecret type: object + lifecycle: + properties: + postStart: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object liveness: properties: exec: