Skip to content

Commit

Permalink
Run modules that rely on Services after AntreaProxy is ready (antrea-…
Browse files Browse the repository at this point in the history
…io#4946)

If kube-proxy is not running, AntreaProxy is responsible for proxying
the access to Services. For components that rely on Services, they
should run after AntreaProxy is ready.

Accessing Service IPs before they are proxied leads to weird behaviors
on Windows platform.

Signed-off-by: Quan Tian <qtian@vmware.com>
  • Loading branch information
tnqn authored and ceclinux committed May 30, 2023
1 parent 1b76515 commit 9db5958
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cmd/antrea-agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,6 @@ func run(o *Options) error {

go antreaClientProvider.Run(ctx)

go networkPolicyController.Run(stopCh)
// Initialize the NPL agent.
if enableNodePortLocal {
nplController, err := npl.InitializeNPLAgent(
Expand Down Expand Up @@ -711,10 +710,6 @@ func run(o *Options) error {
go memberlistCluster.Run(stopCh)
}

if o.enableEgress {
go egressController.Run(stopCh)
}

if features.DefaultFeatureGate.Enabled(features.ServiceExternalIP) {
go externalIPController.Run(stopCh)
}
Expand All @@ -740,6 +735,14 @@ func run(o *Options) error {
klog.InfoS("AntreaProxy is ready")
}
}

// NetworkPolicyController and EgressController accesses the "antrea" Service via its ClusterIP.
// Run them after AntreaProxy is ready.
go networkPolicyController.Run(stopCh)
if o.enableEgress {
go egressController.Run(stopCh)
}

var mcastController *multicast.Controller
if multicastEnabled {
multicastSocket, err := multicast.CreateMulticastSocket()
Expand Down

0 comments on commit 9db5958

Please sign in to comment.