add extra case for using update on svc
This commit is contained in:
parent
f0f61dbbf2
commit
d2766b5032
|
|
@ -543,7 +543,8 @@ func (c *Cluster) updateService(role PostgresRole, newService *v1.Service) error
|
||||||
// patch does not work because of LoadBalancerSourceRanges field (even if set to nil)
|
// patch does not work because of LoadBalancerSourceRanges field (even if set to nil)
|
||||||
oldServiceType := c.Services[role].Spec.Type
|
oldServiceType := c.Services[role].Spec.Type
|
||||||
newServiceType := newService.Spec.Type
|
newServiceType := newService.Spec.Type
|
||||||
if newServiceType == "ClusterIP" && newServiceType != oldServiceType {
|
if (newServiceType == "ClusterIP" && newServiceType != oldServiceType) ||
|
||||||
|
newServiceType == "LoadBalancer" && len(newService.Annotations) != len(c.Services[role].Annotations) {
|
||||||
newService.ResourceVersion = c.Services[role].ResourceVersion
|
newService.ResourceVersion = c.Services[role].ResourceVersion
|
||||||
newService.Spec.ClusterIP = c.Services[role].Spec.ClusterIP
|
newService.Spec.ClusterIP = c.Services[role].Spec.ClusterIP
|
||||||
svc, err = c.KubeClient.Services(serviceName.Namespace).Update(context.TODO(), newService, metav1.UpdateOptions{})
|
svc, err = c.KubeClient.Services(serviceName.Namespace).Update(context.TODO(), newService, metav1.UpdateOptions{})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue