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

Restore kube-proxy's support for 0 values for conntrack settings #55261

Conversation

ncdc
Copy link
Member

@ncdc ncdc commented Nov 7, 2017

What this PR does / why we need it: re-allow 0 values for kube-proxy conntrack min, max, max per core, tcp close wait timeout, tcp established timeout.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #50787

Special notes for your reviewer:

  • I adjusted validation to allow for 0 values for some of the conntrack settings, as otherwise the "leave the limit as-is" logic wouldn't be allowed.
  • I moved the loading of the config file from the cobra command's Validate method to Complete. This way, the config is fully resolved before validation happens. Otherwise, it just validates the default config values first, and then the config is loaded.
  • I think I got all the default values & nil checking correct, but please review carefully!

Release note:

Restored kube-proxy's support for 0 values for conntrack min, max, max per core, tcp close wait timeout, and tcp established timeout.

@ncdc ncdc added area/kube-proxy release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/network Categorizes an issue or PR as relevant to SIG Network. labels Nov 7, 2017
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 7, 2017
@ncdc ncdc changed the title Kube proxy config fix conntrack zero values Restore kube-proxy's support for 0 values for conntrack settings Nov 7, 2017
@ncdc
Copy link
Member Author

ncdc commented Nov 7, 2017

cc @kubernetes/sig-network-pr-reviews

@ncdc ncdc force-pushed the kube-proxy-config-fix-conntrack-zero-values branch from ad6fe78 to 6e38f1f Compare November 7, 2017 19:44
When kube-proxy was refactored to use a configuration file, the ability
to use 0 for conntrack min, max, max per core, and tcp timeouts was
inadvertently broken; if you specified 0, it would instead apply the
default value from defaults.go.

This change restores the ability to use 0 to mean 0.

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
@ncdc ncdc force-pushed the kube-proxy-config-fix-conntrack-zero-values branch from 6e38f1f to 9a53ee9 Compare November 7, 2017 19:45
@danehans
Copy link

danehans commented Nov 7, 2017

@pmichali since your were seeing the effects of #50787, are you able to review and test this PR?

@ncdc
Copy link
Member Author

ncdc commented Nov 7, 2017

In addition to that, I would really like someone familiar with conntrack settings, especially our desired defaulting vs 0 values, to review it.

@ncdc
Copy link
Member Author

ncdc commented Nov 7, 2017

/test pull-kubernetes-unit
maybe #54095

@ncdc
Copy link
Member Author

ncdc commented Nov 7, 2017

/retest

@@ -146,12 +146,15 @@ func AddFlags(options *Options, fs *pflag.FlagSet) {
fs.Float32Var(&options.config.ClientConnection.QPS, "kube-api-qps", options.config.ClientConnection.QPS, "QPS to use while talking with kubernetes apiserver")
fs.IntVar(&options.config.ClientConnection.Burst, "kube-api-burst", options.config.ClientConnection.Burst, "Burst to use while talking with kubernetes apiserver")
fs.DurationVar(&options.config.UDPIdleTimeout.Duration, "udp-timeout", options.config.UDPIdleTimeout.Duration, "How long an idle UDP connection will be kept open (e.g. '250ms', '2s'). Must be greater than 0. Only applicable for proxy-mode=userspace")
fs.Int32Var(&options.config.Conntrack.Max, "conntrack-max", options.config.Conntrack.Max,
if options.config.Conntrack.Max == nil {
Copy link
Member

Choose a reason for hiding this comment

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

Is there a doc or slides or something somewhere that explains the lifecycle of config these days? It looks crazy complicated, and I am trying to wrap my head around it.

NewOptions()
ApplyDefaults()
AddFlags()

At some point we read a config file, too. Where can I learn more about current state and eventual final state? Sorry for losing track of this.

@thockin
Copy link
Member

thockin commented Nov 9, 2017

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 9, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ncdc, thockin

Associated issue: 50787

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 9, 2017
@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 55247, 55324, 55261, 55147, 54052). If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit d28fccf into kubernetes:master Nov 9, 2017
@ncdc
Copy link
Member Author

ncdc commented Nov 9, 2017

Is there a doc or slides or something somewhere that explains the lifecycle of config
these days? It looks crazy complicated, and I am trying to wrap my head around it.

NewOptions()
ApplyDefaults()
AddFlags()

At some point we read a config file, too. Where can I learn more about current state and eventual final state? Sorry for losing track of this.

@thockin I'm not aware of any docs (I know, I know). Once the deprecated command line flags are removed, ApplyDefaults() and the giant AddFlags() go away. When we load the config file, it applies defaults as part of the decoding, so it will get simpler in the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kube-proxy cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/network Categorizes an issue or PR as relevant to SIG Network. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

zero-value settings for kube-proxy being overwritten by default values
6 participants