in pkg/cloudprovider/vsphere/loadbalancer/config/config_yaml.go [72:112]
func (lbc *LBConfigYAML) validateConfig() error {
if lbc.LoadBalancer.LBServiceID == "" && lbc.LoadBalancer.Tier1GatewayPath == "" {
msg := "either load balancer service id or T1 gateway path required"
klog.Errorf(msg)
return fmt.Errorf(msg)
}
if lbc.LoadBalancer.TCPAppProfileName == "" && lbc.LoadBalancer.TCPAppProfilePath == "" {
msg := "either load balancer TCP application profile name or path required"
klog.Errorf(msg)
return fmt.Errorf(msg)
}
if lbc.LoadBalancer.UDPAppProfileName == "" && lbc.LoadBalancer.UDPAppProfilePath == "" {
msg := "either load balancer UDP application profile name or path required"
klog.Errorf(msg)
return fmt.Errorf(msg)
}
if !LoadBalancerSizes.Has(lbc.LoadBalancer.Size) {
msg := fmt.Sprintf("load balancer size is invalid. Valid values are: %s", strings.Join(LoadBalancerSizes.List(), ","))
klog.Errorf(msg)
return fmt.Errorf(msg)
}
if lbc.LoadBalancer.IPPoolID == "" && lbc.LoadBalancer.IPPoolName == "" {
class, ok := lbc.LoadBalancerClass[DefaultLoadBalancerClass]
if !ok {
msg := "no default load balancer class defined"
klog.Errorf(msg)
return fmt.Errorf(msg)
} else if class.IPPoolName == "" && class.IPPoolID == "" {
msg := "default load balancer class: ipPoolName and ipPoolID is empty"
klog.Errorf(msg)
return fmt.Errorf(msg)
}
} else {
if lbc.LoadBalancer.IPPoolName != "" && lbc.LoadBalancer.IPPoolID != "" {
msg := "either load balancer ipPoolName or ipPoolID can be set"
klog.Errorf(msg)
return fmt.Errorf(msg)
}
}
return nil
}