Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove incorrect AntreaProxy warning on Windows #6242

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/antrea-agent/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,12 @@ func (o *Options) validateK8sNodeOptions() error {
return fmt.Errorf("failed to validate secondary network config: %v", err)
}

// Unlike checkUnsupportedFeatures, validateConfigForPlatform runs after all validations and
// after all fields in the Options struct have been initialized (e.g., enableProxy).
if err := o.validateConfigForPlatform(); err != nil {
return err
}

return nil
}

Expand Down
5 changes: 5 additions & 0 deletions cmd/antrea-agent/options_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ func (o *Options) checkUnsupportedFeatures() error {
// All features are supported on a Linux Node.
return nil
}

func (o *Options) validateConfigForPlatform() error {
// No additional validations for Linux Nodes.
return nil
}
18 changes: 17 additions & 1 deletion cmd/antrea-agent/options_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,24 @@ func (o *Options) checkUnsupportedFeatures() error {
return fmt.Errorf("unsupported features on Windows: {%s}", strings.Join(unsupported, ", "))
}

return nil
}

func (o *Options) validateConfigForPlatform() error {
// AntreaProxy with proxyAll is required on Windows.
// The userspace kube-proxy mode (only mode compatible with the Antrea Agent on Windows) was
// removed in K8s v1.26, hence the requirement for proxyAll.
// Even prior to that, AntreaProxy was required for correct NetworkPolicy enforcement for
// Service traffic.
// While we do not fail initialization at the moment, there should be no valid use case for
// Antrea on Windows without AntreaProxy + proxyAll.
if !o.enableAntreaProxy {
klog.Warning("AntreaProxy is not enabled. NetworkPolicies might not be enforced correctly for Service traffic!")
klog.ErrorS(nil, "AntreaProxy is disabled, Service traffic is unlikely to work as expected")
return nil
}
if !o.config.AntreaProxy.ProxyAll {
klog.ErrorS(nil, "AntreaProxy proxyAll is disabled, Service traffic is unlikely to work as expected")
return nil
}
return nil
}
Loading