Stop treating in-cluster-config namespace as an override

Kubernetes-commit: 1305559abbcd1e5558980062221ed3e65a8f0387
This commit is contained in:
Jordan Liggitt 2017-04-24 11:49:10 -04:00 committed by Kubernetes Publisher
parent 714e60e890
commit 21a475eefb

View File

@ -482,13 +482,13 @@ func (config *inClusterClientConfig) Namespace() (string, bool, error) {
// This way assumes you've set the POD_NAMESPACE environment variable using the downward API.
// This check has to be done first for backwards compatibility with the way InClusterConfig was originally set up
if ns := os.Getenv("POD_NAMESPACE"); ns != "" {
return ns, true, nil
return ns, false, nil
}
// Fall back to the namespace associated with the service account token, if available
if data, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace"); err == nil {
if ns := strings.TrimSpace(string(data)); len(ns) > 0 {
return ns, true, nil
return ns, false, nil
}
}