From bf28a9be09197e6fbcc0f7d68def60241e825ce7 Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Mon, 23 Jan 2017 13:27:32 +0100 Subject: [PATCH] Set NetworkInterfaces and Subnets to nil before updating Azure security groups --- pkg/cloudprovider/providers/azure/azure_loadbalancer.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/cloudprovider/providers/azure/azure_loadbalancer.go b/pkg/cloudprovider/providers/azure/azure_loadbalancer.go index 1f4c1e0c0fe..5fef48181c6 100644 --- a/pkg/cloudprovider/providers/azure/azure_loadbalancer.go +++ b/pkg/cloudprovider/providers/azure/azure_loadbalancer.go @@ -83,6 +83,10 @@ func (az *Cloud) EnsureLoadBalancer(clusterName string, service *v1.Service, nod } if sgNeedsUpdate { glog.V(3).Infof("ensure(%s): sg(%s) - updating", serviceName, *sg.Name) + // azure-sdk-for-go introduced contraint validation which breaks the updating here if we don't set these + // to nil. This is a workaround until https://github.com/Azure/go-autorest/issues/112 is fixed + sg.SecurityGroupPropertiesFormat.NetworkInterfaces = nil + sg.SecurityGroupPropertiesFormat.Subnets = nil _, err := az.SecurityGroupsClient.CreateOrUpdate(az.ResourceGroup, *sg.Name, sg, nil) if err != nil { return nil, err @@ -200,6 +204,10 @@ func (az *Cloud) EnsureLoadBalancerDeleted(clusterName string, service *v1.Servi } if sgNeedsUpdate { glog.V(3).Infof("delete(%s): sg(%s) - updating", serviceName, az.SecurityGroupName) + // azure-sdk-for-go introduced contraint validation which breaks the updating here if we don't set these + // to nil. This is a workaround until https://github.com/Azure/go-autorest/issues/112 is fixed + sg.SecurityGroupPropertiesFormat.NetworkInterfaces = nil + sg.SecurityGroupPropertiesFormat.Subnets = nil _, err := az.SecurityGroupsClient.CreateOrUpdate(az.ResourceGroup, *reconciledSg.Name, reconciledSg, nil) if err != nil { return err