Skip to content

Commit 98bd3c5

Browse files
authored
NSX: (temp fix) Skip adding firewall rules for CKS Clusters on VPC tiers (#56)
Currently CKP does not setup NetworkACLs for CKS clusters on VPC tiers, and fails to add Firewall rules - as Firewall isn't supported on VPCs. This is a partial fix, to skip setting up Firewall rules if the network doesn't support the service.
1 parent a0469bc commit 98bd3c5

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

cloudstack_loadbalancer.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,15 @@ func (cs *CSCloud) EnsureLoadBalancer(ctx context.Context, clusterName string, s
163163
}
164164
}
165165

166-
if lbRule != nil {
166+
network, count, err := lb.Network.GetNetworkByID(lb.networkID, cloudstack.WithProject(lb.projectID))
167+
if err != nil {
168+
if count == 0 {
169+
return nil, err
170+
}
171+
return nil, err
172+
}
173+
174+
if lbRule != nil && isFirewallSupported(network.Service) {
167175
klog.V(4).Infof("Creating firewall rules for load balancer rule: %v (%v:%v:%v)", lbRuleName, protocol, lbRule.Publicip, port.Port)
168176
if _, err := lb.updateFirewallRule(lbRule.Publicipid, int(port.Port), protocol, service.Spec.LoadBalancerSourceRanges); err != nil {
169177
return nil, err
@@ -244,6 +252,15 @@ func (cs *CSCloud) UpdateLoadBalancer(ctx context.Context, clusterName string, s
244252
return nil
245253
}
246254

255+
func isFirewallSupported(services []cloudstack.NetworkServiceInternal) bool {
256+
for _, svc := range services {
257+
if svc.Name == "Firewall" {
258+
return true
259+
}
260+
}
261+
return false
262+
}
263+
247264
// EnsureLoadBalancerDeleted deletes the specified load balancer if it exists, returning
248265
// nil if the load balancer specified either didn't exist or was successfully deleted.
249266
func (cs *CSCloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName string, service *corev1.Service) error {

0 commit comments

Comments
 (0)