Skip to content

Commit

Permalink
Add Lifecycle hooks configuration to Tenant (#1835)
Browse files Browse the repository at this point in the history
* Add Lifecycle hooks configuration to Tenant

* Regen CRD docs to include Lifecycle

Signed-off-by: pjuarezd <pjuarezd@users.noreply.github.com>

---------

Signed-off-by: pjuarezd <pjuarezd@users.noreply.github.com>
Co-authored-by: Matthew Toohey <matthew.toohey@imc.com>
Co-authored-by: pjuarezd <pjuarezd@users.noreply.github.com>
Co-authored-by: Ramon de Klein <mail@ramondeklein.nl>
  • Loading branch information
4 people committed Apr 22, 2024
1 parent 01c56a5 commit 4cc3123
Show file tree
Hide file tree
Showing 7 changed files with 222 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/tenant_crd.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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* +
Expand Down Expand Up @@ -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.

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 @@ -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:
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 @@ -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 }}
Expand Down
3 changes: 3 additions & 0 deletions helm/tenant/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,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 @@ -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* +
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 @@ -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),
}
}
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 @@ -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:
Expand Down

0 comments on commit 4cc3123

Please sign in to comment.