Skip to content

Commit

Permalink
Add Lifecycle hooks configuration to Tenant
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Toohey committed Nov 8, 2023
1 parent 6c3d608 commit af2889e
Show file tree
Hide file tree
Showing 6 changed files with 217 additions and 0 deletions.
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 @@ -147,6 +147,9 @@ tenant:
# Startup Probe for container startup. Container will be restarted if the probe fails.
# Refer https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
startup: { }
# Lifecycle hooks for container.
# Refer https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/
lifecycle: { }
## exposeServices defines the exposure of the MinIO object storage and Console services.
## service is exposed as a loadbalancer in k8s service.
exposeServices: { }
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

0 comments on commit af2889e

Please sign in to comment.