func sameLBRuleConfig()

in controllers/manager/gatewaylbconfiguration_controller.go [614:653]


func sameLBRuleConfig(ctx context.Context, lbRule1, lbRule2 *network.LoadBalancingRule) bool {
	log := log.FromContext(ctx)
	equalSubResource := func(s, t *network.SubResource) bool {
		if s == nil && t == nil {
			return true
		}
		if s == nil || t == nil {
			return false
		}
		return strings.EqualFold(to.Val(s.ID), to.Val(t.ID))
	}

	if lbRule1.Properties == nil && lbRule2.Properties == nil {
		return true
	}
	if lbRule1.Properties == nil || lbRule2.Properties == nil {
		return false
	}
	if !equalSubResource(lbRule1.Properties.FrontendIPConfiguration, lbRule2.Properties.FrontendIPConfiguration) {
		log.Info("lb rule frontendIPConfigurations are different")
		return false
	}
	if !equalSubResource(lbRule1.Properties.BackendAddressPool, lbRule2.Properties.BackendAddressPool) {
		log.Info("lb rule backendAddressPools are different")
		return false
	}
	if !equalSubResource(lbRule1.Properties.Probe, lbRule2.Properties.Probe) {
		log.Info("lb rule probes are different")
		return false
	}
	if to.Val(lbRule1.Properties.Protocol) != to.Val(lbRule2.Properties.Protocol) {
		log.Info("lb rule protocols are different")
		return false
	}
	if to.Val(lbRule1.Properties.EnableFloatingIP) != to.Val(lbRule2.Properties.EnableFloatingIP) {
		log.Info("lb rule enableFloatingIPs are different")
		return false
	}
	return true
}