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

return nil from NewClientConfig instead of empty struct #28004

Merged
merged 2 commits into from
Jun 24, 2016

Conversation

mikedanese
Copy link
Member

@mikedanese mikedanese commented Jun 24, 2016

This is a go convention and fixes an nil pointer in kubelet when passing in bad command line options:

I0624 04:12:33.333246   25404 plugins.go:141] Loaded network plugin "kubenet"
E0624 04:12:33.333390   25404 runtime.go:58] Recovered from panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/runtime/runtime.go:52
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/runtime/runtime.go:40
/usr/local/go/src/runtime/asm_amd64.s:472
/usr/local/go/src/runtime/panic.go:443
/usr/local/go/src/runtime/panic.go:62
/usr/local/go/src/runtime/sigpanic_unix.go:24
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/service.go:132
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubelet/kubelet.go:254
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/client/cache/listwatch.go:80
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/client/cache/reflector.go:262
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/client/cache/reflector.go:204
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/wait/wait.go:86
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/wait/wait.go:87
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/wait/wait.go:49

cc @caesarxuchao @lavalamp

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels Jun 24, 2016
@k8s-bot
Copy link

k8s-bot commented Jun 24, 2016

GCE e2e build/test passed for commit 3162197.

@mikedanese mikedanese added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels Jun 24, 2016
@mikedanese mikedanese added this to the v1.3 milestone Jun 24, 2016
@caesarxuchao caesarxuchao added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 24, 2016
@caesarxuchao
Copy link
Member

Thanks @mikedanese ! LGTM.

Also I think the kubelet code that panics should check for error as well?

@mikedanese
Copy link
Member Author

It's this line right here:

kcfg.KubeClient, err = clientset.NewForConfig(clientConfig)

the error is checked but it's non fatal so we issue a warning because the kubelet can operate in standalone mode without a kubeClient. We later detect whether we are operating in standalone mode by checking if the client is nil. Maybe that's not a good way to do it, but the code broke when we started returning non-nil on errors from NewClientFrom.

@caesarxuchao
Copy link
Member

Nice debugging. Thanks!

@mikedanese mikedanese added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Jun 24, 2016
@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 Jun 24, 2016

GCE e2e build/test passed for commit 3162197.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 07d24e4 into kubernetes:master Jun 24, 2016
@mikedanese mikedanese deleted the fix-nil branch June 24, 2016 23:35
@erictune erictune added cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. and removed cherrypick-candidate labels Jun 24, 2016
@eparis eparis mentioned this pull request Jun 27, 2016
eparis pushed a commit to eparis/kubernetes that referenced this pull request Jun 29, 2016
Automatic merge from submit-queue

return nil from NewClientConfig instead of empty struct

This is a go convention and fixes an nil pointer in kubelet when passing in bad command line options:

```
I0624 04:12:33.333246   25404 plugins.go:141] Loaded network plugin "kubenet"
E0624 04:12:33.333390   25404 runtime.go:58] Recovered from panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/runtime/runtime.go:52
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/runtime/runtime.go:40
/usr/local/go/src/runtime/asm_amd64.s:472
/usr/local/go/src/runtime/panic.go:443
/usr/local/go/src/runtime/panic.go:62
/usr/local/go/src/runtime/sigpanic_unix.go:24
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/service.go:132
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubelet/kubelet.go:254
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/client/cache/listwatch.go:80
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/client/cache/reflector.go:262
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/client/cache/reflector.go:204
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/wait/wait.go:86
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/wait/wait.go:87
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/wait/wait.go:49
```
cc @caesarxuchao @lavalamp
(cherry picked from commit 07d24e4)
k8s-github-robot pushed a commit that referenced this pull request Jun 29, 2016
Automatic merge from submit-queue

Batch update for 1.3

#28030: Revert "Federation e2e supports aws"
#28026: Address outstanding review comments in #27999.
#28034: Adding lock files for kubeconfig updating
#28004: return nil from NewClientConfig instead of empty struct
#28032: Increase pod CPU/memory for fluentd, dns and kube-proxy.
#27208: Bump minimum API version for docker to 1.21
#28061: Remove extra double quotes in --federations.
#28060: rkt: Fix the 'privileged' check when stage1 annotation is provided.
#27996: Image GC logic should compensate for reserved blocks
#28044: rkt: Bump required rkt version to 1.9.1.
#28040: Tracked addition of federation, sed support in kube DNS
#28043: Set grace period to 0 when deleting namespaces after the test.
#28002: Fix startup type error in initializeCaches
#28087: Hotfix: Fixup the hyperkube dns manifest from a breaking federation PR
#28108: Fix initialization of volume controller caches.
#28056: Increase kube-dns requirements on CoreOS.
#28147: Fix error checks after cloning.
#28159: Use : as seccomp security option operator for Docker 1.10
#28165: Refactored, expanded and fixed federated-services e2e tests.
#28095: Kubelet should mark VolumeInUse before checking if it is Attached
#28172: Build: Add KUBE_GCS_RELEASE_BUCKET_MIRROR option to push-ci-build.sh
#28207: Bump cluster autoscaler to 0.2.2
#28160: Volume manager must verify containers terminated before deleting for ungracefully terminated pods
#28211: Fix federation e2e tests by correctly managing cluster clients
#27944: Fix pvc label selector validation error
#28186: federation: Upgrading the groupversion to v1beta1
@k8s-cherrypick-bot
Copy link

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

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. 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-none Denotes a PR that doesn't merit a release note. 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.

8 participants