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

Promote feature gate NodePortLocal to GA #5491

Merged
merged 1 commit into from
Oct 26, 2023
Merged

Promote feature gate NodePortLocal to GA #5491

merged 1 commit into from
Oct 26, 2023

Conversation

hjiajing
Copy link
Contributor

No description provided.

@luolanzone luolanzone added this to the Antrea v1.14 release milestone Sep 18, 2023
@luolanzone luolanzone added the action/release-note Indicates a PR that should be included in release notes. label Sep 18, 2023
Copy link
Contributor

@luolanzone luolanzone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, two nits

docs/node-port-local.md Outdated Show resolved Hide resolved
cmd/antrea-agent/agent.go Outdated Show resolved Hide resolved
@antoninbas
Copy link
Contributor

@luolanzone was there consensus to promote this FeatureGate to GA? I can't find a reference to it in the meeting minutes: https://github.com/antrea-io/antrea/wiki/Community-Meetings#august-14-2023

@luolanzone
Copy link
Contributor

@antoninbas it's not tracked by the community meeting. I found this feature might be able to promoted to GA after the community meeting ,so I started a slack thread to discuss it, and the team discussed this in a weekly sync meeting. You probably missed the sync meeting?

@luolanzone
Copy link
Contributor

@hjiajing please help to resolve the code conflicts.

@hjiajing
Copy link
Contributor Author

@luolanzone Thanks for the reminder, rebased.

@luolanzone
Copy link
Contributor

@hjiajing please check the unit test failure, not sure if it's related with a fix here https://github.com/antrea-io/antrea/pull/5401/files#diff-81ab3cbfb811ae739c26bb47a543eace8d915f2d518aa9d711d89ae47f54f30eR162-R167.

Copy link
Contributor

@luolanzone luolanzone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two nits.

docs/feature-gates.md Outdated Show resolved Hide resolved
cmd/antrea-agent/agent.go Outdated Show resolved Hide resolved
@hjiajing hjiajing force-pushed the npl branch 2 times, most recently from fa1a8ea to e2c9bc4 Compare October 12, 2023 06:20
@hjiajing
Copy link
Contributor Author

/test-e2e

luolanzone
luolanzone previously approved these changes Oct 16, 2023
Copy link
Contributor

@luolanzone luolanzone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR should be updated to match #5401

#5401 has gone through several rounds of reviews, and while it is not finalized yet (see #5401 (comment)), we seem to have reach consensus on the approach. In particular, FeatureGate validation and deprecation warning should probably go into cmd/antrea-agent/options.go, for consistency.

