Skip to content

Commit

Permalink
Merge pull request vmware-tanzu#522 from timdengyun/fix_securitypoicy…
Browse files Browse the repository at this point in the history
…_start_in_nonvpc

Fix security policy controller start issue in non-VPC mode
  • Loading branch information
timdengyun authored Feb 21, 2024
2 parents 8a5eec6 + 707d744 commit 631207b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,14 @@ func main() {

var vpcService *vpc.VPCService

if cf.CoeConfig.EnableVPCNetwork && commonService.NSXClient.NSXCheckVersion(nsx.VPC) {
log.V(1).Info("VPC mode enabled")
if cf.CoeConfig.EnableVPCNetwork {
// Check NSX version for VPC networking mode
if !commonService.NSXClient.NSXCheckVersion(nsx.VPC) {
log.Error(nil, "VPC mode cannot be enabled if NSX version is lower than 4.1.1")
os.Exit(1)
}
log.Info("VPC mode is enabled")

vpcService, err = vpc.InitializeVPC(commonService)
if err != nil {
log.Error(err, "failed to initialize vpc commonService", "controller", "VPC")
Expand Down Expand Up @@ -220,7 +226,7 @@ func main() {
StartIPPoolController(mgr, ipPoolService, vpcService)
networkpolicycontroller.StartNetworkPolicyController(mgr, commonService, vpcService)
}

// Start controllers which can run in non-VPC mode
securitypolicycontroller.StartSecurityPolicyController(mgr, commonService, vpcService)

// Start the NSXServiceAccount controller.
Expand Down

0 comments on commit 631207b

Please sign in to comment.