operator-framework / kubectl-operator

Manage Kubernetes Operators from the command line
https://operatorframework.io/
Apache License 2.0
128 stars 37 forks source link

One operator package is provided by multiple catalogsources #46

Closed horis233 closed 3 years ago

horis233 commented 3 years ago

Question

How to handle the case that one operator package is provided by multiple catalogsources?

Background

When users want to migrate the same operator from one catalogsource to another catalogsource or some other user case, there will be more than one catalogsources providing the same operator package. It causes there are multiple packageManifests using the same namespace in the same namespace, like

oc get packagemanifests -n ibm-common-services | grep ibm-common-service-operator
ibm-common-service-operator                          IBMCS Operators       24h
ibm-common-service-operator                          IBMD Operators        16h

In this case, the kubectl operator can't distinguish the difference between the packageManifest from different catalogsources and it uses the get command to fetch the packageManifest, which causes it will choose a random packageManifest from catalogsources.

This the result of the kubectl operator list-available command. It could have different results when executing the command twice in the same cluster.

➜  ~ kubectl operator list-available ibm-common-service-operator

NAME                         CATALOG          CHANNEL    LATEST CSV                                AGE
ibm-common-service-operator  IBMCS Operators  beta       ibm-common-service-operator.v3.7.1        24h
ibm-common-service-operator  IBMCS Operators  dev        ibm-common-service-operator.v101.101.101  24h
ibm-common-service-operator  IBMCS Operators  stable-v1  ibm-common-service-operator.v3.6.3        24h
ibm-common-service-operator  IBMCS Operators  v3         ibm-common-service-operator.v3.7.2        24h
➜  ~ kubectl operator list-available ibm-common-service-operator

NAME                         CATALOG         CHANNEL    LATEST CSV                                AGE
ibm-common-service-operator  IBMD Operators  beta       ibm-common-service-operator.v3.7.1        16h
ibm-common-service-operator  IBMD Operators  dev        ibm-common-service-operator.v101.101.101  16h
ibm-common-service-operator  IBMD Operators  stable-v1  ibm-common-service-operator.v3.6.3        16h
ibm-common-service-operator  IBMD Operators  v3         ibm-common-service-operator.v3.7.1        16h

Expect to know

  1. Should I expect kubectl operator to handle this kind of scenario better? For example, using list command and filter the package name to get all the candidate packageManifests.

  2. What is the best way to get the target PackageManifest? What I can think of is using list command and filter the result. Is there a best practice for it?

cc @cdjohnson

joelanford commented 3 years ago

Hey @horis233!

Sorry I missed this bug report. This is definitely something we can fix.

Feel free to ping on Slack if you don't hear back on issues in this project. Sometimes I miss things here because it's less active than OLM's main projects.