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 flag to set CNI bin dir, and use it on gci nodes #32151

Merged
merged 5 commits into from
Sep 13, 2016

Conversation

bboreham
Copy link
Contributor

@bboreham bboreham commented Sep 6, 2016

What this PR does / why we need it:

When using kube-up on GCE, following #31023 which moved the workers from debian to gci, CNI just isn't working. The root cause is basically as discussed in #28563: one flag (--network-plugin-dir) means two different things, and the configure-helper script uses it for the wrong purpose.

This PR adds a new flag --cni-bin-dir, then uses it to configure CNI as desired.

As discussed at #28563, I have also added a flag --cni-conf-dir so users can be explicit

Which issue this PR fixes : fixes #28563

Special notes for your reviewer:

I left the old flag largely alone for backwards-compatibility, with the exception that I stop setting the default when CNI is in use. The value of "/usr/libexec/kubernetes/kubelet-plugins/net/exec/" is unlikely to be what is wanted there.

Release note:

Added new kubelet flags `--cni-bin-dir` and `--cni-conf-dir` to specify where CNI files are located.
Fixed CNI configuration on GCI platform when using CNI.

This change is Reviewable

@k8s-ci-robot
Copy link
Contributor

Can a kubernetes member verify that this patch is reasonable to test? If so, please reply "ok to test".

Regular contributors should join the org to skip this step.

@k8s-github-robot k8s-github-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels Sep 6, 2016
@bboreham bboreham force-pushed the fix-cni-on-gci branch 3 times, most recently from e35fae3 to 4503359 Compare September 7, 2016 10:06
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

@googlebot googlebot added cla: no and removed cla: yes labels Sep 7, 2016
@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 7, 2016
@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Sep 7, 2016
@bboreham
Copy link
Contributor Author

bboreham commented Sep 7, 2016

Updated and rebased. @freehan this is the PR I mentioned in #27027.

@bboreham
Copy link
Contributor Author

bboreham commented Sep 7, 2016

