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 |
SimpleNamespace
|
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. |
Source code in src/mas/devops/mas/suite.py
getMasPublicClusterIssuer(dynClient, instanceId)
Retrieve the Public Cluster Issuer for a MAS instance.
This function queries the Suite custom resource and attempts to retrieve the certificate issuer name from spec.certificateIssuer.name. If the keys don't exist, it returns the default issuer name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dynClient
|
DynamicClient
|
OpenShift dynamic client for cluster API interactions. |
required |
instanceId
|
str
|
The MAS instance identifier to use. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str | None
|
The name of the cluster issuer used for the passed in MAS Instance. Returns the default "mas-{instanceId}-core-public-issuer" if the suite doesn't specify a custom issuer, or None if the suite is not found. |
Source code in src/mas/devops/mas/suite.py
getPermissionMode(dynClient, instanceId)
Detect the current RBAC permission mode for a MAS instance.
This function determines whether MAS is installed with cluster-level permissions, namespace-scoped permissions (essential + non-essential), or minimal essential-only permissions by checking for the existence of RBAC resources in the cluster.
RBAC Resource Distribution: - Cluster mode: ClusterRoles + Essential Roles - Namespaced mode: Essential Roles + Non-essential Roles - Minimal mode: Essential Roles ONLY
Detection Logic: 1. Check for ClusterRoles → cluster mode 2. Check for non-essential openshift-marketplace Role → namespaced mode 3. No ClusterRole and no openshift-marketplace Role → minimal mode
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 | None
|
Permission mode - "cluster", "namespaced", or "minimal" Returns None if unable to determine (e.g., no RBAC resources found) |
Source code in src/mas/devops/mas/suite.py
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | |