Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: polex not working downport to 1.10 #136

Open
wants to merge 1 commit into
base: release-1.10-n4k
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cmd/cli/kubectl-kyverno/utils/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,15 @@ OuterLoop:
}
}

if c.Client != nil && len(namespaceLabels) == 0 && c.Resource.GetKind() != "Namespace" {
ns, err := c.Client.GetResource(context.TODO(), "v1", "Namespace", "", c.Resource.GetNamespace())
if err != nil {
log.Log.Error(err, "failed to get the resource's namespace")
return nil, fmt.Errorf("failed to get the resource's namespace (%w)", err)
}
namespaceLabels = ns.GetLabels()
}

resPath := fmt.Sprintf("%s/%s/%s", c.Resource.GetNamespace(), c.Resource.GetKind(), c.Resource.GetName())
log.Log.V(3).Info("applying policy on resource", "policy", c.Policy.GetName(), "resource", resPath)

Expand Down
Loading