Skip to content

Added label support for 4.19 #12068

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions ocs_ci/ocs/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,20 @@
EXPORTER_APP_LABEL = "app=rook-ceph-exporter"
OPERATOR_LABEL = "app=rook-ceph-operator"
ODF_CONSOLE = "app=odf-console"
CSI_CEPHFSPLUGIN_PROVISIONER_LABEL = "app=csi-cephfsplugin-provisioner"
CSI_RBDPLUGIN_PROVISIONER_LABEL = "app=csi-rbdplugin-provisioner"
CSI_CEPHFSPLUGIN_LABEL = "app=csi-cephfsplugin"
CSI_RBDPLUGIN_LABEL = "app=csi-rbdplugin"
# fmt: off
CSI_CEPHFSPLUGIN_PROVISIONER_LABEL = (
"app in (openshift-storage.cephfs.csi.ceph.com-ctrlplugin,csi-cephfsplugin-provisioner)"
)
# fmt: on
CSI_RBDPLUGIN_PROVISIONER_LABEL = (
"app in (openshift-storage.rbd.csi.ceph.com-ctrlplugin,csi-rbdplugin-provisioner)"
)
CSI_CEPHFSPLUGIN_LABEL = (
"app in (openshift-storage.cephfs.csi.ceph.com-nodeplugin,csi-cephfsplugin)"
)
CSI_RBDPLUGIN_LABEL = (
"app in (openshift-storage.rbd.csi.ceph.com-nodeplugin,csi-rbdplugin)"
)
CSI_CEPHFSPLUGIN_PROVISIONER_LABEL_419 = (
"app=openshift-storage.cephfs.csi.ceph.com-ctrlplugin"
)
Expand Down
58 changes: 45 additions & 13 deletions ocs_ci/ocs/resources/pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -1791,9 +1791,18 @@ def get_cephfsplugin_provisioner_pods(
list : csi-cephfsplugin-provisioner Pod objects
"""
namespace = namespace or config.ENV_DATA["cluster_namespace"]
pods = get_pods_having_label(cephfsplugin_provisioner_label, namespace)
fs_plugin_pods = [Pod(**pod) for pod in pods]
return fs_plugin_pods

# New label in ODF 4.19+ (rook‑ceph 1.14)
labels = [
constants.CSI_CEPHFSPLUGIN_PROVISIONER_LABEL_419,
cephfsplugin_provisioner_label,
]
for lbl in labels:
pods = get_pods_having_label(lbl, namespace)
if pods:
fs_plugin_pods = [Pod(**pod) for pod in pods]
return fs_plugin_pods
return []


def get_rbdfsplugin_provisioner_pods(
Expand All @@ -1814,9 +1823,18 @@ def get_rbdfsplugin_provisioner_pods(
list : csi-rbdplugin-provisioner Pod objects
"""
namespace = namespace or config.ENV_DATA["cluster_namespace"]
pods = get_pods_having_label(rbdplugin_provisioner_label, namespace)
ebd_plugin_pods = [Pod(**pod) for pod in pods]
return ebd_plugin_pods

# New label in ODF 4.19+ (rook‑ceph 1.14)
labels = [
constants.CSI_RBDPLUGIN_PROVISIONER_LABEL_419,
rbdplugin_provisioner_label,
]
for lbl in labels:
pods = get_pods_having_label(lbl, namespace)
if pods:
ebd_plugin_pods = [Pod(**pod) for pod in pods]
return ebd_plugin_pods
return []


def get_pod_obj(name, namespace=None):
Expand Down Expand Up @@ -2028,14 +2046,28 @@ def get_plugin_pods(interface, namespace=None):
Returns:
list : csi-cephfsplugin pod objects or csi-rbdplugin pod objects
"""
if interface == constants.CEPHFILESYSTEM:
plugin_label = constants.CSI_CEPHFSPLUGIN_LABEL
if interface == constants.CEPHBLOCKPOOL:
plugin_label = constants.CSI_RBDPLUGIN_LABEL
namespace = namespace or config.ENV_DATA["cluster_namespace"]
plugins_info = get_pods_having_label(plugin_label, namespace)
plugin_pods = [Pod(**plugin) for plugin in plugins_info]
return plugin_pods

if interface == constants.CEPHFILESYSTEM:
# New label in ODF 4.19+ (rook‑ceph 1.14)
labels = [
constants.CSI_CEPHFSPLUGIN_LABEL_419,
constants.CSI_CEPHFSPLUGIN_LABEL, # legacy
]
elif interface == constants.CEPHBLOCKPOOL:
# New label in ODF 4.19+ (rook‑ceph 1.14)
labels = [
constants.CSI_RBDPLUGIN_LABEL_419,
constants.CSI_RBDPLUGIN_LABEL, # legacy
]

for label in labels:
plugins = get_pods_having_label(label, namespace)
if plugins:
plugin_pods = [Pod(**plugin) for plugin in plugins]
return plugin_pods

return []


def get_plugin_provisioner_leader(interface, namespace=None, leader_type="provisioner"):
Expand Down