prior to this patch, when a kube-mgmt is configured to replicate cluster scoped resources client-go fails with:
W0328 20:56:18.838009 1 reflector.go:324]
k8s.io/client-go@v0.23.8/tools/cache/reflector.go:167: failed to list
*unstructured.Unstructured: field label not supported:
metadata.namespace
E0328 20:56:18.838180 1 reflector.go:138]
k8s.io/client-go@v0.23.8/tools/cache/reflector.go:167: Failed to watch
*unstructured.Unstructured: failed to list *unstructured.Unstructured:
field label not supported: metadata.namespace
similar reproducer with kubectl is as below:
kubectl get ns --field-selector metadata.namespace!=foo
Error from server (BadRequest): Unable to find "/v1,
Resource=namespaces" that match label selector "", field selector
"metadata.namespace!=foo": field label not supported: metadata.namespace
This patch guards the setting of the fieldselector to only namespaced resources.
fixes https://github.com/open-policy-agent/kube-mgmt/issues/195
prior to this patch, when a kube-mgmt is configured to replicate cluster scoped resources client-go fails with:
similar reproducer with
kubectl
is as below:This patch guards the setting of the fieldselector to only namespaced resources.