diff --git a/bundle/manifests/rc.app.stacks_runtimecomponents.yaml b/bundle/manifests/rc.app.stacks_runtimecomponents.yaml index c367198c..5cc06e8c 100644 --- a/bundle/manifests/rc.app.stacks_runtimecomponents.yaml +++ b/bundle/manifests/rc.app.stacks_runtimecomponents.yaml @@ -3130,8 +3130,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started @@ -3281,8 +3279,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started @@ -3433,8 +3429,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started @@ -10500,8 +10494,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started @@ -10651,8 +10643,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started @@ -10803,8 +10793,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started diff --git a/common/common.go b/common/common.go index 724dec26..9d790ec8 100644 --- a/common/common.go +++ b/common/common.go @@ -7,9 +7,6 @@ import ( // GetDefaultMicroProfileStartupProbe returns the default values for MicroProfile Health-based startup probe. func GetDefaultMicroProfileStartupProbe(ba BaseComponent) *BaseComponentProbe { port := intstr.FromInt(int(ba.GetService().GetPort())) - periodSeconds := int32(10) - timeoutSeconds := int32(2) - failureThreshold := int32(20) return &BaseComponentProbe{ BaseComponentProbeHandler: BaseComponentProbeHandler{ HTTPGet: &OptionalHTTPGetAction{ @@ -18,19 +15,15 @@ func GetDefaultMicroProfileStartupProbe(ba BaseComponent) *BaseComponentProbe { Scheme: "HTTPS", }, }, - PeriodSeconds: &periodSeconds, - TimeoutSeconds: &timeoutSeconds, - FailureThreshold: &failureThreshold, + PeriodSeconds: 10, + TimeoutSeconds: 2, + FailureThreshold: 20, } } // GetDefaultMicroProfileReadinessProbe returns the default values for MicroProfile Health-based readiness probe. func GetDefaultMicroProfileReadinessProbe(ba BaseComponent) *BaseComponentProbe { port := intstr.FromInt(int(ba.GetService().GetPort())) - initialDelaySeconds := int32(10) - periodSeconds := int32(10) - timeoutSeconds := int32(2) - failureThreshold := int32(20) return &BaseComponentProbe{ BaseComponentProbeHandler: BaseComponentProbeHandler{ HTTPGet: &OptionalHTTPGetAction{ @@ -39,20 +32,16 @@ func GetDefaultMicroProfileReadinessProbe(ba BaseComponent) *BaseComponentProbe Scheme: "HTTPS", }, }, - InitialDelaySeconds: &initialDelaySeconds, - PeriodSeconds: &periodSeconds, - TimeoutSeconds: &timeoutSeconds, - FailureThreshold: &failureThreshold, + InitialDelaySeconds: 10, + PeriodSeconds: 10, + TimeoutSeconds: 2, + FailureThreshold: 10, } } // GetDefaultMicroProfileLivenessProbe returns the default values for MicroProfile Health-based liveness probe. func GetDefaultMicroProfileLivenessProbe(ba BaseComponent) *BaseComponentProbe { port := intstr.FromInt(int(ba.GetService().GetPort())) - initialDelaySeconds := int32(60) - periodSeconds := int32(10) - timeoutSeconds := int32(2) - failureThreshold := int32(3) return &BaseComponentProbe{ BaseComponentProbeHandler: BaseComponentProbeHandler{ HTTPGet: &OptionalHTTPGetAction{ @@ -61,10 +50,10 @@ func GetDefaultMicroProfileLivenessProbe(ba BaseComponent) *BaseComponentProbe { Scheme: "HTTPS", }, }, - InitialDelaySeconds: &initialDelaySeconds, - PeriodSeconds: &periodSeconds, - TimeoutSeconds: &timeoutSeconds, - FailureThreshold: &failureThreshold, + InitialDelaySeconds: 60, + PeriodSeconds: 10, + TimeoutSeconds: 2, + FailureThreshold: 3, } } diff --git a/common/types.go b/common/types.go index b38ef815..ca09a8d2 100644 --- a/common/types.go +++ b/common/types.go @@ -184,24 +184,24 @@ type BaseComponentProbe struct { // Number of seconds after the container has started before liveness probes are initiated. // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes // +optional - InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty"` + InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"` // Number of seconds after which the probe times out. - // Defaults to nil. + // Defaults to 1 second. Minimum value is 1. // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes // +optional - TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` + TimeoutSeconds int32 `json:"timeoutSeconds,omitempty"` // How often (in seconds) to perform the probe. - // Defaults to nil. + // Default to 10 seconds. Minimum value is 1. // +optional - PeriodSeconds *int32 `json:"periodSeconds,omitempty"` + PeriodSeconds int32 `json:"periodSeconds,omitempty"` // Minimum consecutive successes for the probe to be considered successful after having failed. - // Defaults to nil. + // Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. // +optional - SuccessThreshold *int32 `json:"successThreshold,omitempty"` + SuccessThreshold int32 `json:"successThreshold,omitempty"` // Minimum consecutive failures for the probe to be considered failed after having succeeded. - // Defaults to nil. + // Defaults to 3. Minimum value is 1. // +optional - FailureThreshold *int32 `json:"failureThreshold,omitempty"` + FailureThreshold int32 `json:"failureThreshold,omitempty"` // Optional duration in seconds the pod needs to terminate gracefully upon probe failure. // The grace period is the duration in seconds after the processes running in the pod are sent // a termination signal and the time when the processes are forcibly halted with a kill signal. @@ -211,7 +211,7 @@ type BaseComponentProbe struct { // Value must be non-negative integer. The value zero indicates stop immediately via // the kill signal (no opportunity to shut down). // This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - // Defaults to nil + // Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. // +optional TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"` } @@ -246,7 +246,7 @@ type OptionalHTTPGetAction struct { // Number must be in the range 1 to 65535. // Name must be an IANA_SVC_NAME. // +optional - Port *intstr.IntOrString `json:"port"` + Port *intstr.IntOrString `json:"port,omitempty"` // Host name to connect to, defaults to the pod IP. You probably want to set // "Host" in httpHeaders instead. // +optional diff --git a/common/zz_generated.deepcopy.go b/common/zz_generated.deepcopy.go index 0a2049de..88bed28b 100644 --- a/common/zz_generated.deepcopy.go +++ b/common/zz_generated.deepcopy.go @@ -30,31 +30,6 @@ import ( func (in *BaseComponentProbe) DeepCopyInto(out *BaseComponentProbe) { *out = *in in.BaseComponentProbeHandler.DeepCopyInto(&out.BaseComponentProbeHandler) - if in.InitialDelaySeconds != nil { - in, out := &in.InitialDelaySeconds, &out.InitialDelaySeconds - *out = new(int32) - **out = **in - } - if in.TimeoutSeconds != nil { - in, out := &in.TimeoutSeconds, &out.TimeoutSeconds - *out = new(int32) - **out = **in - } - if in.PeriodSeconds != nil { - in, out := &in.PeriodSeconds, &out.PeriodSeconds - *out = new(int32) - **out = **in - } - if in.SuccessThreshold != nil { - in, out := &in.SuccessThreshold, &out.SuccessThreshold - *out = new(int32) - **out = **in - } - if in.FailureThreshold != nil { - in, out := &in.FailureThreshold, &out.FailureThreshold - *out = new(int32) - **out = **in - } if in.TerminationGracePeriodSeconds != nil { in, out := &in.TerminationGracePeriodSeconds, &out.TerminationGracePeriodSeconds *out = new(int64) diff --git a/config/crd/bases/rc.app.stacks_runtimecomponents.yaml b/config/crd/bases/rc.app.stacks_runtimecomponents.yaml index e3ed73aa..c01dc48a 100644 --- a/config/crd/bases/rc.app.stacks_runtimecomponents.yaml +++ b/config/crd/bases/rc.app.stacks_runtimecomponents.yaml @@ -3062,7 +3062,7 @@ spec: failureThreshold: description: Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to - nil. + 3. Minimum value is 1. format: int32 type: integer grpc: @@ -3135,13 +3135,14 @@ spec: type: integer periodSeconds: description: How often (in seconds) to perform the probe. - Defaults to nil. + Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: description: Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to - nil. + 1. Must be 1 for liveness and startup. Minimum value is + 1. format: int32 type: integer tcpSocket: @@ -3176,12 +3177,14 @@ spec: The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Defaults to nil + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. format: int64 type: integer timeoutSeconds: description: 'Number of seconds after which the probe times - out. Defaults to nil. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' format: int32 type: integer type: object @@ -3208,7 +3211,7 @@ spec: failureThreshold: description: Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to - nil. + 3. Minimum value is 1. format: int32 type: integer grpc: @@ -3281,13 +3284,14 @@ spec: type: integer periodSeconds: description: How often (in seconds) to perform the probe. - Defaults to nil. + Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: description: Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to - nil. + 1. Must be 1 for liveness and startup. Minimum value is + 1. format: int32 type: integer tcpSocket: @@ -3322,12 +3326,14 @@ spec: The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Defaults to nil + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. format: int64 type: integer timeoutSeconds: description: 'Number of seconds after which the probe times - out. Defaults to nil. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' format: int32 type: integer type: object @@ -3355,7 +3361,7 @@ spec: failureThreshold: description: Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to - nil. + 3. Minimum value is 1. format: int32 type: integer grpc: @@ -3428,13 +3434,14 @@ spec: type: integer periodSeconds: description: How often (in seconds) to perform the probe. - Defaults to nil. + Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: description: Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to - nil. + 1. Must be 1 for liveness and startup. Minimum value is + 1. format: int32 type: integer tcpSocket: @@ -3469,12 +3476,14 @@ spec: The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Defaults to nil + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. format: int64 type: integer timeoutSeconds: description: 'Number of seconds after which the probe times - out. Defaults to nil. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' format: int32 type: integer type: object @@ -10417,7 +10426,7 @@ spec: failureThreshold: description: Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to - nil. + 3. Minimum value is 1. format: int32 type: integer grpc: @@ -10490,13 +10499,14 @@ spec: type: integer periodSeconds: description: How often (in seconds) to perform the probe. - Defaults to nil. + Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: description: Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to - nil. + 1. Must be 1 for liveness and startup. Minimum value is + 1. format: int32 type: integer tcpSocket: @@ -10531,12 +10541,14 @@ spec: The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Defaults to nil + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. format: int64 type: integer timeoutSeconds: description: 'Number of seconds after which the probe times - out. Defaults to nil. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' format: int32 type: integer type: object @@ -10563,7 +10575,7 @@ spec: failureThreshold: description: Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to - nil. + 3. Minimum value is 1. format: int32 type: integer grpc: @@ -10636,13 +10648,14 @@ spec: type: integer periodSeconds: description: How often (in seconds) to perform the probe. - Defaults to nil. + Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: description: Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to - nil. + 1. Must be 1 for liveness and startup. Minimum value is + 1. format: int32 type: integer tcpSocket: @@ -10677,12 +10690,14 @@ spec: The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Defaults to nil + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. format: int64 type: integer timeoutSeconds: description: 'Number of seconds after which the probe times - out. Defaults to nil. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' format: int32 type: integer type: object @@ -10710,7 +10725,7 @@ spec: failureThreshold: description: Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to - nil. + 3. Minimum value is 1. format: int32 type: integer grpc: @@ -10783,13 +10798,14 @@ spec: type: integer periodSeconds: description: How often (in seconds) to perform the probe. - Defaults to nil. + Default to 10 seconds. Minimum value is 1. format: int32 type: integer successThreshold: description: Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to - nil. + 1. Must be 1 for liveness and startup. Minimum value is + 1. format: int32 type: integer tcpSocket: @@ -10824,12 +10840,14 @@ spec: The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. - Defaults to nil + Minimum value is 1. spec.terminationGracePeriodSeconds is + used if unset. format: int64 type: integer timeoutSeconds: description: 'Number of seconds after which the probe times - out. Defaults to nil. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' + out. Defaults to 1 second. Minimum value is 1. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes' format: int32 type: integer type: object diff --git a/internal/deploy/kubectl/runtime-component-crd.yaml b/internal/deploy/kubectl/runtime-component-crd.yaml index 73483eca..9dd88d94 100644 --- a/internal/deploy/kubectl/runtime-component-crd.yaml +++ b/internal/deploy/kubectl/runtime-component-crd.yaml @@ -3129,8 +3129,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started @@ -3280,8 +3278,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started @@ -3432,8 +3428,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started @@ -10499,8 +10493,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started @@ -10650,8 +10642,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started @@ -10802,8 +10792,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started diff --git a/internal/deploy/kustomize/daily/base/runtime-component-crd.yaml b/internal/deploy/kustomize/daily/base/runtime-component-crd.yaml index 73483eca..9dd88d94 100644 --- a/internal/deploy/kustomize/daily/base/runtime-component-crd.yaml +++ b/internal/deploy/kustomize/daily/base/runtime-component-crd.yaml @@ -3129,8 +3129,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started @@ -3280,8 +3278,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started @@ -3432,8 +3428,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started @@ -10499,8 +10493,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started @@ -10650,8 +10642,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started @@ -10802,8 +10792,6 @@ spec: description: Scheme to use for connecting to the host. Defaults to HTTP. type: string - required: - - port type: object initialDelaySeconds: description: 'Number of seconds after the container has started diff --git a/utils/utils.go b/utils/utils.go index 4e5c6350..50e6a6da 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -357,25 +357,12 @@ func ConvertToCoreProbe(ba common.BaseComponent, baseProbe *common.BaseComponent if baseProbe.BaseComponentProbeHandler.GRPC != nil { probe.ProbeHandler.GRPC = baseProbe.BaseComponentProbeHandler.GRPC } - - if baseProbe.InitialDelaySeconds != nil && *baseProbe.InitialDelaySeconds != 0 { - probe.InitialDelaySeconds = *baseProbe.InitialDelaySeconds - } - if baseProbe.TimeoutSeconds != nil && *baseProbe.TimeoutSeconds != 0 { - probe.TimeoutSeconds = *baseProbe.TimeoutSeconds - } - if baseProbe.PeriodSeconds != nil && *baseProbe.PeriodSeconds != 0 { - probe.PeriodSeconds = *baseProbe.PeriodSeconds - } - if baseProbe.SuccessThreshold != nil && *baseProbe.SuccessThreshold != 0 { - probe.SuccessThreshold = *baseProbe.SuccessThreshold - } - if baseProbe.FailureThreshold != nil && *baseProbe.FailureThreshold != 0 { - probe.FailureThreshold = *baseProbe.FailureThreshold - } - if baseProbe.TerminationGracePeriodSeconds != nil && *baseProbe.TerminationGracePeriodSeconds != 0 { - probe.TerminationGracePeriodSeconds = baseProbe.TerminationGracePeriodSeconds - } + probe.InitialDelaySeconds = baseProbe.InitialDelaySeconds + probe.TimeoutSeconds = baseProbe.TimeoutSeconds + probe.PeriodSeconds = baseProbe.PeriodSeconds + probe.SuccessThreshold = baseProbe.SuccessThreshold + probe.FailureThreshold = baseProbe.FailureThreshold + probe.TerminationGracePeriodSeconds = baseProbe.TerminationGracePeriodSeconds } return probe } @@ -395,21 +382,11 @@ func customizeProbeDefaults(config *common.BaseComponentProbe, defaultProbe *com if config.BaseComponentProbeHandler.GRPC != nil { probe.BaseComponentProbeHandler.GRPC = config.BaseComponentProbeHandler.GRPC } - if config.InitialDelaySeconds != nil && *config.InitialDelaySeconds != 0 { - probe.InitialDelaySeconds = config.InitialDelaySeconds - } - if config.TimeoutSeconds != nil && *config.TimeoutSeconds != 0 { - probe.TimeoutSeconds = config.TimeoutSeconds - } - if config.PeriodSeconds != nil && *config.PeriodSeconds != 0 { - probe.PeriodSeconds = config.PeriodSeconds - } - if config.SuccessThreshold != nil && *config.SuccessThreshold != 0 { - probe.SuccessThreshold = config.SuccessThreshold - } - if config.FailureThreshold != nil && *config.FailureThreshold != 0 { - probe.FailureThreshold = config.FailureThreshold - } + probe.InitialDelaySeconds = config.InitialDelaySeconds + probe.TimeoutSeconds = config.TimeoutSeconds + probe.PeriodSeconds = config.PeriodSeconds + probe.SuccessThreshold = config.SuccessThreshold + probe.FailureThreshold = config.FailureThreshold } return probe }