We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f42cf1f commit 2c0e35eCopy full SHA for 2c0e35e
pkg/kube/container/container_test.go
@@ -37,6 +37,13 @@ func TestContainer(t *testing.T) {
37
probes.WithFailureThreshold(15),
38
probes.WithPeriodSeconds(10),
39
)),
40
+ WithStartupProbe(
41
+ probes.Apply(
42
+ probes.WithExecCommand([]string{"startup-exec"}),
43
+ probes.WithFailureThreshold(20),
44
+ probes.WithPeriodSeconds(30),
45
+ ),
46
47
WithResourceRequirements(resourcerequirements.Defaults()),
48
WithCommand([]string{"container-cmd"}),
49
WithEnvs(
@@ -71,6 +78,11 @@ func TestContainer(t *testing.T) {
71
78
assert.Equal(t, int32(10), liveNessProbe.PeriodSeconds)
72
79
assert.Equal(t, "liveness-exec", liveNessProbe.Exec.Command[0])
73
80
81
+ startupProbe := c.StartupProbe
82
+ assert.Equal(t, int32(20), startupProbe.FailureThreshold)
83
+ assert.Equal(t, int32(30), startupProbe.PeriodSeconds)
84
+ assert.Equal(t, "startup-exec", startupProbe.Exec.Command[0])
85
+
74
86
assert.Equal(t, c.Resources, resourcerequirements.Defaults())
75
87
76
88
assert.Len(t, c.Command, 1)
pkg/kube/container/containers.go
@@ -75,12 +75,22 @@ func WithReadinessProbe(probeFunc func(*corev1.Probe)) Modification {
}
77
// WithLivenessProbe modifies the container's Liveness Probe
-func WithLivenessProbe(readinessProbeFunc func(*corev1.Probe)) Modification {
+func WithLivenessProbe(livenessProbeFunc func(*corev1.Probe)) Modification {
return func(container *corev1.Container) {
if container.LivenessProbe == nil {
container.LivenessProbe = &corev1.Probe{}
- readinessProbeFunc(container.LivenessProbe)
+ livenessProbeFunc(container.LivenessProbe)
+ }
+}
+// WithStartupProbe modifies the container's Startup Probe
+func WithStartupProbe(startupProbeFunc func(*corev1.Probe)) Modification {
89
+ return func(container *corev1.Container) {
90
+ if container.StartupProbe == nil {
91
+ container.StartupProbe = &corev1.Probe{}
92
93
+ startupProbeFunc(container.StartupProbe)
94
95
96
0 commit comments