Multiple resources of the same type with the same name in a single Kubernetes namespace?

70 views Asked by At

I've encountered a cluster which has multiple PackageManifest resources of the same name in the same namespace. There seem to be two CatalogSources and there is some overlap in the components they define.

$ kubectl get packagemanifest -n olm | grep rho | sort
rhoas-operator                                     Community Operators              20d
rhods-operator                                     Red Hat OpenShift Data Science   16h
rhods-operator                                     Red Hat Operators                20d
rhods-prometheus-operator                          Red Hat OpenShift Data Science   16h
rhods-prometheus-operator                          Red Hat Operators                20d

Querying by kind, name, and namespace seems to give one of the two at random.

$ kubectl get packagemanifest/rhods-operator -n olm
NAME             CATALOG                          AGE
rhods-operator   Red Hat OpenShift Data Science   16h
$ kubectl get packagemanifest/rhods-operator -n olm
NAME             CATALOG             AGE
rhods-operator   Red Hat Operators   20d

What I am observing completely breaks my long-held belief, supported by documentation, that

Each object in your cluster has a Name that is unique for that type of resource. Every Kubernetes object also has a UID that is unique across your whole cluster.

For example, you can only have one Pod named myapp-1234 within the same namespace, but you can have one Pod and one Deployment that are each named myapp-1234.

~~ https://kubernetes.io/docs/concepts/overview/working-with-objects/names/

Is what I am happening a misconfiguration? Why does Kubernetes allow it? Is OLM doing something nefarious?

Investigating kind and apiVersion

$ kubectl get packagemanifest --namespace=olm --output=jsonpath="{range .items[*]}{.kind}{'\t'}{.apiVersion}{'\t'}{.metadata.name}{'\n'}{end}" | grep rho | sort
PackageManifest packages.operators.coreos.com/v1        rhoas-operator
PackageManifest packages.operators.coreos.com/v1        rhods-operator
PackageManifest packages.operators.coreos.com/v1        rhods-operator
PackageManifest packages.operators.coreos.com/v1        rhods-prometheus-operator
PackageManifest packages.operators.coreos.com/v1        rhods-prometheus-operator
0

There are 0 answers