diff --git a/pkg/app/piped/cloudprovider/kubernetes/kubectl.go b/pkg/app/piped/cloudprovider/kubernetes/kubectl.go index 2291e867d6..cad28d8e6b 100644 --- a/pkg/app/piped/cloudprovider/kubernetes/kubectl.go +++ b/pkg/app/piped/cloudprovider/kubernetes/kubectl.go @@ -64,14 +64,14 @@ func (c *Kubectl) Apply(ctx context.Context, namespace string, manifest Manifest return nil } -func (c *Kubectl) Delete(ctx context.Context, r ResourceKey) (err error) { +func (c *Kubectl) Delete(ctx context.Context, namespace string, r ResourceKey) (err error) { defer func() { metricsKubectlCalled(c.version, "delete", err == nil) }() args := make([]string, 0, 5) - if r.Namespace != "" { - args = append(args, "-n", r.Namespace) + if namespace != "" { + args = append(args, "-n", namespace) } args = append(args, "delete", r.Kind, r.Name) diff --git a/pkg/app/piped/cloudprovider/kubernetes/kubernetes.go b/pkg/app/piped/cloudprovider/kubernetes/kubernetes.go index 667558c6ee..e132acc248 100644 --- a/pkg/app/piped/cloudprovider/kubernetes/kubernetes.go +++ b/pkg/app/piped/cloudprovider/kubernetes/kubernetes.go @@ -228,7 +228,7 @@ func (p *provider) Delete(ctx context.Context, k ResourceKey) (err error) { return p.initErr } - return p.kubectl.Delete(ctx, k) + return p.kubectl.Delete(ctx, p.input.Namespace, k) } func (p *provider) findKubectl(ctx context.Context, version string) (*Kubectl, error) {