operator-framework / operator-lifecycle-manager

A management framework for extending Kubernetes with Operators
https://olm.operatorframework.io
Apache License 2.0
1.72k stars 545 forks source link

Why olm allows the same packagemanifest objects in the same namespace #3002

Open 24sama opened 1 year ago

24sama commented 1 year ago

Bug Report

What did you do? Two packagemanifest objects with the same name are created in the same namespace.

What did you expect to see? Usually, we use client-go to Get() packagemanifest (treat the packagemanifest as a normal cr), but this bug(or feature? hhh) will make the Get() function return a random response.

What did you see instead? Under which circumstances?

kubectl get packagemanifest -n test
test    etcd           catalogsource         1m
test    etcd           catalogsource         2h

kubectl get packagemanifest -n test etcd
test    etcd           catalogsource         1m

kubectl get packagemanifest -n test etcd
test    etcd           catalogsource         2h

or use Get() in the project, both return a random response.

Environment

Possible Solution

Additional context Add any other context about the problem here.

kevinrizza commented 1 year ago

This is definitely intended behavior. The packagemanifest API isn't backed by a CRD, it's an aggregated API service. If you're querying for these, you need to also get the catalog source name + namespace for a given packagemanifest -- package name uniqueness is enforced in the context of a single catalog.

24sama commented 1 year ago

This is definitely intended behavior. The packagemanifest API isn't backed by a CRD, it's an aggregated API service. If you're querying for these, you need to also get the catalog source name + namespace for a given packagemanifest -- package name uniqueness is enforced in the context of a single catalog.

Thanks @kevinrizza , if I want to query one packagemanifest by Get() or others, is there any suggestion? Using list() with labelSelector ?