From c219c6e27eac649d8f26302d29ae9636b7b9a5b9 Mon Sep 17 00:00:00 2001 From: terc1997 <64480693+terc1997@users.noreply.github.com> Date: Tue, 30 Dec 2025 11:18:01 -0300 Subject: [PATCH 1/3] [patch] add function to fetch cluster issuers --- src/mas/devops/ocp.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mas/devops/ocp.py b/src/mas/devops/ocp.py index a091f373..2957974f 100644 --- a/src/mas/devops/ocp.py +++ b/src/mas/devops/ocp.py @@ -376,6 +376,12 @@ def getStorageClasses(dynClient: DynamicClient) -> list: return storageClasses +def getClusterIssuers(dynClient: DynamicClient) -> list: + clusterIssuerAPI = dynClient.resources.get(api_version="cert-manager.io", kind="ClusterIssuer") + clusterIssuers = clusterIssuerAPI.get().items + return clusterIssuers + + def isSNO(dynClient: DynamicClient) -> bool: """ Check if the cluster is a Single Node OpenShift (SNO) deployment. From 9ede49f71c931a7bf120de37d44019297d5b2e30 Mon Sep 17 00:00:00 2001 From: terc1997 <64480693+terc1997@users.noreply.github.com> Date: Tue, 30 Dec 2025 11:23:39 -0300 Subject: [PATCH 2/3] [patch] add function to get a single cluster issuer by name --- src/mas/devops/ocp.py | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/mas/devops/ocp.py b/src/mas/devops/ocp.py index 2957974f..ebbee63e 100644 --- a/src/mas/devops/ocp.py +++ b/src/mas/devops/ocp.py @@ -377,11 +377,45 @@ def getStorageClasses(dynClient: DynamicClient) -> list: def getClusterIssuers(dynClient: DynamicClient) -> list: - clusterIssuerAPI = dynClient.resources.get(api_version="cert-manager.io", kind="ClusterIssuer") + """ + Get all ClusterIssuers in the cluster. + + Parameters: + dynClient (DynamicClient): OpenShift Dynamic Client + + Returns: + list: List of ClusterIssuers resources + + Raises: + NotFoundError: If ClusterIssuers cannot be retrieved + """ + clusterIssuerAPI = dynClient.resources.get(api_version="cert-manager.io/v1", kind="ClusterIssuer") clusterIssuers = clusterIssuerAPI.get().items return clusterIssuers +def getClusterIssuer(dynClient: DynamicClient, name: str) -> str: + """ + Get a specific ClusterIssuer by name. + + Parameters: + dynClient (DynamicClient): OpenShift Dynamic Client + name (str): The name of the ClusterIssuer to retrieve + + Returns: + ClusterIssuer: The ClusterIssuer resource, or None if not found + + Raises: + NotFoundError: If the ClusterIssuer does not exist (caught and returns None) + """ + try: + clusterIssuerAPI = dynClient.resources.get(api_version="cert-manager.io/v1", kind="ClusterIssuer") + clusterIssuer = clusterIssuerAPI.get(name=name) + return clusterIssuer + except NotFoundError: + return None + + def isSNO(dynClient: DynamicClient) -> bool: """ Check if the cluster is a Single Node OpenShift (SNO) deployment. From 7395e3c7998d3bdad3690ad78d319807ab2ffca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=A1rsis=20Augusto?= <64480693+terc1997@users.noreply.github.com> Date: Tue, 10 Feb 2026 15:41:28 -0300 Subject: [PATCH 3/3] [patch] fix formatting --- src/mas/devops/ocp.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mas/devops/ocp.py b/src/mas/devops/ocp.py index bfe47536..22c1d997 100644 --- a/src/mas/devops/ocp.py +++ b/src/mas/devops/ocp.py @@ -414,6 +414,8 @@ def getClusterIssuer(dynClient: DynamicClient, name: str) -> str: return clusterIssuer except NotFoundError: return None + + def getStorageClassVolumeBindingMode(dynClient: DynamicClient, storageClassName: str) -> str: """ Get the volumeBindingMode for a storage class.