Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/resourcemerge/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ func ensureProbePtr(modified *bool, existing **corev1.Probe, required *corev1.Pr

func ensureProbe(modified *bool, existing *corev1.Probe, required corev1.Probe) {
setInt32(modified, &existing.InitialDelaySeconds, required.InitialDelaySeconds)
setInt32(modified, &existing.TimeoutSeconds, required.TimeoutSeconds)
setInt32(modified, &existing.PeriodSeconds, required.PeriodSeconds)
setInt32(modified, &existing.SuccessThreshold, required.SuccessThreshold)
setInt32(modified, &existing.FailureThreshold, required.FailureThreshold)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I double-checked the Probe type, and with these four additions we are now completely covering the type. The current master logic is unchanged since probe handling landed in d9f6718 (#7), and that commit doesn't provide motivation for ignoring the properties you're adding here.


ensureProbeHandler(modified, &existing.Handler, required.Handler)
}
Expand Down
92 changes: 92 additions & 0 deletions lib/resourcemerge/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,98 @@ func TestEnsurePodSpec(t *testing.T) {
},
},
},
{
name: "modify container readiness probe",
existing: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "test",
ReadinessProbe: &corev1.Probe{
InitialDelaySeconds: 1,
TimeoutSeconds: 2,
PeriodSeconds: 3,
SuccessThreshold: 4,
FailureThreshold: 5,
},
},
},
},
input: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "test",
ReadinessProbe: &corev1.Probe{
InitialDelaySeconds: 7,
TimeoutSeconds: 8,
PeriodSeconds: 9,
SuccessThreshold: 10,
FailureThreshold: 11,
},
},
},
},
expectedModified: true,
expected: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "test",
ReadinessProbe: &corev1.Probe{
InitialDelaySeconds: 7,
TimeoutSeconds: 8,
PeriodSeconds: 9,
SuccessThreshold: 10,
FailureThreshold: 11,
},
},
},
},
},
{
name: "modify container liveness probe",
existing: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "test",
LivenessProbe: &corev1.Probe{
InitialDelaySeconds: 1,
TimeoutSeconds: 2,
PeriodSeconds: 3,
SuccessThreshold: 4,
FailureThreshold: 5,
},
},
},
},
input: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "test",
LivenessProbe: &corev1.Probe{
InitialDelaySeconds: 7,
TimeoutSeconds: 8,
PeriodSeconds: 9,
SuccessThreshold: 10,
FailureThreshold: 11,
},
},
},
},
expectedModified: true,
expected: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "test",
LivenessProbe: &corev1.Probe{
InitialDelaySeconds: 7,
TimeoutSeconds: 8,
PeriodSeconds: 9,
SuccessThreshold: 10,
FailureThreshold: 11,
},
},
},
},
},
}

for _, test := range tests {
Expand Down