kubectl-operator icon indicating copy to clipboard operation
kubectl-operator copied to clipboard

Add namespace and multi-catalog support for describe and list-available

Open cdjohnson opened this issue 3 years ago • 2 comments

The describe and list-available commands made assumptions on an operator existing in only one catalog. It also did not understand namespace-scoped catalogs resulting in incomplete results. It now honors the context namespace as well as the -n override option to properly detect global vs. namespace-scoped catalogs.

I also added additional catalog metadata to the output.

Example output of describe when a package exists in two catalogs at the Global and Namespace scopes:

> bin/kubectl-operator describe ibm-mq  
== Catalog ==
Scope: Namespaced
Namespace: default
Name: ibm-operator-catalog2
Display Name: IBM Operator Catalog
Publisher: IBM Content

== Package ==
IBM MQ 2.1.0 (by IBM)

== Repository ==
N/A

== Channels ==
v1.0
v1.1
v1.2
v1.3-eus
v1.4
v1.5
v1.6
v1.7
v1.8
v2.0
v2.1 (default) (shown)

== Install Modes ==
AllNamespaces
OwnNamespace
SingleNamespace

== Description ==
IBM MQ is an operator to manage the life cycle of IBM MQ queue managers. This operator is available standalone, or as part of the IBM Cloud Pak for Integration (CP4I).

== Catalog ==
Scope: Global
Name: ibm-operator-catalog
Display Name: IBM Operator Catalog
Publisher: IBM Content

== Package ==
IBM MQ 2.1.0 (by IBM)

== Repository ==
N/A

== Channels ==
v1.0
v1.1
v1.2
v1.3-eus
v1.4
v1.5
v1.6
v1.7
v1.8
v2.0
v2.1 (default) (shown)

== Install Modes ==
AllNamespaces
OwnNamespace
SingleNamespace

== Description ==
IBM MQ is an operator to manage the life cycle of IBM MQ queue managers. This operator is available standalone, or as part of the IBM Cloud Pak for Integration (CP4I).

Example output of list-available when a package exists in two catalogs at the Global and Namespace scopes:

> bin/kubectl-operator list-available -n default
NAME                                              NAMESPACE   CATALOG                   CHANNEL                    LATEST CSV  
ibm-mq                                            restricted  ibm-operator-catalog      v1.0                       ibm-mq.v1.0.0                                            36m
ibm-mq                                            restricted  ibm-operator-catalog      v1.1                       ibm-mq.v1.1.0                                            36m
ibm-mq                                            restricted  ibm-operator-catalog      v1.2                       ibm-mq.v1.2.0                                            36m
ibm-mq                                            restricted  ibm-operator-catalog      v1.3-eus                   ibm-mq.v1.3.8                                            36m
ibm-mq                                            restricted  ibm-operator-catalog      v1.4                       ibm-mq.v1.4.0                                            36m
ibm-mq                                            restricted  ibm-operator-catalog      v1.5                       ibm-mq.v1.5.0                                            36m
ibm-mq                                            restricted  ibm-operator-catalog      v1.6                       ibm-mq.v1.6.0                                            36m
ibm-mq                                            restricted  ibm-operator-catalog      v1.7                       ibm-mq.v1.7.0                                            36m
ibm-mq                                            restricted  ibm-operator-catalog      v1.8                       ibm-mq.v1.8.2                                            36m
ibm-mq                                            restricted  ibm-operator-catalog      v2.0                       ibm-mq.v2.0.4                                            36m
ibm-mq                                            restricted  ibm-operator-catalog      v2.1                       ibm-mq.v2.1.0                                            36m
ibm-mq                                                        ibm-operator-catalog      v1.0                       ibm-mq.v1.0.0                                            27d
ibm-mq                                                        ibm-operator-catalog      v1.1                       ibm-mq.v1.1.0                                            27d
ibm-mq                                                        ibm-operator-catalog      v1.2                       ibm-mq.v1.2.0                                            27d
ibm-mq                                                        ibm-operator-catalog      v1.3-eus                   ibm-mq.v1.3.8                                            27d
ibm-mq                                                        ibm-operator-catalog      v1.4                       ibm-mq.v1.4.0                                            27d
ibm-mq                                                        ibm-operator-catalog      v1.5                       ibm-mq.v1.5.0                                            27d
ibm-mq                                                        ibm-operator-catalog      v1.6                       ibm-mq.v1.6.0                                            27d
ibm-mq                                                        ibm-operator-catalog      v1.7                       ibm-mq.v1.7.0                                            27d
ibm-mq                                                        ibm-operator-catalog      v1.8                       ibm-mq.v1.8.2                                            27d
ibm-mq                                                        ibm-operator-catalog      v2.0                       ibm-mq.v2.0.4                                            27d
ibm-mq                                                        ibm-operator-catalog      v2.1                       ibm-mq.v2.1.0                                            27d

Note: I purposely injected the NAMESPACE value into the list-available output. Since this is supposed to be a human-readable file, I'm assuming we do not need to preserve backward compatibility. I could add it at the end, but it would be unnatural. If this were to be a machine-readable tool, then I assume we would add a -o json option.

cdjohnson avatar Nov 23 '22 00:11 cdjohnson

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: cdjohnson Once this PR has been reviewed and has the lgtm label, please assign joelanford for approval by writing /assign @joelanford in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

openshift-ci[bot] avatar Nov 23 '22 00:11 openshift-ci[bot]

@cdjohnson: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

openshift-merge-robot avatar Jan 18 '23 21:01 openshift-merge-robot

https://github.com/operator-framework/operator-lifecycle-manager/pull/3254

perdasilva avatar May 21 '24 15:05 perdasilva