@@ -105,8 +105,13 @@ func (r *IBMPowerVSCluster) validateIBMPowerVSClusterNetwork() *field.Error {
105
105
func (r * IBMPowerVSCluster ) validateIBMPowerVSClusterLoadBalancerNames () (allErrs field.ErrorList ) {
106
106
found := make (map [string ]bool )
107
107
for i , loadbalancer := range r .Spec .LoadBalancers {
108
+ if loadbalancer .Name == "" {
109
+ continue
110
+ }
111
+
108
112
if found [loadbalancer .Name ] {
109
113
allErrs = append (allErrs , field .Duplicate (field .NewPath ("spec" , fmt .Sprintf ("loadbalancers[%d]" , i )), map [string ]interface {}{"Name" : loadbalancer .Name }))
114
+ continue
110
115
}
111
116
found [loadbalancer .Name ] = true
112
117
}
@@ -117,8 +122,12 @@ func (r *IBMPowerVSCluster) validateIBMPowerVSClusterLoadBalancerNames() (allErr
117
122
func (r * IBMPowerVSCluster ) validateIBMPowerVSClusterVPCSubnetNames () (allErrs field.ErrorList ) {
118
123
found := make (map [string ]bool )
119
124
for i , subnet := range r .Spec .VPCSubnets {
125
+ if subnet .Name == nil {
126
+ continue
127
+ }
120
128
if found [* subnet .Name ] {
121
129
allErrs = append (allErrs , field .Duplicate (field .NewPath ("spec" , fmt .Sprintf ("vpcSubnets[%d]" , i )), map [string ]interface {}{"Name" : * subnet .Name }))
130
+ continue
122
131
}
123
132
found [* subnet .Name ] = true
124
133
}
@@ -130,6 +139,9 @@ func (r *IBMPowerVSCluster) validateIBMPowerVSClusterTransitGateway() *field.Err
130
139
if r .Spec .Zone == nil && r .Spec .VPC == nil {
131
140
return nil
132
141
}
142
+ if r .Spec .TransitGateway == nil {
143
+ return nil
144
+ }
133
145
if _ , globalRouting , _ := genUtil .GetTransitGatewayLocationAndRouting (r .Spec .Zone , r .Spec .VPC .Region ); r .Spec .TransitGateway .GlobalRouting != nil && ! * r .Spec .TransitGateway .GlobalRouting && globalRouting != nil && * globalRouting {
134
146
return field .Invalid (field .NewPath ("spec.transitGateway.globalRouting" ), r .Spec .TransitGateway .GlobalRouting , "global routing is required since PowerVS and VPC region are from different region" )
135
147
}
0 commit comments