Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Lifecycle hooks configuration to Tenant #1835

Merged
merged 3 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions docs/tenant_crd.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,11 @@ KESConfig (`kes`) defines the configuration of the https://github.com/minio/kes[

|*`gcpCredentialSecretName`* __string__
|*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* +
Expand Down Expand Up @@ -749,6 +749,9 @@ TenantSpec (`spec`) defines the configuration of a MinIO Tenant object. +
|*`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.

Expand Down
103 changes: 103 additions & 0 deletions helm/operator/templates/minio.min.io_tenants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2234,6 +2234,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:
Expand Down
3 changes: 3 additions & 0 deletions helm/tenant/templates/tenant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,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 }}
Expand Down
3 changes: 3 additions & 0 deletions helm/tenant/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ tenant:
# Refer
startup: { }
###
# The `Lifecycle hooks <https://kubernetes.io/docs/concepts/containers/container-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.
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/minio.min.io/v2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,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* +
Expand Down
1 change: 1 addition & 0 deletions pkg/resources/statefulsets/minio-statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,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),
}
}
Expand Down
103 changes: 103 additions & 0 deletions resources/base/crds/minio.min.io_tenants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2234,6 +2234,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:
Expand Down