Skip to content

Commit df29e8d

Browse files
committed
Simplify ProbeHandler type
1 parent 515464e commit df29e8d

File tree

9 files changed

+82
-159
lines changed

9 files changed

+82
-159
lines changed

bundle/manifests/rc.app.stacks_runtimecomponents.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3056,8 +3056,6 @@ spec:
30563056
description: Scheme to use for connecting to the host.
30573057
Defaults to HTTP.
30583058
type: string
3059-
required:
3060-
- port
30613059
type: object
30623060
initialDelaySeconds:
30633061
description: 'Number of seconds after the container has started
@@ -3205,8 +3203,6 @@ spec:
32053203
description: Scheme to use for connecting to the host.
32063204
Defaults to HTTP.
32073205
type: string
3208-
required:
3209-
- port
32103206
type: object
32113207
initialDelaySeconds:
32123208
description: 'Number of seconds after the container has started
@@ -3355,8 +3351,6 @@ spec:
33553351
description: Scheme to use for connecting to the host.
33563352
Defaults to HTTP.
33573353
type: string
3358-
required:
3359-
- port
33603354
type: object
33613355
initialDelaySeconds:
33623356
description: 'Number of seconds after the container has started
@@ -10009,8 +10003,6 @@ spec:
1000910003
description: Scheme to use for connecting to the host.
1001010004
Defaults to HTTP.
1001110005
type: string
10012-
required:
10013-
- port
1001410006
type: object
1001510007
initialDelaySeconds:
1001610008
description: 'Number of seconds after the container has started
@@ -10158,8 +10150,6 @@ spec:
1015810150
description: Scheme to use for connecting to the host.
1015910151
Defaults to HTTP.
1016010152
type: string
10161-
required:
10162-
- port
1016310153
type: object
1016410154
initialDelaySeconds:
1016510155
description: 'Number of seconds after the container has started
@@ -10308,8 +10298,6 @@ spec:
1030810298
description: Scheme to use for connecting to the host.
1030910299
Defaults to HTTP.
1031010300
type: string
10311-
required:
10312-
- port
1031310301
type: object
1031410302
initialDelaySeconds:
1031510303
description: 'Number of seconds after the container has started

bundle/manifests/runtime-component.clusterserviceversion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ metadata:
6868
categories: Application Runtime
6969
certified: "true"
7070
containerImage: icr.io/appcafe/runtime-component-operator:daily
71-
createdAt: "2023-06-29T16:02:23Z"
71+
createdAt: "2023-10-05T15:42:54Z"
7272
description: Deploys any runtime component with dynamic and auto-tuning configuration
7373
olm.skipRange: '>=0.8.0 <1.2.1'
7474
operators.openshift.io/infrastructure-features: '["disconnected"]'

