diff --git a/lib/resourcemerge/core.go b/lib/resourcemerge/core.go index 9299429c3..3e63bb23e 100644 --- a/lib/resourcemerge/core.go +++ b/lib/resourcemerge/core.go @@ -136,12 +136,8 @@ func ensureContainer(modified *bool, existing *corev1.Container, required corev1 ensureVolumeMount(modified, existingCurr, required) } - if required.LivenessProbe != nil { - ensureProbePtr(modified, &existing.LivenessProbe, required.LivenessProbe) - } - if required.ReadinessProbe != nil { - ensureProbePtr(modified, &existing.ReadinessProbe, required.ReadinessProbe) - } + ensureProbePtr(modified, &existing.LivenessProbe, required.LivenessProbe) + ensureProbePtr(modified, &existing.ReadinessProbe, required.ReadinessProbe) // our security context should always win ensureSecurityContextPtr(modified, &existing.SecurityContext, required.SecurityContext) @@ -168,11 +164,10 @@ func ensureEnvFromSource(modified *bool, existing *[]corev1.EnvFromSource, requi } func ensureProbePtr(modified *bool, existing **corev1.Probe, required *corev1.Probe) { - // if we have no required, then we don't care what someone else has set - if required == nil { + if *existing == nil && required == nil { return } - if *existing == nil { + if *existing == nil || required == nil { *modified = true *existing = required return