From e6421c0cc4e5c62b60dae703cb089e5ed5ce1ec2 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Tue, 4 Sep 2018 10:40:12 -0700 Subject: [PATCH] Get namespace for updating objects via res.Namespacea When deploying with helm to a non-default namespace, we were seeing the warning "error adding label to runtime object". This was because accessor.GetNamespace() always returned an empty string rather than the specified namespace. It seems the original object doesn't have the namespace field specified. To fix this problem, we can access the namespace from the build artifact instead of the accessor. Should fix #899 --- pkg/skaffold/deploy/labels.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/skaffold/deploy/labels.go b/pkg/skaffold/deploy/labels.go index c832f45d034..d7539be8515 100644 --- a/pkg/skaffold/deploy/labels.go +++ b/pkg/skaffold/deploy/labels.go @@ -140,7 +140,7 @@ func updateRuntimeObject(client dynamic.Interface, disco discovery.DiscoveryInte return errors.Wrap(err, "getting metadata accessor") } name := accessor.GetName() - namespace := accessor.GetNamespace() + namespace := res.Namespace addLabels(labels, accessor) modifiedJSON, _ := json.Marshal(modifiedObj)