Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pkg/inject/pod_readiness_gate.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ func (m *PodReadinessGate) Mutate(ctx context.Context, pod *corev1.Pod) error {
if !m.config.EnablePodReadinessGateInject {
return nil
}
// legacy readiness gates are removed for maintaining backwards compatibility.
m.removeLegacyTargetHealthReadinessGates(ctx, pod)

// see https://github.com/kubernetes/kubernetes/issues/88282 and https://github.com/kubernetes/kubernetes/issues/76680
req := webhook.ContextGetAdmissionRequest(ctx)
Expand All @@ -48,6 +46,11 @@ func (m *PodReadinessGate) Mutate(ctx context.Context, pod *corev1.Pod) error {
return err
}

if len(targetHealthCondTypes) > 0 {
// legacy readiness gates are removed for maintaining backwards compatibility.
m.removeLegacyTargetHealthReadinessGates(ctx, pod)
}

for _, condType := range targetHealthCondTypes {
if !k8s.IsPodHasReadinessGate(pod, condType) {
pod.Spec.ReadinessGates = append(pod.Spec.ReadinessGates, corev1.PodReadinessGate{
Expand Down