Explicitly return empty string on error reading namespace

Signed-off-by: Mikolaj Pawlikowski <mikolaj@pawlikowski.pl>
This commit is contained in:
Mikolaj Pawlikowski
2018-12-20 18:03:17 +01:00
committed by GitHub
parent 8a2d9e6f37
commit 5bad42922e

View File

@@ -24,6 +24,7 @@ func getNamespace() string {
b, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
if err != nil {
log.Println("Unable to determine namespace: ", err.Error())
return ""
}
namespace := string(b)
return namespace