common/common.go

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ import (
77
// GetDefaultMicroProfileStartupProbe returns the default values for MicroProfile Health-based startup probe.
88
func GetDefaultMicroProfileStartupProbe(ba BaseComponent) *BaseComponentProbe {
99
port := intstr.FromInt(int(ba.GetService().GetPort()))
10-
periodSeconds := int32(10)
11-
timeoutSeconds := int32(2)
12-
failureThreshold := int32(20)
1310
return &BaseComponentProbe{
1411
BaseComponentProbeHandler: BaseComponentProbeHandler{
1512
HTTPGet: &OptionalHTTPGetAction{
@@ -18,19 +15,15 @@ func GetDefaultMicroProfileStartupProbe(ba BaseComponent) *BaseComponentProbe {
1815
Scheme: "HTTPS",
1916
},
2017
},
21-
PeriodSeconds: &periodSeconds,
22-
TimeoutSeconds: &timeoutSeconds,
23-
FailureThreshold: &failureThreshold,
18+
PeriodSeconds: 10,
19+
TimeoutSeconds: 2,
20+
FailureThreshold: 20,
2421
}
2522
}
2623

2724
// GetDefaultMicroProfileReadinessProbe returns the default values for MicroProfile Health-based readiness probe.
2825
func GetDefaultMicroProfileReadinessProbe(ba BaseComponent) *BaseComponentProbe {
2926
port := intstr.FromInt(int(ba.GetService().GetPort()))
30-
initialDelaySeconds := int32(10)
31-
periodSeconds := int32(10)
32-
timeoutSeconds := int32(2)
33-
failureThreshold := int32(20)
3427
return &BaseComponentProbe{
3528
BaseComponentProbeHandler: BaseComponentProbeHandler{
3629
HTTPGet: &OptionalHTTPGetAction{
@@ -39,20 +32,16 @@ func GetDefaultMicroProfileReadinessProbe(ba BaseComponent) *BaseComponentProbe
3932
Scheme: "HTTPS",
4033
},
4134
},
42-
InitialDelaySeconds: &initialDelaySeconds,
43-
PeriodSeconds: &periodSeconds,
44-
TimeoutSeconds: &timeoutSeconds,
45-
FailureThreshold: &failureThreshold,
35+
InitialDelaySeconds: 10,
36+
PeriodSeconds: 10,
37+
TimeoutSeconds: 2,
38+
FailureThreshold: 10,
4639
}
4740
}
4841

4942
// GetDefaultMicroProfileLivenessProbe returns the default values for MicroProfile Health-based liveness probe.
5043
func GetDefaultMicroProfileLivenessProbe(ba BaseComponent) *BaseComponentProbe {
5144
port := intstr.FromInt(int(ba.GetService().GetPort()))
52-
initialDelaySeconds := int32(60)
53-
periodSeconds := int32(10)
54-
timeoutSeconds := int32(2)
55-
failureThreshold := int32(3)
5645
return &BaseComponentProbe{
5746
BaseComponentProbeHandler: BaseComponentProbeHandler{
5847
HTTPGet: &OptionalHTTPGetAction{
@@ -61,10 +50,10 @@ func GetDefaultMicroProfileLivenessProbe(ba BaseComponent) *BaseComponentProbe {
6150
Scheme: "HTTPS",
6251
},
6352
},
64-
InitialDelaySeconds: &initialDelaySeconds,
65-
PeriodSeconds: &periodSeconds,
66-
TimeoutSeconds: &timeoutSeconds,
67-
FailureThreshold: &failureThreshold,
53+
InitialDelaySeconds: 60,
54+
PeriodSeconds: 10,
55+
TimeoutSeconds: 2,
56+
FailureThreshold: 3,
6857
}
6958
}
7059

common/types.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,24 +183,24 @@ type BaseComponentProbe struct {
183183
// Number of seconds after the container has started before liveness probes are initiated.
184184
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
185185
// +optional
186-
InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty"`
186+
InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"`
187187
// Number of seconds after which the probe times out.
188-
// Defaults to nil.
188+
// Defaults to 1 second. Minimum value is 1.
189189
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
190190
// +optional
191-
TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"`
191+
TimeoutSeconds int32 `json:"timeoutSeconds,omitempty"`
192192
// How often (in seconds) to perform the probe.
193-
// Defaults to nil.
193+
// Default to 10 seconds. Minimum value is 1.
194194
// +optional
195-
PeriodSeconds *int32 `json:"periodSeconds,omitempty"`
195+
PeriodSeconds int32 `json:"periodSeconds,omitempty"`
196196
// Minimum consecutive successes for the probe to be considered successful after having failed.
197-
// Defaults to nil.
197+
// Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1.
198198
// +optional
199-
SuccessThreshold *int32 `json:"successThreshold,omitempty"`
199+
SuccessThreshold int32 `json:"successThreshold,omitempty"`
200200
// Minimum consecutive failures for the probe to be considered failed after having succeeded.
201-
// Defaults to nil.
201+
// Defaults to 3. Minimum value is 1.
202202
// +optional
203-
FailureThreshold *int32 `json:"failureThreshold,omitempty"`
203+
FailureThreshold int32 `json:"failureThreshold,omitempty"`
204204
// Optional duration in seconds the pod needs to terminate gracefully upon probe failure.
205205
// The grace period is the duration in seconds after the processes running in the pod are sent
206206
// a termination signal and the time when the processes are forcibly halted with a kill signal.
@@ -210,7 +210,7 @@ type BaseComponentProbe struct {
210210
// Value must be non-negative integer. The value zero indicates stop immediately via
211211
// the kill signal (no opportunity to shut down).
212212
// This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate.
213-
// Defaults to nil
213+
// Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset.
214214
// +optional
215215
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
216216
}
@@ -245,7 +245,7 @@ type OptionalHTTPGetAction struct {
245245
// Number must be in the range 1 to 65535.
246246
// Name must be an IANA_SVC_NAME.
247247
// +optional
248-
Port *intstr.IntOrString `json:"port"`
248+
Port *intstr.IntOrString `json:"port,omitempty"`
249249
// Host name to connect to, defaults to the pod IP. You probably want to set
250250
// "Host" in httpHeaders instead.
251251
// +optional

common/zz_generated.deepcopy.go

Lines changed: 0 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)