Merge pull request #32102 from errordeveloper/fix-32085

Automatic merge from submit-queue

Do not go into standalone mode when `--require-kubeconfig` is passed

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

We have change how missing `--api-servers` is treated with introduction of `--require-kubeconfig` (#30798), however we haven't introduced explicit `--standalone` flag for backwards-compatibility reasons. Right now, setting `--kubeconfig` and`--require-kubeconfig` still gets kubelet into standalone mode. In practice this means that it doesn't get to update `nodeInfo` and thereby may refuse to admit pods which had been assigned to it by the scheduler. For example, if you update labels for that given node, and try to use affinity or `NodeLabels` on a pod, it won't get to run.

**Which issue this PR fixes**: fixes #32085

**Special notes for your reviewer**: This fix is only until we introduce `--standalone` flag.

**Release note**:
<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->
```release-note
NONE
```
pull/6/head
Kubernetes Submit Queue 2016-09-06 11:11:40 -07:00 committed by GitHub
commit e7e9587799
1 changed files with 1 additions and 1 deletions

View File

@ -298,7 +298,7 @@ func initConfigz(kc *componentconfig.KubeletConfiguration) (*configz.Config, err
func run(s *options.KubeletServer, kubeDeps *kubelet.KubeletDeps) (err error) { func run(s *options.KubeletServer, kubeDeps *kubelet.KubeletDeps) (err error) {
// TODO: this should be replaced by a --standalone flag // TODO: this should be replaced by a --standalone flag
standaloneMode := (len(s.APIServerList) == 0) standaloneMode := (len(s.APIServerList) == 0 && !s.RequireKubeConfig)
if s.ExitOnLockContention && s.LockFilePath == "" { if s.ExitOnLockContention && s.LockFilePath == "" {
return errors.New("cannot exit on lock file contention: no lock file specified") return errors.New("cannot exit on lock file contention: no lock file specified")