Skip to content

Commit 63d5047

Browse files
kabicinkabicin
authored andcommitted
Add probe defaults override function to interface
1 parent 7cb344a commit 63d5047

File tree

5 files changed

+88
-61
lines changed

5 files changed

+88
-61
lines changed

api/v1/runtimecomponent_types.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,21 @@ func (p *RuntimeComponentProbes) GetDefaultStartupProbe(ba common.BaseComponent)
566566
return common.GetDefaultMicroProfileStartupProbe(ba)
567567
}
568568

569+
// OverrideDefaultLivenessProbe overrides default values for and returns the liveness probe
570+
func (p *RuntimeComponentProbes) OverrideDefaultLivenessProbe(ba common.BaseComponent, probe *common.BaseComponentProbe) *common.BaseComponentProbe {
571+
return probe
572+
}
573+
574+
// OverrideDefaultReadinessProbe overrides default values for and returns the readiness probe
575+
func (p *RuntimeComponentProbes) OverrideDefaultReadinessProbe(ba common.BaseComponent, probe *common.BaseComponentProbe) *common.BaseComponentProbe {
576+
return probe
577+
}
578+
579+
// OverrideDefaultStartupProbe overrides default values for and returns the startup probe
580+
func (p *RuntimeComponentProbes) OverrideDefaultStartupProbe(ba common.BaseComponent, probe *common.BaseComponentProbe) *common.BaseComponentProbe {
581+
return probe
582+
}
583+
569584
// GetVolumes returns volumes slice
570585
func (cr *RuntimeComponent) GetVolumes() []corev1.Volume {
571586
return cr.Spec.Volumes

api/v1beta2/runtimecomponent_types.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,21 @@ type RuntimeComponentProbes struct {
147147
Startup *common.BaseComponentProbe `json:"startup,omitempty"`
148148
}
149149

150+
// OverrideDefaultLivenessProbe overrides default values for and returns the liveness probe
151+
func (p *RuntimeComponentProbes) OverrideDefaultLivenessProbe(ba common.BaseComponent, probe *common.BaseComponentProbe) *common.BaseComponentProbe {
152+
return probe
153+
}
154+
155+
// OverrideDefaultReadinessProbe overrides default values for and returns the readiness probe
156+
func (p *RuntimeComponentProbes) OverrideDefaultReadinessProbe(ba common.BaseComponent, probe *common.BaseComponentProbe) *common.BaseComponentProbe {
157+
return probe
158+
}
159+
160+
// OverrideDefaultStartupProbe overrides default values for and returns the startup probe
161+
func (p *RuntimeComponentProbes) OverrideDefaultStartupProbe(ba common.BaseComponent, probe *common.BaseComponentProbe) *common.BaseComponentProbe {
162+
return probe
163+
}
164+
150165
func (in *RuntimeComponentProbes) GetDefaultLivenessProbe(ba common.BaseComponent) *common.BaseComponentProbe {
151166
return nil
152167
}

common/types.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,20 +184,20 @@ type BaseComponentProbe struct {
184184
// +optional
185185
InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty"`
186186
// Number of seconds after which the probe times out.
187-
// Defaults to 1 second. Minimum value is 1.
187+
// Defaults to nil.
188188
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
189189
// +optional
190190
TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"`
191191
// How often (in seconds) to perform the probe.
192-
// Default to 10 seconds. Minimum value is 1.
192+
// Defaults to nil.
193193
// +optional
194194
PeriodSeconds *int32 `json:"periodSeconds,omitempty"`
195195
// Minimum consecutive successes for the probe to be considered successful after having failed.
196-
// Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1.
196+
// Defaults to nil.
197197
// +optional
198198
SuccessThreshold *int32 `json:"successThreshold,omitempty"`
199199
// Minimum consecutive failures for the probe to be considered failed after having succeeded.
200-
// Defaults to 3. Minimum value is 1.
200+
// Defaults to nil.
201201
// +optional
202202
FailureThreshold *int32 `json:"failureThreshold,omitempty"`
203203
// Optional duration in seconds the pod needs to terminate gracefully upon probe failure.
@@ -209,7 +209,7 @@ type BaseComponentProbe struct {
209209
// Value must be non-negative integer. The value zero indicates stop immediately via
210210
// the kill signal (no opportunity to shut down).
211211
// This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate.
212-
// Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset.
212+
// Defaults to nil
213213
// +optional
214214
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
215215
}
@@ -265,6 +265,10 @@ type BaseComponentProbes interface {
265265
GetDefaultLivenessProbe(ba BaseComponent) *BaseComponentProbe
266266
GetDefaultReadinessProbe(ba BaseComponent) *BaseComponentProbe
267267
GetDefaultStartupProbe(ba BaseComponent) *BaseComponentProbe
268+
269+
OverrideDefaultLivenessProbe(ba BaseComponent, probe *BaseComponentProbe) *BaseComponentProbe
270+
OverrideDefaultReadinessProbe(ba BaseComponent, probe *BaseComponentProbe) *BaseComponentProbe
271+
OverrideDefaultStartupProbe(ba BaseComponent, probe *BaseComponentProbe) *BaseComponentProbe
268272
}
269273

270274
type BaseComponentServiceAccount interface {

config/crd/bases/rc.app.stacks_runtimecomponents.yaml

Lines changed: 30 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3022,7 +3022,7 @@ spec:
30223022
failureThreshold:
30233023
description: Minimum consecutive failures for the probe to
30243024
be considered failed after having succeeded. Defaults to
3025-
3. Minimum value is 1.
3025+
nil.
30263026
format: int32
30273027
type: integer
30283028
grpc:
@@ -3093,14 +3093,13 @@ spec:
30933093
type: integer
30943094
periodSeconds:
30953095
description: How often (in seconds) to perform the probe.
3096-
Default to 10 seconds. Minimum value is 1.
3096+
Defaults to nil.
30973097
format: int32
30983098
type: integer
30993099
successThreshold:
31003100
description: Minimum consecutive successes for the probe to
31013101
be considered successful after having failed. Defaults to
3102-
1. Must be 1 for liveness and startup. Minimum value is
3103-
1.
3102+
nil.
31043103
format: int32
31053104
type: integer
31063105
tcpSocket:
@@ -3135,14 +3134,12 @@ spec:
31353134
The value zero indicates stop immediately via the kill signal
31363135
(no opportunity to shut down). This is a beta field and
31373136
requires enabling ProbeTerminationGracePeriod feature gate.
3138-
Minimum value is 1. spec.terminationGracePeriodSeconds is
3139-
used if unset.
3137+
Defaults to nil
31403138
format: int64
31413139
type: integer
31423140
timeoutSeconds:
31433141
description: 'Number of seconds after which the probe times
3144-
out. Defaults to 1 second. Minimum value is 1. More info:
3145-
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
3142+
out. Defaults to nil. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
31463143
format: int32
31473144
type: integer
31483145
type: object
@@ -3169,7 +3166,7 @@ spec:
31693166
failureThreshold:
31703167
description: Minimum consecutive failures for the probe to
31713168
be considered failed after having succeeded. Defaults to
3172-
3. Minimum value is 1.
3169+
nil.
31733170
format: int32
31743171
type: integer
31753172
grpc:
@@ -3240,14 +3237,13 @@ spec:
32403237
type: integer
32413238
periodSeconds:
32423239
description: How often (in seconds) to perform the probe.
3243-
Default to 10 seconds. Minimum value is 1.
3240+
Defaults to nil.
32443241
format: int32
32453242
type: integer
32463243
successThreshold:
32473244
description: Minimum consecutive successes for the probe to
32483245
be considered successful after having failed. Defaults to
3249-
1. Must be 1 for liveness and startup. Minimum value is
3250-
1.
3246+
nil.
32513247
format: int32
32523248
type: integer
32533249
tcpSocket:
@@ -3282,14 +3278,12 @@ spec:
32823278
The value zero indicates stop immediately via the kill signal
32833279
(no opportunity to shut down). This is a beta field and
32843280
requires enabling ProbeTerminationGracePeriod feature gate.
3285-
Minimum value is 1. spec.terminationGracePeriodSeconds is
3286-
used if unset.
3281+
Defaults to nil
32873282
format: int64
32883283
type: integer
32893284
timeoutSeconds:
32903285
description: 'Number of seconds after which the probe times
3291-
out. Defaults to 1 second. Minimum value is 1. More info:
3292-
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
3286+
out. Defaults to nil. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
32933287
format: int32
32943288
type: integer
32953289
type: object
@@ -3317,7 +3311,7 @@ spec:
33173311
failureThreshold:
33183312
description: Minimum consecutive failures for the probe to
33193313
be considered failed after having succeeded. Defaults to
3320-
3. Minimum value is 1.
3314+
nil.
33213315
format: int32
33223316
type: integer
33233317
grpc:
@@ -3388,14 +3382,13 @@ spec:
33883382
type: integer
33893383
periodSeconds:
33903384
description: How often (in seconds) to perform the probe.
3391-
Default to 10 seconds. Minimum value is 1.
3385+
Defaults to nil.
33923386
format: int32
33933387
type: integer
33943388
successThreshold:
33953389
description: Minimum consecutive successes for the probe to
33963390
be considered successful after having failed. Defaults to
3397-
1. Must be 1 for liveness and startup. Minimum value is
3398-
1.
3391+
nil.
33993392
format: int32
34003393
type: integer
34013394
tcpSocket:
@@ -3430,14 +3423,12 @@ spec:
34303423
The value zero indicates stop immediately via the kill signal
34313424
(no opportunity to shut down). This is a beta field and
34323425
requires enabling ProbeTerminationGracePeriod feature gate.
3433-
Minimum value is 1. spec.terminationGracePeriodSeconds is
3434-
used if unset.
3426+
Defaults to nil
34353427
format: int64
34363428
type: integer
34373429
timeoutSeconds:
34383430
description: 'Number of seconds after which the probe times
3439-
out. Defaults to 1 second. Minimum value is 1. More info:
3440-
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
3431+
out. Defaults to nil. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
34413432
format: int32
34423433
type: integer
34433434
type: object
@@ -10198,7 +10189,7 @@ spec:
1019810189
failureThreshold:
1019910190
description: Minimum consecutive failures for the probe to
1020010191
be considered failed after having succeeded. Defaults to
10201-
3. Minimum value is 1.
10192+
nil.
1020210193
format: int32
1020310194
type: integer
1020410195
grpc:
@@ -10269,14 +10260,13 @@ spec:
1026910260
type: integer
1027010261
periodSeconds:
1027110262
description: How often (in seconds) to perform the probe.
10272-
Default to 10 seconds. Minimum value is 1.
10263+
Defaults to nil.
1027310264
format: int32
1027410265
type: integer
1027510266
successThreshold:
1027610267
description: Minimum consecutive successes for the probe to
1027710268
be considered successful after having failed. Defaults to
10278-
1. Must be 1 for liveness and startup. Minimum value is
10279-
1.
10269+
nil.
1028010270
format: int32
1028110271
type: integer
1028210272
tcpSocket:
@@ -10311,14 +10301,12 @@ spec:
1031110301
The value zero indicates stop immediately via the kill signal
1031210302
(no opportunity to shut down). This is a beta field and
1031310303
requires enabling ProbeTerminationGracePeriod feature gate.
10314-
Minimum value is 1. spec.terminationGracePeriodSeconds is
10315-
used if unset.
10304+
Defaults to nil
1031610305
format: int64
1031710306
type: integer
1031810307
timeoutSeconds:
1031910308
description: 'Number of seconds after which the probe times
10320-
out. Defaults to 1 second. Minimum value is 1. More info:
10321-
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
10309+
out. Defaults to nil. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
1032210310
format: int32
1032310311
type: integer
1032410312
type: object
@@ -10345,7 +10333,7 @@ spec:
1034510333
failureThreshold:
1034610334
description: Minimum consecutive failures for the probe to
1034710335
be considered failed after having succeeded. Defaults to
10348-
3. Minimum value is 1.
10336+
nil.
1034910337
format: int32
1035010338
type: integer
1035110339
grpc:
@@ -10416,14 +10404,13 @@ spec:
1041610404
type: integer
1041710405
periodSeconds:
1041810406
description: How often (in seconds) to perform the probe.
10419-
Default to 10 seconds. Minimum value is 1.
10407+
Defaults to nil.
1042010408
format: int32
1042110409
type: integer
1042210410
successThreshold:
1042310411
description: Minimum consecutive successes for the probe to
1042410412
be considered successful after having failed. Defaults to
10425-
1. Must be 1 for liveness and startup. Minimum value is
10426-
1.
10413+
nil.
1042710414
format: int32
1042810415
type: integer
1042910416
tcpSocket:
@@ -10458,14 +10445,12 @@ spec:
1045810445
The value zero indicates stop immediately via the kill signal
1045910446
(no opportunity to shut down). This is a beta field and
1046010447
requires enabling ProbeTerminationGracePeriod feature gate.
10461-
Minimum value is 1. spec.terminationGracePeriodSeconds is
10462-
used if unset.
10448+
Defaults to nil
1046310449
format: int64
1046410450
type: integer
1046510451
timeoutSeconds:
1046610452
description: 'Number of seconds after which the probe times
10467-
out. Defaults to 1 second. Minimum value is 1. More info:
10468-
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
10453+
out. Defaults to nil. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
1046910454
format: int32
1047010455
type: integer
1047110456
type: object
@@ -10493,7 +10478,7 @@ spec:
1049310478
failureThreshold:
1049410479
description: Minimum consecutive failures for the probe to
1049510480
be considered failed after having succeeded. Defaults to
10496-
3. Minimum value is 1.
10481+
nil.
1049710482
format: int32
1049810483
type: integer
1049910484
grpc:
@@ -10564,14 +10549,13 @@ spec:
1056410549
type: integer
1056510550
periodSeconds:
1056610551
description: How often (in seconds) to perform the probe.
10567-
Default to 10 seconds. Minimum value is 1.
10552+
Defaults to nil.
1056810553
format: int32
1056910554
type: integer
1057010555
successThreshold:
1057110556
description: Minimum consecutive successes for the probe to
1057210557
be considered successful after having failed. Defaults to
10573-
1. Must be 1 for liveness and startup. Minimum value is
10574-
1.
10558+
nil.
1057510559
format: int32
1057610560
type: integer
1057710561
tcpSocket:
@@ -10606,14 +10590,12 @@ spec:
1060610590
The value zero indicates stop immediately via the kill signal
1060710591
(no opportunity to shut down). This is a beta field and
1060810592
requires enabling ProbeTerminationGracePeriod feature gate.
10609-
Minimum value is 1. spec.terminationGracePeriodSeconds is
10610-
used if unset.
10593+
Defaults to nil
1061110594
format: int64
1061210595
type: integer
1061310596
timeoutSeconds:
1061410597
description: 'Number of seconds after which the probe times
10615-
out. Defaults to 1 second. Minimum value is 1. More info:
10616-
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
10598+
out. Defaults to nil. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
1061710599
format: int32
1061810600
type: integer
1061910601
type: object

0 commit comments

Comments
 (0)