From d38519e2f45d28c2db640ed17ddc83b0c025f663 Mon Sep 17 00:00:00 2001 From: Thibault Richard Date: Tue, 29 Oct 2024 23:08:30 +0100 Subject: [PATCH] Revert explicit check on type to recreate when type changes --- pkg/controller/common/service_control.go | 5 ----- pkg/controller/common/service_control_test.go | 12 ------------ 2 files changed, 17 deletions(-) diff --git a/pkg/controller/common/service_control.go b/pkg/controller/common/service_control.go index 859aa7da77..551552b239 100644 --- a/pkg/controller/common/service_control.go +++ b/pkg/controller/common/service_control.go @@ -88,11 +88,6 @@ func needsUpdate(expected *corev1.Service, reconciled *corev1.Service) bool { // applyServerSideValues applies any default that may have been set from the reconciled version. func applyServerSideValues(expected, reconciled *corev1.Service) { - // shortcut if the service type has changed - if expected.Spec.Type != reconciled.Spec.Type { - return - } - // Type may be defaulted by the api server if expected.Spec.Type == "" { expected.Spec.Type = reconciled.Spec.Type diff --git a/pkg/controller/common/service_control_test.go b/pkg/controller/common/service_control_test.go index cb70e37d74..6404017907 100644 --- a/pkg/controller/common/service_control_test.go +++ b/pkg/controller/common/service_control_test.go @@ -275,18 +275,6 @@ func Test_needsRecreate(t *testing.T) { }, want: true, }, - { - name: "Needs recreate to go from LoadBalancer type to ClusterIP", - args: args{ - expected: corev1.Service{Spec: corev1.ServiceSpec{ - Type: corev1.ServiceTypeClusterIP, - }}, - reconciled: corev1.Service{Spec: corev1.ServiceSpec{ - Type: corev1.ServiceTypeLoadBalancer, - }}, - }, - want: true, - }, { name: "Removing the load balancer class is OK if target type is no longer LoadBalancer", args: args{