Oh, one question: the default for NetworkPluginDir is in pkg/apis/componentconfig/v1alpha1/defaults.go but the defaults for CNI dirs are in pkg/kubelet/network/cni/cni.go. Is it desirable to bring those into alignment?

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 7, 2016
@@ -147,7 +147,9 @@ func (s *KubeletServer) AddFlags(fs *pflag.FlagSet) {
fs.Int32Var(&s.LowDiskSpaceThresholdMB, "low-diskspace-threshold-mb", s.LowDiskSpaceThresholdMB, "The absolute free disk space, in MB, to maintain. When disk space falls below this threshold, new pods would be rejected. Default: 256")
fs.DurationVar(&s.VolumeStatsAggPeriod.Duration, "volume-stats-agg-period", s.VolumeStatsAggPeriod.Duration, "Specifies interval for kubelet to calculate and cache the volume disk usage for all pods and volumes. To disable volume calculations, set to 0. Default: '1m'")
fs.StringVar(&s.NetworkPluginName, "network-plugin", s.NetworkPluginName, "<Warning: Alpha feature> The name of the network plugin to be invoked for various events in kubelet/pod lifecycle")
fs.StringVar(&s.NetworkPluginDir, "network-plugin-dir", s.NetworkPluginDir, "<Warning: Alpha feature> The full path of the directory in which to search for network plugins")
fs.StringVar(&s.NetworkPluginDir, "network-plugin-dir", s.NetworkPluginDir, "<Warning: Alpha feature> The full path of the directory in which to search for network plugins or CNI config")
Copy link
Member

Choose a reason for hiding this comment

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

You probably want to mark it deprecated...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would only be appropriate for the CNI usage of the flag; there is another meaning for non-CNI plugins.
Maybe non-CNI plugins should be deprecated, but that's another conversation.

@errordeveloper
Copy link
Member

I think you also need to run make generated_files, as you have updated types.go.

@bboreham
Copy link
Contributor Author

bboreham commented Sep 7, 2016

I think you also need to run make generated_files, as you have updated types.go

OK, have run that and checked in the resulting changes. Thanks!

@@ -147,7 +147,9 @@ func (s *KubeletServer) AddFlags(fs *pflag.FlagSet) {
fs.Int32Var(&s.LowDiskSpaceThresholdMB, "low-diskspace-threshold-mb", s.LowDiskSpaceThresholdMB, "The absolute free disk space, in MB, to maintain. When disk space falls below this threshold, new pods would be rejected. Default: 256")
fs.DurationVar(&s.VolumeStatsAggPeriod.Duration, "volume-stats-agg-period", s.VolumeStatsAggPeriod.Duration, "Specifies interval for kubelet to calculate and cache the volume disk usage for all pods and volumes. To disable volume calculations, set to 0. Default: '1m'")
fs.StringVar(&s.NetworkPluginName, "network-plugin", s.NetworkPluginName, "<Warning: Alpha feature> The name of the network plugin to be invoked for various events in kubelet/pod lifecycle")
fs.StringVar(&s.NetworkPluginDir, "network-plugin-dir", s.NetworkPluginDir, "<Warning: Alpha feature> The full path of the directory in which to search for network plugins")
fs.StringVar(&s.NetworkPluginDir, "network-plugin-dir", s.NetworkPluginDir, "<Warning: Alpha feature> The full path of the directory in which to search for network plugins or CNI config")
fs.StringVar(&s.CNIConfDir, "cni-conf-dir", s.CNIConfDir, "<Warning: Alpha feature> The full path of the directory in which to search for CNI config files")
Copy link
Member

Choose a reason for hiding this comment

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

Could we include the default values for these options? Most of the other options have them listed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure; any views on my question about which file the default should be implemented in?

@dcbw
Copy link
Member

dcbw commented Sep 8, 2016

Oh, one question: the default for NetworkPluginDir is in pkg/apis/componentconfig/v1alpha1/defaults.go but the defaults for CNI dirs are in pkg/kubelet/network/cni/cni.go. Is it desirable to bring those into alignment?

I feel like the defaults should be left up to each plugin type, either exec or CNI. I think that was just an omission in Rajat's original CNI branch. I don't think a kubelet global default is really appropriate here, since different plugins have different conventions. So maybe remove the default from defaults.go and put it into exec.go?

Edit: that said, I think we can do CNI defaults in the Flags() calls though, since these are obviously CNI specific. I just meant that the non-CNI defualt dir, which is left-over from exec, should be moved out of defaults.go and into exec.go somewhere, and --network-plugin-dir would be left without a default value, which each plugin could fill in by itself.

@freehan
Copy link
Contributor

freehan commented Sep 13, 2016

I think you have to run hack/update-codecgen.sh once again.

@freehan freehan added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 13, 2016
@freehan
Copy link
Contributor

freehan commented Sep 13, 2016

Thanks. LGTM. assuming tests will pass.

@k8s-bot
Copy link

k8s-bot commented Sep 13, 2016

GCE e2e build/test passed for commit 8a69683.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Sep 13, 2016

GCE e2e build/test passed for commit 8a69683.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit c4893df into kubernetes:master Sep 13, 2016
eparis pushed a commit to eparis/kubernetes that referenced this pull request Sep 14, 2016
Automatic merge from submit-queue

Add flag to set CNI bin dir, and use it on gci nodes

**What this PR does / why we need it**:

When using `kube-up` on GCE, following kubernetes#31023 which moved the workers from debian to gci, CNI just isn't working.  The root cause is basically as discussed in kubernetes#28563: one flag (`--network-plugin-dir`) means two different things, and the `configure-helper` script uses it for the wrong purpose.

This PR adds a new flag `--cni-bin-dir`, then uses it to configure CNI as desired.

As discussed at kubernetes#28563, I have also added a flag `--cni-conf-dir` so users can be explicit

**Which issue this PR fixes** : fixes kubernetes#28563

**Special notes for your reviewer**:

I left the old flag largely alone for backwards-compatibility, with the exception that I stop setting the default when CNI is in use.  The value of `"/usr/libexec/kubernetes/kubelet-plugins/net/exec/"` is unlikely to be what is wanted there.

**Release note**:
```release-note
Added new kubelet flags `--cni-bin-dir` and `--cni-conf-dir` to specify where CNI files are located.
Fixed CNI configuration on GCI platform when using CNI.
```
(cherry picked from commit c4893df)
@eparis eparis added the cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. label Sep 14, 2016
@k8s-cherrypick-bot
Copy link

Commit found in the "release-1.4" branch appears to be this PR. Removing the "cherrypick-candidate" label. If this is an error find help to get your PR picked.

peebs pushed a commit to peebs/coreos-kubernetes that referenced this pull request Sep 19, 2016
tomdee added a commit to tomdee/minikube-iso that referenced this pull request Sep 21, 2016
mumoshu pushed a commit to mumoshu/coreos-kubernetes-filtered that referenced this pull request Oct 21, 2016
shyamjvs pushed a commit to shyamjvs/kubernetes that referenced this pull request Dec 1, 2016
Automatic merge from submit-queue

Add flag to set CNI bin dir, and use it on gci nodes

**What this PR does / why we need it**:

When using `kube-up` on GCE, following kubernetes#31023 which moved the workers from debian to gci, CNI just isn't working.  The root cause is basically as discussed in kubernetes#28563: one flag (`--network-plugin-dir`) means two different things, and the `configure-helper` script uses it for the wrong purpose.

This PR adds a new flag `--cni-bin-dir`, then uses it to configure CNI as desired.

As discussed at kubernetes#28563, I have also added a flag `--cni-conf-dir` so users can be explicit

**Which issue this PR fixes** : fixes kubernetes#28563

**Special notes for your reviewer**:

I left the old flag largely alone for backwards-compatibility, with the exception that I stop setting the default when CNI is in use.  The value of `"/usr/libexec/kubernetes/kubelet-plugins/net/exec/"` is unlikely to be what is wanted there.

**Release note**:
```release-note
Added new kubelet flags `--cni-bin-dir` and `--cni-conf-dir` to specify where CNI files are located.
Fixed CNI configuration on GCI platform when using CNI.
```
(cherry picked from commit c4893df)
brb added a commit to brb/minikube that referenced this pull request Dec 11, 2018
As per kubernetes/kubernetes#32151, kubelet
doesn't search for CNI configs in /usr/libexec/kubernetes/kubelet-plugins/net/exec/
by default anymore.

Signed-off-by: Martynas Pumputis <martynas@covalent.io>
brb added a commit to brb/minikube that referenced this pull request Dec 11, 2018
As per kubernetes/kubernetes#32151, kubelet
doesn't search for CNI configs in /usr/libexec/kubernetes/kubelet-plugins/net/exec/
by default anymore.

Signed-off-by: Martynas Pumputis <m@lambda.lt>
brb added a commit to brb/minikube that referenced this pull request Dec 11, 2018
As per kubernetes/kubernetes#32151, kubelet
doesn't search for CNI configs in /usr/libexec/kubernetes/kubelet-plugins/net/exec/
by default anymore.

Signed-off-by: Martynas Pumputis <m@lambda.lt>
brb added a commit to brb/minikube that referenced this pull request Dec 17, 2018
As per kubernetes/kubernetes#32151, kubelet
doesn't search for CNI configs in /usr/libexec/kubernetes/kubelet-plugins/net/exec/
by default anymore.

Signed-off-by: Martynas Pumputis <m@lambda.lt>
brb added a commit to brb/minikube that referenced this pull request Jan 3, 2019
As per kubernetes/kubernetes#32151, kubelet
doesn't search for CNI configs in /usr/libexec/kubernetes/kubelet-plugins/net/exec/
by default anymore.

Signed-off-by: Martynas Pumputis <m@lambda.lt>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--network-plugin-dir flag has ambiguous meanings