Skip to content

Commit

Permalink
Add support for configurable timeoutSeconds (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored Jun 23, 2020
1 parent 4810731 commit 72ec8e4
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 9 deletions.
6 changes: 4 additions & 2 deletions examples/minioinstance-kes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,17 @@ spec:
## restarts the pods if liveness checks fail.
liveness:
initialDelaySeconds: 120
periodSeconds: 60
periodSeconds: 15
timeoutSeconds: 12 # should always greater than MINIO_API_READY_DEADLINE (which defaults to 10s)
## Readiness probe detects situations when MinIO server instance
## is not ready to accept traffic. Kubernetes doesn't forward
## traffic to the pod while readiness checks fail.
## Readiness check will only work if PodManagementPolicy is set to "Parallel".
## Disable this check if you're setting PodManagementPolicy to "OrderedReady".
readiness:
initialDelaySeconds: 120
periodSeconds: 60
periodSeconds: 15
timeoutSeconds: 1
## nodeSelector parameters for MinIO Pods. It specifies a map of key-value pairs. For the pod to be
## eligible to run on a node, the node must have each of the
## indicated key-value pairs as labels.
Expand Down
6 changes: 4 additions & 2 deletions examples/minioinstance-mcs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,17 @@ spec:
## restarts the pods if liveness checks fail.
liveness:
initialDelaySeconds: 120
periodSeconds: 60
periodSeconds: 15
timeoutSeconds: 12 # should always greater than MINIO_API_READY_DEADLINE (which defaults to 10s)
## Readiness probe detects situations when MinIO server instance
## is not ready to accept traffic. Kubernetes doesn't forward
## traffic to the pod while readiness checks fail.
## Readiness check will only work if PodManagementPolicy is set to "Parallel".
## Disable this check if you're setting PodManagementPolicy to "OrderedReady".
readiness:
initialDelaySeconds: 120
periodSeconds: 60
periodSeconds: 15
timeoutSeconds: 1
## nodeSelector parameters for MinIO Pods. It specifies a map of key-value pairs. For the pod to be
## eligible to run on a node, the node must have each of the
## indicated key-value pairs as labels.
Expand Down
10 changes: 7 additions & 3 deletions examples/minioinstance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ spec:
# value: storage
## Add environment variables to be set in MinIO container (https://github.com/minio/minio/tree/master/docs/config)
# env:
# - name: MINIO_API_READY_DEADLINE
# value: "10s"
# - name: MINIO_BROWSER
# value: "off" # to turn-off browser
# value: "off" # to turn-off browser
# - name: MINIO_STORAGE_CLASS_STANDARD
# value: "EC:2"
## Configure resource requests and limits for MinIO containers
Expand All @@ -113,15 +115,17 @@ spec:
## restarts the pods if liveness checks fail.
liveness:
initialDelaySeconds: 120
periodSeconds: 60
periodSeconds: 15
timeoutSeconds: 12 # should always greater than MINIO_API_READY_DEADLINE (which defaults to 10s)
## Readiness probe detects situations when MinIO server instance
## is not ready to accept traffic. Kubernetes doesn't forward
## traffic to the pod while readiness checks fail.
## Readiness check will only work if PodManagementPolicy is set to "Parallel".
## Disable this check if you're setting PodManagementPolicy to "OrderedReady".
readiness:
initialDelaySeconds: 120
periodSeconds: 60
periodSeconds: 15
timeoutSeconds: 1
## nodeSelector parameters for MinIO Pods. It specifies a map of key-value pairs. For the pod to be
## eligible to run on a node, the node must have each of the
## indicated key-value pairs as labels.
Expand Down
10 changes: 8 additions & 2 deletions pkg/apis/operator.min.io/v1/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ const ReadinessPath = "/minio/health/ready"
const ReadinessInitialDelay = 120

// ReadinessPeriod specifies the interval in calling the readiness endpoint
const ReadinessPeriod = 60
const ReadinessPeriod = 15

// ReadinessTimeout specifies the timeout for the readiness probe to expect a response
const ReadinessTimeout = 12

// LivenessPath specifies the endpoint for liveness check
const LivenessPath = "/minio/health/live"
Expand All @@ -103,7 +106,10 @@ const LivenessPath = "/minio/health/live"
const LivenessInitialDelay = 120

// LivenessPeriod specifies the interval in calling the liveness endpoint
const LivenessPeriod = 60
const LivenessPeriod = 15

// LivenessTimeout specifies the timeout for the liveness probe to expect a response
const LivenessTimeout = 1

// MCS Related Constants

Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/operator.min.io/v1/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ func (mi *MinIOInstance) EnsureDefaults() *MinIOInstance {
if mi.Spec.Readiness.PeriodSeconds == 0 {
mi.Spec.Readiness.PeriodSeconds = ReadinessPeriod
}
if mi.Spec.Readiness.TimeoutSeconds == 0 {
mi.Spec.Readiness.TimeoutSeconds = ReadinessTimeout
}
}

if mi.Spec.Liveness != nil {
Expand All @@ -188,6 +191,9 @@ func (mi *MinIOInstance) EnsureDefaults() *MinIOInstance {
if mi.Spec.Liveness.PeriodSeconds == 0 {
mi.Spec.Liveness.PeriodSeconds = LivenessPeriod
}
if mi.Spec.Liveness.TimeoutSeconds == 0 {
mi.Spec.Liveness.TimeoutSeconds = LivenessTimeout
}
}

if mi.HasMCSEnabled() {
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/operator.min.io/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,14 @@ type Zone struct {
type Liveness struct {
InitialDelaySeconds int32 `json:"initialDelaySeconds"`
PeriodSeconds int32 `json:"periodSeconds"`
TimeoutSeconds int32 `json:"timeoutSeconds"`
}

// Readiness specifies the spec for liveness probe
type Readiness struct {
InitialDelaySeconds int32 `json:"initialDelaySeconds"`
PeriodSeconds int32 `json:"periodSeconds"`
TimeoutSeconds int32 `json:"timeoutSeconds"`
}

// MCSConfig defines the specifications for MCS Deployment
Expand Down
2 changes: 2 additions & 0 deletions pkg/resources/statefulsets/minio-statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ func probes(mi *miniov1.MinIOInstance) (readiness, liveness *corev1.Probe) {
},
InitialDelaySeconds: mi.Spec.Readiness.InitialDelaySeconds,
PeriodSeconds: mi.Spec.Readiness.PeriodSeconds,
TimeoutSeconds: mi.Spec.Readiness.TimeoutSeconds,
}
}

Expand All @@ -176,6 +177,7 @@ func probes(mi *miniov1.MinIOInstance) (readiness, liveness *corev1.Probe) {
},
InitialDelaySeconds: mi.Spec.Liveness.InitialDelaySeconds,
PeriodSeconds: mi.Spec.Liveness.PeriodSeconds,
TimeoutSeconds: mi.Spec.Liveness.TimeoutSeconds,
}
}

Expand Down

0 comments on commit 72ec8e4

Please sign in to comment.