Skip to content

Change check for remove regacy readiness gate #1844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
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