MAS Apps Module
The mas.apps module provides functions for MAS application management.
apps
Functions
getAppResource(dynClient, instanceId, applicationId, workspaceId=None)
Retrieve a MAS application or workspace custom resource.
This function fetches either an application-level CR (e.g., ManageApp) or a workspace-level CR (e.g., ManageWorkspace) depending on whether workspaceId is provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dynClient
|
DynamicClient
|
OpenShift dynamic client for cluster API interactions. |
required |
instanceId
|
str
|
The MAS instance identifier (e.g., "inst1"). |
required |
applicationId
|
str
|
The MAS application identifier (e.g., "manage", "iot", "monitor"). |
required |
workspaceId
|
str
|
The workspace identifier. If provided, retrieves workspace CR. Defaults to None (retrieves application CR). |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
ResourceInstance |
bool
|
The custom resource object if found, None otherwise. Returns None if the resource doesn't exist, CRD is missing, or authorization fails. |
Source code in src/mas/devops/mas/apps.py
verifyAppInstance(dynClient, instanceId, applicationId)
Verify that a MAS application 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. |
required |
applicationId
|
str
|
The MAS application identifier (e.g., "manage", "iot"). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the application instance exists, False otherwise. |
Source code in src/mas/devops/mas/apps.py
waitForAppReady(dynClient, instanceId, applicationId, workspaceId=None, retries=100, delay=600, debugLogFunction=logger.debug, infoLogFunction=logger.info)
Wait for a MAS application or workspace to reach ready state.
This function polls the application/workspace custom resource until its Ready condition status becomes True, or until the retry limit is reached. It checks the status.conditions array for a condition with type="Ready" and status="True".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dynClient
|
DynamicClient
|
OpenShift dynamic client for cluster API interactions. |
required |
instanceId
|
str
|
The MAS instance identifier. |
required |
applicationId
|
str
|
The MAS application identifier (e.g., "manage", "iot"). |
required |
workspaceId
|
str
|
The workspace identifier. If provided, waits for workspace CR. Defaults to None (waits for application CR). |
None
|
retries
|
int
|
Maximum number of polling attempts. Defaults to 100. |
100
|
delay
|
int
|
Delay in seconds between polling attempts. Defaults to 600 (10 minutes). |
600
|
debugLogFunction
|
callable
|
Function for debug logging. Defaults to logger.debug. |
debug
|
infoLogFunction
|
callable
|
Function for info logging. Defaults to logger.info. |
info
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the resource reaches ready state within the retry limit, False otherwise. |
Source code in src/mas/devops/mas/apps.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
getAppsSubscriptionChannel(dynClient, instanceId)
Retrieve the OLM subscription channels for all installed MAS applications.
This function queries the Operator Lifecycle Manager subscriptions for each known MAS application and returns a list of installed applications with their update channels.
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 |
|---|---|---|
list |
list
|
List of dictionaries with 'appId' and 'channel' keys for each installed app. Returns empty list if no apps are found or if errors occur. |