From d3cf93b5cfa751231730258a95330eeebaf40862 Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Thu, 13 Feb 2020 12:11:36 +0100 Subject: [PATCH] wait longer for service update --- e2e/tests/test_e2e.py | 6 ++---- pkg/cluster/resources.go | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/e2e/tests/test_e2e.py b/e2e/tests/test_e2e.py index a170059cb..33ef1ed21 100644 --- a/e2e/tests/test_e2e.py +++ b/e2e/tests/test_e2e.py @@ -77,7 +77,7 @@ class EndToEndTestCase(unittest.TestCase): k8s.api.custom_objects_api.patch_namespaced_custom_object( "acid.zalan.do", "v1", "default", "postgresqls", "acid-minimal-cluster", pg_patch_enable_lbs) # wait for service recreation - time.sleep(10) + time.sleep(30) master_svc_type = k8s.get_service_type(cluster_label + ',spilo-role=master') self.assertEqual(master_svc_type, 'LoadBalancer', @@ -97,7 +97,7 @@ class EndToEndTestCase(unittest.TestCase): k8s.api.custom_objects_api.patch_namespaced_custom_object( "acid.zalan.do", "v1", "default", "postgresqls", "acid-minimal-cluster", pg_patch_disable_lbs) # wait for service recreation - time.sleep(10) + time.sleep(30) master_svc_type = k8s.get_service_type(cluster_label + ',spilo-role=master') self.assertEqual(master_svc_type, 'ClusterIP', @@ -107,7 +107,6 @@ class EndToEndTestCase(unittest.TestCase): self.assertEqual(repl_svc_type, 'ClusterIP', "Expected ClusterIP service type for replica, found {}".format(repl_svc_type)) - """ @timeout_decorator.timeout(TEST_TIMEOUT_SEC) def test_min_resource_limits(self): ''' @@ -337,7 +336,6 @@ class EndToEndTestCase(unittest.TestCase): } } k8s.update_config(unpatch_custom_service_annotations) - """ def assert_master_is_unique(self, namespace='default', version="acid-minimal-cluster"): ''' diff --git a/pkg/cluster/resources.go b/pkg/cluster/resources.go index b27e65235..d6c2149bf 100644 --- a/pkg/cluster/resources.go +++ b/pkg/cluster/resources.go @@ -395,7 +395,8 @@ func (c *Cluster) updateService(role PostgresRole, newService *v1.Service) error } } - // when disabling LoadBalancers patch does not work because of LoadBalancerSourceRanges field (even if nil) + // now, patch the service spec, but when disabling LoadBalancers do update instead + // patch does not work because of LoadBalancerSourceRanges field (even if set to nil) oldServiceType := c.Services[role].Spec.Type newServiceType := newService.Spec.Type if newServiceType == "ClusterIP" && newServiceType != oldServiceType { @@ -411,7 +412,6 @@ func (c *Cluster) updateService(role PostgresRole, newService *v1.Service) error return fmt.Errorf("could not form patch for the service %q: %v", serviceName, err) } - // update the service spec svc, err = c.KubeClient.Services(serviceName.Namespace).Patch( serviceName.Name, types.MergePatchType,