delete pip by matching name and rg

This commit is contained in:
chshou 2017-10-14 22:58:48 -07:00
parent 9054137d05
commit 03730a3e90
2 changed files with 11 additions and 3 deletions

View File

@ -328,11 +328,11 @@ func (az *Cloud) CreateOrUpdateInterfaceWithRetry(nic network.Interface) error {
func (az *Cloud) DeletePublicIPWithRetry(pipName string) error { func (az *Cloud) DeletePublicIPWithRetry(pipName string) error {
return wait.ExponentialBackoff(az.requestBackoff(), func() (bool, error) { return wait.ExponentialBackoff(az.requestBackoff(), func() (bool, error) {
az.operationPollRateLimiter.Accept() az.operationPollRateLimiter.Accept()
glog.V(10).Infof("PublicIPAddressesClient.Delete(%s): start", pipName) glog.V(10).Infof("PublicIPAddressesClient.Delete(%s, %s): start", pipResourceGroup, pipName)
respChan, errChan := az.PublicIPAddressesClient.Delete(az.ResourceGroup, pipName, nil) respChan, errChan := az.PublicIPAddressesClient.Delete(pipResourceGroup, pipName, nil)
resp := <-respChan resp := <-respChan
err := <-errChan err := <-errChan
glog.V(10).Infof("PublicIPAddressesClient.Delete(%s): end", pipName) glog.V(10).Infof("PublicIPAddressesClient.Delete(%s, %s): end", pipResourceGroup, pipName)
return processRetryResponse(resp, err) return processRetryResponse(resp, err)
}) })
} }

View File

@ -1239,6 +1239,14 @@ func findSecurityRule(rules []network.SecurityRule, rule network.SecurityRule) b
return false return false
} }
func (az *Cloud) getPublicIPAddressResourceGroup(service *v1.Service) string {
if resourceGroup, ok := service.Annotations[ServiceAnnotationLoadBalancerPublicIPAddressResourceGroup]; ok {
return resourceGroup
}
return az.ResourceGroup
}
// Check if service requires an internal load balancer. // Check if service requires an internal load balancer.
func requiresInternalLoadBalancer(service *v1.Service) bool { func requiresInternalLoadBalancer(service *v1.Service) bool {
if l, ok := service.Annotations[ServiceAnnotationLoadBalancerInternal]; ok { if l, ok := service.Annotations[ServiceAnnotationLoadBalancerInternal]; ok {