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

Add EnableUnidling flag to openshift-sdn #214

Merged
merged 3 commits into from Jul 19, 2019
Merged

Add EnableUnidling flag to openshift-sdn #214

merged 3 commits into from Jul 19, 2019

Conversation

squeed
Copy link
Contributor

@squeed squeed commented Jun 26, 2019

This PR has 2 changes:

  1. Improved handling of the Applied configuration for upgrades
  • Call ApplyDefaults on the previously applied configuration
  • A test case that makes sure we can adopt 4.1 clusters
  1. The EnableUnidling flag, and its corresponding API change

If this all looks good, I'll split off an api PR.

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 26, 2019
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 26, 2019
@squeed squeed requested review from danwinship and removed request for JacobTanenbaum and pecameron June 26, 2019 13:31
@danwinship
Copy link
Contributor

Call ApplyDefaults on the previously applied configuration

So how does that help?

Also, there's a typo in the commit message: "preivously"

@danwinship
Copy link
Contributor

So how does that help?

Ah, duh, never mind, it helps by filling in the default value of EnableUnidling.

pkg/network/openshift_sdn.go Outdated Show resolved Hide resolved
pkg/network/openshift_sdn.go Show resolved Hide resolved
Copy link
Contributor

@danwinship danwinship left a comment

Choose a reason for hiding this comment

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

Looks good. Go ahead and submit the API changes.

pkg/network/openshift_sdn.go Show resolved Hide resolved
@squeed squeed changed the title [wip] Add EnableUnidling flag to openshift-sdn Add EnableUnidling flag to openshift-sdn Jul 18, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 18, 2019
@squeed
Copy link
Contributor Author

squeed commented Jul 18, 2019

API changes merged, rebased, revendored, etc. etc. @danwinship, PTAL

Copy link
Contributor

@danwinship danwinship left a comment

Choose a reason for hiding this comment

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

Typo in the call ApplyDefaults on the previously-applied configuration commit message: "preivously"

README.md Outdated
@@ -114,6 +114,7 @@ OpenShiftSDN supports the following configuration options, all of which are opti
* `vxlanPort`: The port to use for the VXLAN overlay. The default is 4789
* `MTU`: The MTU to use for the VXLAN overlay. The default is the MTU of the node that the cluster-network-operator is first run on, minus 50 bytes for overhead. If the nodes in your cluster don't all have the same MTU then you will need to set this explicitly.
* `useExternalOpenvswitch`: boolean. If the nodes are already running openvswitch, and OpenShiftSDN should not install its own, set this to true. This only needed for certain advanced installations with DPDK or OpenStack.
* `enableUnidling`: boolean. Whether or not the service proxy supports idling and unidling of services.
Copy link
Contributor

Choose a reason for hiding this comment

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

"Whether the service proxy should allow idling and unidling of services"

@@ -48,9 +48,13 @@ func renderOpenShiftSDN(conf *operv1.NetworkSpec, manifestDir string) ([]*uns.Un
"metrics-bind-address": {"0.0.0.0"},
"metrics-port": {"9101"},
"healthz-port": {"10256"},
"proxy-mode": {"iptables"},
"proxy-mode": {"unidling+iptables"},
Copy link
Contributor

Choose a reason for hiding this comment

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

This is wrong: we have to apply the value of c.EnableUnidling after merging conf and kpcDefaults. If a 4.1 user redundantly specified proxy-mode: iptables, then in 4.1 they would have gotten unidling, but the way this code is currently written here, in 4.2 they would get no unidling. (There should be a test case for this.)

(The simplest way to do this might be to pass c.EnableUnidling to kubeProxyConfiguration().)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Argh, good point. The "unidling+" is an implementation detail.

This is to make it more likely that we don't accidentally reject a safe
upgrade as unsafe.

Also, add a test that includes known deployed previously-applied
configurations, and ensures that they will always upgrade safely.
@squeed
Copy link
Contributor Author

squeed commented Jul 18, 2019

OK, fixed. Thanks a ton for the review. Solved the proxy-mode thing a slightly different way. PTAL.

kpcOverrides := map[string]operv1.ProxyArgumentList{}
if *c.EnableUnidling && len(conf.KubeProxyConfig.ProxyArguments["proxy-mode"]) > 0 {
pma := conf.KubeProxyConfig.ProxyArguments["proxy-mode"]
if !strings.HasPrefix(pma[0], "unidling+") {
Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, validation has already confirmed that if *c.EnableUnidling is set (after defaulting), then conf.KubeProxyConfig.ProxyArguments["proxy-mode"] is either unset or ["iptables"]. So you can simplify this to just:

kpcOverrides := map[string]operv1.ProxyArgumentList{}
if *c.EnableUnidling {
        kpcOverrides["proxy-mode"] = operv1.ProxyArgumentList{"unidling+iptables"}`
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yeah, good point.


}

kpc, err := kubeProxyConfiguration(conf, kpcDefaults, kpcOverrides)
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe rearrange to defaults, config, overrides to match the order they're merged in? or not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, thought about that. might as well be nice to future maintainers.

This also carries forward any possible 4.1 installations with
--proxy-mode=iptables.
@squeed
Copy link
Contributor Author

squeed commented Jul 18, 2019

Updated, PTAL.

@danwinship
Copy link
Contributor

/lgtm
/retest

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 19, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danwinship, squeed

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@squeed
Copy link
Contributor Author

squeed commented Jul 19, 2019

/retest

@openshift-merge-robot openshift-merge-robot merged commit e1453ac into openshift:master Jul 19, 2019
@squeed squeed deleted the sdn-unidling-flag branch August 19, 2019 13:54
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. lgtm Indicates that a PR is ready to be merged. 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.

None yet

4 participants