openshift/openshift-restclient-python

get() with label_selector is not working.

myakove opened this issue · 2 comments

get() with label_selector is not working, return every time a different resource.

from kubernetes import client, config
from openshift.dynamic import DynamicClient
 
k8s_client = config.new_client_from_config()
dyn_client = DynamicClient(k8s_client)

v1_services = dyn_client.resources.get(api_version='packages.operators.coreos.com/v1', kind='PackageManifest')
resource = v1_services.get(name="kubevirt-hyperconverged", namespace='openshift-cnv', label_selector='catalog=hco-catalogsource')
In [70]: resource.metadata.labels
Out[70]: 
{'catalog': 'ocs-catalogsource',
 'catalog-namespace': 'openshift-marketplace',
 'operatorframework.io/arch.amd64': 'supported',
 'operatorframework.io/os.linux': 'supported',
 'provider': 'Red Hat',
 'provider-url': ''}

In this namespace we have 3 PackageManifest resources named kubevirt-hyperconverged and each get() return a different one regardless of the label that we pass to the function.

Tried also to pass body and field_selector and got the same results.

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

/lifecycle frozen