Fix error checking for pod name & NS

Previously it would just check if POD_NAME *or* POD_NAMESPACE was set, which
could lead to very bizarre failure modes.
This commit is contained in:
Clayton O'Neill 2017-07-14 09:26:50 -04:00
parent d416d029ec
commit ad583c3acb
2 changed files with 21 additions and 5 deletions

View file

@ -117,7 +117,7 @@ func GetPodDetails(kubeClient clientset.Interface) (*PodInfo, error) {
podName := os.Getenv("POD_NAME")
podNs := os.Getenv("POD_NAMESPACE")
if podName == "" && podNs == "" {
if podName == "" || podNs == "" {
return nil, fmt.Errorf("unable to get POD information (missing POD_NAME or POD_NAMESPACE environment variable")
}