Skip to content

Commit 19ed620

Browse files
Josef HarteJosef Harte
authored andcommitted
function to list AI Service instances
1 parent e2d22a8 commit 19ed620

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/mas/devops/mas.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,22 @@ def listMasInstances(dynClient: DynamicClient) -> list:
134134
return suites
135135

136136

137+
def listAiServiceInstances(dynClient: DynamicClient) -> list:
138+
"""
139+
Get a list of AI Service instances on the cluster
140+
"""
141+
api = dynClient.resources.get(api_version="aiservice.ibm.com/v1", kind="AIServiceApp")
142+
143+
instances = api.get().to_dict()['items']
144+
if len(instances) > 0:
145+
logger.info(f"There are {len(instances)} AI Service instances installed on this cluster:")
146+
for instance in instances:
147+
logger.info(f" * {instance['metadata']['name']} v{instance['status']['versions']['reconciled']}")
148+
else:
149+
logger.info("There are no AI Service instances installed on this cluster")
150+
return instances
151+
152+
137153
def getWorkspaceId(dynClient: DynamicClient, instanceId: str) -> str:
138154
"""
139155
Get the MAS workspace ID for namespace "mas-{instanceId}-core"

0 commit comments

Comments
 (0)