AI Service Module
The aiservice module provides functions for AI/ML service management and configuration.
aiservice
Functions
listAiServiceInstances(dynClient)
Retrieve all AI Service instances from the OpenShift cluster.
This function queries the cluster for AIServiceApp custom resources and returns a list of all AI Service instances found.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dynClient
|
DynamicClient
|
OpenShift dynamic client for cluster API interactions. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
list
|
A list of dictionaries representing AI Service instances. Returns an empty list if no instances are found or if errors occur. |
Source code in src/mas/devops/aiservice.py
verifyAiServiceInstance(dynClient, instanceId)
Verify that a specific AI Service instance exists in the cluster.
This function checks if an AIServiceApp custom resource with the given instance ID exists in the expected namespace. It handles various error conditions including missing instances, missing CRDs, and authorization failures.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dynClient
|
DynamicClient
|
OpenShift dynamic client for cluster API interactions. |
required |
instanceId
|
str
|
The unique identifier of the AI Service instance to verify. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the instance exists and is accessible, False otherwise. Returns False if the instance is not found, the CRD doesn't exist, or authorization fails. |
Source code in src/mas/devops/aiservice.py
listAiServiceTenantInstances(dynClient)
Retrieve all AI Service Tenant instances from the OpenShift cluster.
This function queries the cluster for AIServiceTenant custom resources and returns a list of all tenant instances found across all AI Service instances.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dynClient
|
DynamicClient
|
OpenShift dynamic client for cluster API interactions. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
list
|
A list of dictionaries representing AI Service Tenant instances. Returns an empty list if no tenant instances are found or if errors occur. |
Source code in src/mas/devops/aiservice.py
verifyAiServiceTenantInstance(dynClient, instanceId, tenantId)
Verify that a specific AI Service Tenant exists in the cluster.
This function checks if an AIServiceTenant custom resource with the given instance ID and tenant ID exists in the expected namespace. The tenant resource name follows the pattern "aiservice-{instanceId}-{tenantId}".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dynClient
|
DynamicClient
|
OpenShift dynamic client for cluster API interactions. |
required |
instanceId
|
str
|
The unique identifier of the AI Service instance. |
required |
tenantId
|
str
|
The unique identifier of the tenant within the AI Service instance. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the tenant exists and is accessible, False otherwise. Returns False if the tenant is not found, the CRD doesn't exist, or authorization fails. |
Source code in src/mas/devops/aiservice.py
getAiserviceChannel(dynClient, instanceId)
Retrieve the update channel for an AI Service instance.
This function queries the Operator Lifecycle Manager (OLM) subscription for the AI Service instance to determine which update channel it is subscribed to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dynClient
|
DynamicClient
|
OpenShift dynamic client for cluster API interactions. |
required |
instanceId
|
str
|
The unique identifier of the AI Service instance. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str | None
|
The channel name (e.g., "v1.0", "stable") if the subscription exists, None if the subscription is not found. |