From fa7b5d86e6346d3bdafd5afc250de8e40ea0520c Mon Sep 17 00:00:00 2001 From: Antonio Ojea Date: Fri, 25 Jun 2021 23:18:56 +0200 Subject: [PATCH 1/2] remove duplicate validation on services The rest api for services was validating that, on updates, both the old and new service have the same type. That guarantees that the type is going to be the same after that, thus we don't need to validate the service type on the old and the new service. --- pkg/registry/core/service/storage/rest.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pkg/registry/core/service/storage/rest.go b/pkg/registry/core/service/storage/rest.go index 0faa738e597..a2c1a119bfd 100644 --- a/pkg/registry/core/service/storage/rest.go +++ b/pkg/registry/core/service/storage/rest.go @@ -882,12 +882,6 @@ func isMatchingPreferDualStackClusterIPFields(oldService, service *api.Service) return false } - if oldService.Spec.Type != api.ServiceTypeClusterIP && - oldService.Spec.Type != api.ServiceTypeNodePort && - oldService.Spec.Type != api.ServiceTypeLoadBalancer { - return false - } - // both must be of IPFamilyPolicy==PreferDualStack if service.Spec.IPFamilyPolicy != nil && *(service.Spec.IPFamilyPolicy) != api.IPFamilyPolicyPreferDualStack { return false From 2eb50ee2fd5e5c1db64121359bd5014552ba7858 Mon Sep 17 00:00:00 2001 From: Antonio Ojea Date: Fri, 25 Jun 2021 23:24:49 +0200 Subject: [PATCH 2/2] fix comment on dual-stack integration test --- test/integration/dualstack/dualstack_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/dualstack/dualstack_test.go b/test/integration/dualstack/dualstack_test.go index 4feacacf7fe..16a446a381e 100644 --- a/test/integration/dualstack/dualstack_test.go +++ b/test/integration/dualstack/dualstack_test.go @@ -1661,7 +1661,7 @@ func TestDowngradeServicePreferToDualStack(t *testing.T) { if err != nil { t.Fatalf("Unexpected error to get the service %s %v", svc.Name, err) } - // service should be single stack + // service should remain dual stack if err = validateServiceAndClusterIPFamily(svc, []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol}); err != nil { t.Fatalf("Unexpected error validating the service %s %v", svc.Name, err) }