enableNodePortLocal := o.config.NodePortLocal.Enable
if !features.DefaultFeatureGate.Enabled(features.NodePortLocal) {
enableNodePortLocal = false
klog.InfoS("Feature gate `enableNodePortLocal` is deprecated, please use option `nodePortLocal.enable` to disable NodePortLocal")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of the FeatureGate is NodePortLocal, not enableNodePortLocal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the feature check block to cmd/antrea-agent/options.go now. A new function validateNodePortLocalConfg is added to check the NodePortLocal configuration.

@hjiajing
Copy link
Contributor Author

/test-e2e

cmd/antrea-agent/options.go Outdated Show resolved Hide resolved
@@ -738,3 +730,19 @@ func (o *Options) validateSecondaryNetworkConfig() error {

return nil
}

func (o *Options) valdateNodePortLocalConfig() error {
if !features.DefaultFeatureGate.Enabled(features.NodePortLocal) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should define o.enableNodePortLocal = *o.config.NodePortLocal.Enable && features.DefaultFeatureGate.Enabled(features.NodePortLocal), instead of mutating o.config.NodePortLocal.Enable. See #5401

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, Add a new variable o.enableNodePortLocal

@@ -5691,8 +5691,7 @@ data:

nodePortLocal:
# Enable NodePortLocal, a feature used to make Pods reachable using port forwarding on the host. To
# enable this feature, you need to set "enable" to true, and ensure that the NodePortLocal feature
# gate is also enabled (which is the default).
# enable this feature, you need to set "enable" to true.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's GA now, I think the default should be true? @tnqn @antoninbas

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the default value to true now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, we introduced the toggle intentionally to avoid unnecessary overhead added by the module as NPL would only be useful when users are using particular external LoadBalancers, which doesn't seem the majority case. Otherwise the feature gate alone can achieve what we need.

I took a look at the current code, even though the allocation of the node port is only triggered by the existence of the annotation, the code still needs to do some jobs to figure out the expectation first, which indicates some costs. And there could be some confusing logs generated as far as I can tell, for example, the following will be logged unconditionally as long as a Pod is added/updated even though there is no Service selecting it.

klog.V(2).Infof("Pod %s is selected by a Service for which NodePortLocal is enabled", key)

At the moment, I still prefer to keep it disabled by default and let users enable it on demand. If one day the feature becomes more common or its execution cost (when user doesn't annoate any Service) is proved to be trival, it will make sense to me to enable it by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for @tnqn 's comments. I set the default value to false now.

@hjiajing hjiajing force-pushed the npl branch 2 times, most recently from b5d1326 to 9420f6e Compare October 25, 2023 09:49
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conflicts need to be resolved

@@ -93,6 +93,10 @@ type Options struct {
// enableEgress represents whether Egress should run or not, calculated from its feature gate configuration and
// whether the traffic mode supports it.
enableEgress bool
// enableNodePortLocal indicates whether NodePortLocal should be enabled or not, based on feature gate NodePortLocal
// and options NodePortLocal.Enable. This used to maintain compatibility with the NodePortLocal feature gate, which
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// and options NodePortLocal.Enable. This used to maintain compatibility with the NodePortLocal feature gate, which
// and options NodePortLocal.Enable. This is used to maintain compatibility with the NodePortLocal feature gate, which

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added "is" after "This".

@@ -31,6 +31,8 @@ NodePortLocal was introduced in v0.13 as an alpha feature, and was graduated to
beta in v1.4, at which time it was enabled by default. Prior to v1.4, a feature
gate, `NodePortLocal`, must be enabled on the antrea-agent for the feature to
work. Starting from Antrea v1.7, NPL is supported on the Windows antrea-agent.
From Antrea v1.14, NPL is GA. To enable this feature, you need to ensure that the
`nodePortLocal.enable` flag is set to true in Antrea Agent configuration.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems duplicate with the following section. It has mentioned nodePortLocal.enable, perhaps just say it's GA here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, removed the "To enable this" sentence.

@tnqn
Copy link
Member

tnqn commented Oct 25, 2023

Conflicts need to be resolved

Reminder, the PR is not mergable even it's approved.

@hjiajing hjiajing force-pushed the npl branch 2 times, most recently from 9d001ec to c161e1c Compare October 25, 2023 14:37
@hjiajing
Copy link
Contributor Author

Conflicts need to be resolved

Reminder, the PR is not mergable even it's approved.

Thanks for the reminder, conflicts resolved.

tnqn
tnqn previously approved these changes Oct 25, 2023
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

antoninbas
antoninbas previously approved these changes Oct 25, 2023
Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@antoninbas
Copy link
Contributor

/test-all

@antoninbas
Copy link
Contributor

@hjiajing the change is causing unit test failures, PTAL

Signed-off-by: hujiajing <hjiajing@vmware.com>
@hjiajing
Copy link
Contributor Author

hjiajing commented Oct 26, 2023

@hjiajing the change is causing unit test failures, PTAL

@antoninbas Thanks for the reminder, resovled.

@hjiajing
Copy link
Contributor Author

/test-all

Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tnqn tnqn merged commit d66de44 into antrea-io:main Oct 26, 2023
43 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/release-note Indicates a PR that should be included in release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants