mirror of https://github.com/k3s-io/k3s
Merge pull request #68609 from feiskyer/fix-63172
Fix potential panic when getting azure load balancer statuspull/8/head
commit
4ab85e77d3
|
@ -371,8 +371,8 @@ func (az *Cloud) getServiceLoadBalancerStatus(service *v1.Service, lb *network.L
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(2).Infof("getServiceLoadBalancerStatus gets ingress IP %q from frontendIPConfiguration %q for service %q", *lbIP, lbFrontendIPConfigName, serviceName)
|
glog.V(2).Infof("getServiceLoadBalancerStatus gets ingress IP %q from frontendIPConfiguration %q for service %q", to.String(lbIP), lbFrontendIPConfigName, serviceName)
|
||||||
return &v1.LoadBalancerStatus{Ingress: []v1.LoadBalancerIngress{{IP: *lbIP}}}, nil
|
return &v1.LoadBalancerStatus{Ingress: []v1.LoadBalancerIngress{{IP: to.String(lbIP)}}}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1199,13 +1199,13 @@ func findIndex(strs []string, s string) (int, bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func allowsConsolidation(rule network.SecurityRule) bool {
|
func allowsConsolidation(rule network.SecurityRule) bool {
|
||||||
return strings.HasPrefix(*rule.Name, "shared")
|
return strings.HasPrefix(to.String(rule.Name), "shared")
|
||||||
}
|
}
|
||||||
|
|
||||||
func findConsolidationCandidate(rules []network.SecurityRule, rule network.SecurityRule) (int, bool) {
|
func findConsolidationCandidate(rules []network.SecurityRule, rule network.SecurityRule) (int, bool) {
|
||||||
for index, r := range rules {
|
for index, r := range rules {
|
||||||
if allowsConsolidation(r) {
|
if allowsConsolidation(r) {
|
||||||
if strings.EqualFold(*r.Name, *rule.Name) {
|
if strings.EqualFold(to.String(r.Name), to.String(rule.Name)) {
|
||||||
return index, true
|
return index, true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1365,7 +1365,7 @@ func (az *Cloud) reconcilePublicIP(clusterName string, service *v1.Service, want
|
||||||
|
|
||||||
func findProbe(probes []network.Probe, probe network.Probe) bool {
|
func findProbe(probes []network.Probe, probe network.Probe) bool {
|
||||||
for _, existingProbe := range probes {
|
for _, existingProbe := range probes {
|
||||||
if strings.EqualFold(*existingProbe.Name, *probe.Name) && *existingProbe.Port == *probe.Port {
|
if strings.EqualFold(to.String(existingProbe.Name), to.String(probe.Name)) && to.Int32(existingProbe.Port) == to.Int32(probe.Port) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1374,7 +1374,7 @@ func findProbe(probes []network.Probe, probe network.Probe) bool {
|
||||||
|
|
||||||
func findRule(rules []network.LoadBalancingRule, rule network.LoadBalancingRule) bool {
|
func findRule(rules []network.LoadBalancingRule, rule network.LoadBalancingRule) bool {
|
||||||
for _, existingRule := range rules {
|
for _, existingRule := range rules {
|
||||||
if strings.EqualFold(*existingRule.Name, *rule.Name) &&
|
if strings.EqualFold(to.String(existingRule.Name), to.String(rule.Name)) &&
|
||||||
equalLoadBalancingRulePropertiesFormat(existingRule.LoadBalancingRulePropertiesFormat, rule.LoadBalancingRulePropertiesFormat) {
|
equalLoadBalancingRulePropertiesFormat(existingRule.LoadBalancingRulePropertiesFormat, rule.LoadBalancingRulePropertiesFormat) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -1405,23 +1405,23 @@ func equalLoadBalancingRulePropertiesFormat(s, t *network.LoadBalancingRulePrope
|
||||||
// despite different DestinationAddressPrefixes, in order to give it a chance to consolidate the two rules.
|
// despite different DestinationAddressPrefixes, in order to give it a chance to consolidate the two rules.
|
||||||
func findSecurityRule(rules []network.SecurityRule, rule network.SecurityRule) bool {
|
func findSecurityRule(rules []network.SecurityRule, rule network.SecurityRule) bool {
|
||||||
for _, existingRule := range rules {
|
for _, existingRule := range rules {
|
||||||
if !strings.EqualFold(*existingRule.Name, *rule.Name) {
|
if !strings.EqualFold(to.String(existingRule.Name), to.String(rule.Name)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if existingRule.Protocol != rule.Protocol {
|
if existingRule.Protocol != rule.Protocol {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !strings.EqualFold(*existingRule.SourcePortRange, *rule.SourcePortRange) {
|
if !strings.EqualFold(to.String(existingRule.SourcePortRange), to.String(rule.SourcePortRange)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !strings.EqualFold(*existingRule.DestinationPortRange, *rule.DestinationPortRange) {
|
if !strings.EqualFold(to.String(existingRule.DestinationPortRange), to.String(rule.DestinationPortRange)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !strings.EqualFold(*existingRule.SourceAddressPrefix, *rule.SourceAddressPrefix) {
|
if !strings.EqualFold(to.String(existingRule.SourceAddressPrefix), to.String(rule.SourceAddressPrefix)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !allowsConsolidation(existingRule) && !allowsConsolidation(rule) {
|
if !allowsConsolidation(existingRule) && !allowsConsolidation(rule) {
|
||||||
if !strings.EqualFold(*existingRule.DestinationAddressPrefix, *rule.DestinationAddressPrefix) {
|
if !strings.EqualFold(to.String(existingRule.DestinationAddressPrefix), to.String(rule.DestinationAddressPrefix)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue