"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "staging/src/k8s.io/legacy-cloud-providers/azure/azure_loadbalancer.go" between
kubernetes-1.15.9.tar.gz and kubernetes-1.15.10.tar.gz

About: Kubernetes is a platform for automating deployment, scaling, and operations of application containers across clusters of hosts (written in "Go"). 1.15.x series.

azure_loadbalancer.go  (kubernetes-1.15.9):azure_loadbalancer.go  (kubernetes-1.15.10)
skipping to change at line 129 skipping to change at line 129
if !existsLb && !existsPip { if !existsLb && !existsPip {
serviceName := getServiceName(service) serviceName := getServiceName(service)
klog.V(5).Infof("getloadbalancer (cluster:%s) (service:%s) - does n't exist", clusterName, serviceName) klog.V(5).Infof("getloadbalancer (cluster:%s) (service:%s) - does n't exist", clusterName, serviceName)
return nil, false, nil return nil, false, nil
} }
// Return exists = true if either the load balancer or the public IP (or both) exists // Return exists = true if either the load balancer or the public IP (or both) exists
return status, true, nil return status, true, nil
} }
func getPublicIPDomainNameLabel(service *v1.Service) string { func getPublicIPDomainNameLabel(service *v1.Service) (string, bool) {
if labelName, found := service.Annotations[ServiceAnnotationDNSLabelName] ; found { if labelName, found := service.Annotations[ServiceAnnotationDNSLabelName] ; found {
return labelName return labelName, found
} }
return "" return "", false
} }
// EnsureLoadBalancer creates a new load balancer 'name', or updates the existin g one. Returns the status of the balancer // EnsureLoadBalancer creates a new load balancer 'name', or updates the existin g one. Returns the status of the balancer
func (az *Cloud) EnsureLoadBalancer(ctx context.Context, clusterName string, ser vice *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error) { func (az *Cloud) EnsureLoadBalancer(ctx context.Context, clusterName string, ser vice *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error) {
// When a client updates the internal load balancer annotation, // When a client updates the internal load balancer annotation,
// the service may be switched from an internal LB to a public one, or vi se versa. // the service may be switched from an internal LB to a public one, or vi se versa.
// Here we'll firstly ensure service do not lie in the opposite LB. // Here we'll firstly ensure service do not lie in the opposite LB.
serviceName := getServiceName(service) serviceName := getServiceName(service)
klog.V(5).Infof("ensureloadbalancer(%s): START clusterName=%q", serviceNa me, clusterName) klog.V(5).Infof("ensureloadbalancer(%s): START clusterName=%q", serviceNa me, clusterName)
skipping to change at line 494 skipping to change at line 494
return "", nil return "", nil
} }
if len(lbStatus.Ingress) < 1 { if len(lbStatus.Ingress) < 1 {
klog.V(2).Infof("Expected to find an IP address for service %s bu t it had no ingresses. Assuming it has been removed", service.Name) klog.V(2).Infof("Expected to find an IP address for service %s bu t it had no ingresses. Assuming it has been removed", service.Name)
return "", nil return "", nil
} }
return lbStatus.Ingress[0].IP, nil return lbStatus.Ingress[0].IP, nil
} }
func (az *Cloud) ensurePublicIPExists(service *v1.Service, pipName string, domai nNameLabel, clusterName string, shouldPIPExisted bool) (*network.PublicIPAddress , error) { func (az *Cloud) ensurePublicIPExists(service *v1.Service, pipName string, domai nNameLabel, clusterName string, shouldPIPExisted, foundDNSLabelAnnotation bool) (*network.PublicIPAddress, error) {
pipResourceGroup := az.getPublicIPAddressResourceGroup(service) pipResourceGroup := az.getPublicIPAddressResourceGroup(service)
pip, existsPip, err := az.getPublicIPAddress(pipResourceGroup, pipName) pip, existsPip, err := az.getPublicIPAddress(pipResourceGroup, pipName)
if err != nil { if err != nil {
return nil, err return nil, err
} }
serviceName := getServiceName(service) serviceName := getServiceName(service)
if existsPip { if existsPip {
// return if pip exist and dns label is the same // return if pip exist and dns label is the same
skipping to change at line 534 skipping to change at line 534
serviceTagKey: &serviceName, serviceTagKey: &serviceName,
clusterNameKey: &clusterName, clusterNameKey: &clusterName,
} }
if az.useStandardLoadBalancer() { if az.useStandardLoadBalancer() {
pip.Sku = &network.PublicIPAddressSku{ pip.Sku = &network.PublicIPAddressSku{
Name: network.PublicIPAddressSkuNameStandard, Name: network.PublicIPAddressSkuNameStandard,
} }
} }
klog.V(2).Infof("ensurePublicIPExists for service(%s): pip(%s) - creating", serviceName, *pip.Name) klog.V(2).Infof("ensurePublicIPExists for service(%s): pip(%s) - creating", serviceName, *pip.Name)
} }
if len(domainNameLabel) == 0 { if foundDNSLabelAnnotation {
pip.PublicIPAddressPropertiesFormat.DNSSettings = nil if len(domainNameLabel) == 0 {
} else { pip.PublicIPAddressPropertiesFormat.DNSSettings = nil
pip.PublicIPAddressPropertiesFormat.DNSSettings = &network.Public } else {
IPAddressDNSSettings{ pip.PublicIPAddressPropertiesFormat.DNSSettings = &networ
DomainNameLabel: &domainNameLabel, k.PublicIPAddressDNSSettings{
DomainNameLabel: &domainNameLabel,
}
} }
} }
klog.V(10).Infof("CreateOrUpdatePIP(%s, %q): start", pipResourceGroup, *p ip.Name) klog.V(10).Infof("CreateOrUpdatePIP(%s, %q): start", pipResourceGroup, *p ip.Name)
err = az.CreateOrUpdatePIP(service, pipResourceGroup, pip) err = az.CreateOrUpdatePIP(service, pipResourceGroup, pip)
if err != nil { if err != nil {
klog.V(2).Infof("ensure(%s) abort backoff: pip(%s)", serviceName, *pip.Name) klog.V(2).Infof("ensure(%s) abort backoff: pip(%s)", serviceName, *pip.Name)
return nil, err return nil, err
} }
klog.V(10).Infof("CreateOrUpdatePIP(%s, %q): end", pipResourceGroup, *pip .Name) klog.V(10).Infof("CreateOrUpdatePIP(%s, %q): end", pipResourceGroup, *pip .Name)
skipping to change at line 765 skipping to change at line 767
// We'll need to call GetLoadBalancer lat er to retrieve allocated IP. // We'll need to call GetLoadBalancer lat er to retrieve allocated IP.
configProperties.PrivateIPAllocationMetho d = network.Dynamic configProperties.PrivateIPAllocationMetho d = network.Dynamic
} }
fipConfigurationProperties = &configProperties fipConfigurationProperties = &configProperties
} else { } else {
pipName, shouldPIPExisted, err := az.determinePub licIPName(clusterName, service) pipName, shouldPIPExisted, err := az.determinePub licIPName(clusterName, service)
if err != nil { if err != nil {
return nil, err return nil, err
} }
domainNameLabel := getPublicIPDomainNameLabel(ser domainNameLabel, found := getPublicIPDomainNameLa
vice) bel(service)
pip, err := az.ensurePublicIPExists(service, pipN pip, err := az.ensurePublicIPExists(service, pipN
ame, domainNameLabel, clusterName, shouldPIPExisted) ame, domainNameLabel, clusterName, shouldPIPExisted, found)
if err != nil { if err != nil {
return nil, err return nil, err
} }
fipConfigurationProperties = &network.FrontendIPC onfigurationPropertiesFormat{ fipConfigurationProperties = &network.FrontendIPC onfigurationPropertiesFormat{
PublicIPAddress: &network.PublicIPAddress {ID: pip.ID}, PublicIPAddress: &network.PublicIPAddress {ID: pip.ID},
} }
} }
newConfigs = append(newConfigs, newConfigs = append(newConfigs,
network.FrontendIPConfiguration{ network.FrontendIPConfiguration{
skipping to change at line 1436 skipping to change at line 1438
} }
klog.V(2).Infof("reconcilePublicIP for service(%s ): pip(%s) - finished", serviceName, pipName) klog.V(2).Infof("reconcilePublicIP for service(%s ): pip(%s) - finished", serviceName, pipName)
} }
} }
} }
if !isInternal && wantLb { if !isInternal && wantLb {
// Confirm desired public ip resource exists // Confirm desired public ip resource exists
var pip *network.PublicIPAddress var pip *network.PublicIPAddress
domainNameLabel := getPublicIPDomainNameLabel(service) domainNameLabel, found := getPublicIPDomainNameLabel(service)
if pip, err = az.ensurePublicIPExists(service, desiredPipName, do if pip, err = az.ensurePublicIPExists(service, desiredPipName, do
mainNameLabel, clusterName, shouldPIPExisted); err != nil { mainNameLabel, clusterName, shouldPIPExisted, found); err != nil {
return nil, err return nil, err
} }
return pip, nil return pip, nil
} }
return nil, nil return nil, nil
} }
// safeDeletePublicIP deletes public IP by removing its reference first. // safeDeletePublicIP deletes public IP by removing its reference first.
func (az *Cloud) safeDeletePublicIP(service *v1.Service, pipResourceGroup string , pip *network.PublicIPAddress, lb *network.LoadBalancer) error { func (az *Cloud) safeDeletePublicIP(service *v1.Service, pipResourceGroup string , pip *network.PublicIPAddress, lb *network.LoadBalancer) error {
// Remove references if pip.IPConfiguration is not nil. // Remove references if pip.IPConfiguration is not nil.
 End of changes. 7 change blocks. 
17 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)