MAS Suite Module
The mas.suite module provides functions for MAS core suite management.
suite
Functions
isAirgapInstall(dynClient, checkICSP=False)
Determine if MAS is installed in an air-gapped (disconnected) environment.
This function checks for the presence of ImageDigestMirrorSet (IDMS) or ImageContentSourcePolicy (ICSP) resources that indicate mirror registries are configured for air-gapped installations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dynClient
|
DynamicClient
|
OpenShift dynamic client for cluster API interactions. |
required |
checkICSP
|
bool
|
If True, check for legacy ICSP resources instead of IDMS. Defaults to False (checks IDMS). |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if air-gap configuration is detected, False otherwise. |
Source code in src/mas/devops/mas/suite.py
getDefaultStorageClasses(dynClient)
Detect and return default storage classes for the cluster environment.
This function identifies the storage provider (IBM Cloud, OCS, Azure, AWS, etc.) by examining available storage classes and returns appropriate RWO (ReadWriteOnce) and RWX (ReadWriteMany) storage class names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dynClient
|
DynamicClient
|
OpenShift dynamic client for cluster API interactions. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
SimpleNamespace |
dict
|
Object with attributes: - provider (str): Provider identifier (e.g., "ibmc", "ocs", "aws") - providerName (str): Human-readable provider name - rwo (str): Storage class name for RWO volumes - rwx (str): Storage class name for RWX volumes All attributes are None if no recognized provider is found. |
Source code in src/mas/devops/mas/suite.py
getCurrentCatalog(dynClient)
Retrieve information about the currently installed IBM Operator Catalog.
This function queries the ibm-operator-catalog CatalogSource and extracts version information from its display name and image reference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dynClient
|
DynamicClient
|
OpenShift dynamic client for cluster API interactions. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Dictionary with keys: - displayName (str): Catalog display name - image (str): Catalog image reference - catalogId (str): Parsed catalog identifier (e.g., "v9-241205-amd64") Returns None if the catalog is not found. |
Source code in src/mas/devops/mas/suite.py
listMasInstances(dynClient)
Retrieve all MAS Suite instances from the OpenShift cluster.
This function queries the cluster for Suite custom resources and returns a list of all MAS 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 MAS Suite instances. Returns an empty list if no instances are found or if errors occur. |
Source code in src/mas/devops/mas/suite.py
getWorkspaceId(dynClient, instanceId)
Retrieve the workspace ID for a MAS instance.
This function queries the Workspace custom resources in the MAS core namespace and returns the workspace ID from the first workspace found.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dynClient
|
DynamicClient
|
OpenShift dynamic client for cluster API interactions. |
required |
instanceId
|
str
|
The MAS instance identifier. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The workspace ID if found, None if no workspaces exist for the instance. |
Source code in src/mas/devops/mas/suite.py
verifyMasInstance(dynClient, instanceId)
Verify that a MAS Suite instance exists in the cluster.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dynClient
|
DynamicClient
|
OpenShift dynamic client for cluster API interactions. |
required |
instanceId
|
str
|
The MAS instance identifier 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/mas/suite.py
getMasChannel(dynClient, instanceId)
Retrieve the OLM subscription channel for a MAS instance.
This function queries the Operator Lifecycle Manager subscription for the MAS Core operator 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 MAS instance identifier. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The channel name (e.g., "8.11.x", "9.0.x") if the subscription exists, None if the subscription is not found. |
Source code in src/mas/devops/mas/suite.py
updateIBMEntitlementKey(dynClient, namespace, icrUsername, icrPassword, artifactoryUsername=None, artifactoryPassword=None, secretName='ibm-entitlement')
Create or update the IBM Entitlement secret for accessing IBM container registries.
This function generates a Docker config JSON with credentials for IBM Container Registry (ICR) and optionally Artifactory, then creates or updates a Kubernetes secret.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dynClient
|
DynamicClient
|
OpenShift dynamic client for cluster API interactions. |
required |
namespace
|
str
|
The namespace where the secret should be created/updated. |
required |
icrUsername
|
str
|
Username for IBM Container Registry (typically "cp"). |
required |
icrPassword
|
str
|
Entitlement key for IBM Container Registry. |
required |
artifactoryUsername
|
str
|
Username for Artifactory access. Defaults to None. |
None
|
artifactoryPassword
|
str
|
Password/token for Artifactory access. Defaults to None. |
None
|
secretName
|
str
|
Name of the secret to create/update. Defaults to "ibm-entitlement". |
'ibm-entitlement'
|
Returns:
| Name | Type | Description |
|---|---|---|
ResourceInstance |
ResourceInstance
|
The created or updated Secret resource. |