mas-cli 9.5.0__py3-none-any.whl → 10.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mas-cli might be problematic. Click here for more details.

Files changed (95) hide show
  1. mas/cli/__init__.py +1 -1
  2. mas/cli/cli.py +82 -65
  3. mas/cli/displayMixins.py +110 -0
  4. mas/cli/gencfg.py +65 -0
  5. mas/cli/install/__init__.py +9 -0
  6. mas/cli/install/argParser.py +792 -0
  7. mas/cli/install/settings/__init__.py +21 -0
  8. mas/cli/install/settings/additionalConfigs.py +150 -0
  9. mas/cli/install/settings/db2Settings.py +173 -0
  10. mas/cli/install/settings/kafkaSettings.py +103 -0
  11. mas/cli/install/settings/manageSettings.py +218 -0
  12. mas/cli/install/settings/turbonomicSettings.py +25 -0
  13. mas/cli/install/summarizer.py +328 -0
  14. mas/cli/templates/ibm-mas-tekton.yaml +10813 -0
  15. mas/cli/templates/jdbccfg.yml.j2 +52 -0
  16. mas/cli/templates/pod-templates/best-effort/ibm-data-dictionary-assetdatadictionary.yml +26 -0
  17. mas/cli/templates/pod-templates/best-effort/ibm-mas-bascfg.yml +56 -0
  18. mas/cli/templates/pod-templates/best-effort/ibm-mas-coreidp.yml +21 -0
  19. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-actions.yml +28 -0
  20. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-auth.yml +32 -0
  21. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-datapower.yml +12 -0
  22. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-devops.yml +14 -0
  23. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-dm.yml +22 -0
  24. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-dsc.yml +40 -0
  25. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-edgeconfig.yml +10 -0
  26. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-fpl.yml +24 -0
  27. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-guardian.yml +20 -0
  28. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-iot.yml +10 -0
  29. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-mbgx.yml +18 -0
  30. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-mfgx.yml +14 -0
  31. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-monitor.yml +18 -0
  32. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-orgmgmt.yml +48 -0
  33. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-provision.yml +28 -0
  34. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-registry.yml +26 -0
  35. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-state.yml +40 -0
  36. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-webui.yml +22 -0
  37. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-healthextaccelerator.yml +13 -0
  38. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-healthextworkspace.yml +10 -0
  39. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-imagestitching.yml +10 -0
  40. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-manageaccelerators.yml +10 -0
  41. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-manageapp.yml +46 -0
  42. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-manageworkspace.yml +48 -0
  43. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-slackproxy.yml +10 -0
  44. mas/cli/templates/pod-templates/best-effort/ibm-mas-pushnotificationcfg.yml +13 -0
  45. mas/cli/templates/pod-templates/best-effort/ibm-mas-scimcfg.yml +14 -0
  46. mas/cli/templates/pod-templates/best-effort/ibm-mas-slscfg.yml +10 -0
  47. mas/cli/templates/pod-templates/best-effort/ibm-mas-smtpcfg.yml +10 -0
  48. mas/cli/templates/pod-templates/best-effort/ibm-mas-suite.yml +136 -0
  49. mas/cli/templates/pod-templates/best-effort/ibm-mas-visualinspection.yml +34 -0
  50. mas/cli/templates/pod-templates/best-effort/ibm-sls-licenseservice.yml +10 -0
  51. mas/cli/templates/pod-templates/guaranteed/ibm-data-dictionary-assetdatadictionary.yml +56 -0
  52. mas/cli/templates/pod-templates/guaranteed/ibm-mas-bascfg.yml +140 -0
  53. mas/cli/templates/pod-templates/guaranteed/ibm-mas-coreidp.yml +45 -0
  54. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-actions.yml +70 -0
  55. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-auth.yml +80 -0
  56. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-datapower.yml +24 -0
  57. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-devops.yml +26 -0
  58. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-dm.yml +52 -0
  59. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-dsc.yml +106 -0
  60. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-edgeconfig.yml +16 -0
  61. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-fpl.yml +62 -0
  62. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-guardian.yml +44 -0
  63. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-iot.yml +16 -0
  64. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-mbgx.yml +42 -0
  65. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-mfgx.yml +32 -0
  66. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-monitor.yml +42 -0
  67. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-orgmgmt.yml +126 -0
  68. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-provision.yml +70 -0
  69. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-registry.yml +62 -0
  70. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-state.yml +106 -0
  71. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-webui.yml +52 -0
  72. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-healthextaccelerator.yml +28 -0
  73. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-healthextworkspace.yml +18 -0
  74. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-imagestitching.yml +16 -0
  75. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-manageaccelerators.yml +16 -0
  76. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-manageapp.yml +106 -0
  77. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-manageworkspace.yml +126 -0
  78. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-slackproxy.yml +16 -0
  79. mas/cli/templates/pod-templates/guaranteed/ibm-mas-pushnotificationcfg.yml +25 -0
  80. mas/cli/templates/pod-templates/guaranteed/ibm-mas-scimcfg.yml +26 -0
  81. mas/cli/templates/pod-templates/guaranteed/ibm-mas-slscfg.yml +16 -0
  82. mas/cli/templates/pod-templates/guaranteed/ibm-mas-smtpcfg.yml +16 -0
  83. mas/cli/templates/pod-templates/guaranteed/ibm-mas-suite.yml +340 -0
  84. mas/cli/templates/pod-templates/guaranteed/ibm-mas-visualinspection.yml +76 -0
  85. mas/cli/templates/pod-templates/guaranteed/ibm-sls-licenseservice.yml +16 -0
  86. mas/cli/templates/pod-templates/saas-essentials/ibm-mas-visualinspection.yml +46 -0
  87. mas/cli/validators.py +126 -0
  88. mas_cli-10.0.1.data/scripts/mas-install +978 -0
  89. {mas_cli-9.5.0.data → mas_cli-10.0.1.data}/scripts/mas-uninstall +11 -8
  90. {mas_cli-9.5.0.data → mas_cli-10.0.1.data}/scripts/mas-upgrade +6 -4
  91. {mas_cli-9.5.0.dist-info → mas_cli-10.0.1.dist-info}/METADATA +2 -1
  92. mas_cli-10.0.1.dist-info/RECORD +94 -0
  93. mas_cli-9.5.0.dist-info/RECORD +0 -8
  94. {mas_cli-9.5.0.dist-info → mas_cli-10.0.1.dist-info}/WHEEL +0 -0
  95. {mas_cli-9.5.0.dist-info → mas_cli-10.0.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,21 @@
1
+ # *****************************************************************************
2
+ # Copyright (c) 2024 IBM Corporation and other Contributors.
3
+ #
4
+ # All rights reserved. This program and the accompanying materials
5
+ # are made available under the terms of the Eclipse Public License v1.0
6
+ # which accompanies this distribution, and is available at
7
+ # http://www.eclipse.org/legal/epl-v10.html
8
+ #
9
+ # *****************************************************************************
10
+
11
+ from .db2Settings import Db2SettingsMixin
12
+ from .kafkaSettings import KafkaSettingsMixin
13
+ from .manageSettings import ManageSettingsMixin
14
+ from .turbonomicSettings import TurbonomicSettingsMixin
15
+ from .additionalConfigs import AdditionalConfigsMixin
16
+
17
+ class InstallSettingsMixin(Db2SettingsMixin, KafkaSettingsMixin, ManageSettingsMixin, TurbonomicSettingsMixin, AdditionalConfigsMixin):
18
+ """
19
+ This class collects all the Mixins providing interactive prompts for mas-install
20
+ """
21
+ pass
@@ -0,0 +1,150 @@
1
+ # *****************************************************************************
2
+ # Copyright (c) 2024 IBM Corporation and other Contributors.
3
+ #
4
+ # All rights reserved. This program and the accompanying materials
5
+ # are made available under the terms of the Eclipse Public License v1.0
6
+ # which accompanies this distribution, and is available at
7
+ # http://www.eclipse.org/legal/epl-v10.html
8
+ #
9
+ # *****************************************************************************
10
+
11
+ from os import path
12
+ from base64 import b64encode
13
+ from glob import glob
14
+ from prompt_toolkit import print_formatted_text
15
+
16
+ import logging
17
+ logger = logging.getLogger(__name__)
18
+
19
+ class AdditionalConfigsMixin():
20
+ def additionalConfigs(self) -> None:
21
+ if self.interactiveMode:
22
+ self.printH1("Additional Configuration")
23
+ self.printDescription([
24
+ "Additional resource definitions can be applied to the OpenShift Cluster during the MAS configuration step",
25
+ "The primary purpose of this is to apply configuration for Maximo Application Suite itself, but you can use this to deploy ANY additional resource into your cluster"
26
+ ])
27
+
28
+ # If the user already set up BYO MongoDb or Kafka then they have already chosen to use additional configs
29
+ if self.localConfigDir is None:
30
+ if self.yesOrNo("Use additional configurations"):
31
+ self.selectLocalConfigDir()
32
+
33
+ # If we've set up a local config directory then provide details about what's included in it
34
+ # and generate the secret that will be used in the pipeline
35
+ if self.localConfigDir is not None:
36
+ # Get list of files in localConfigDir
37
+ configFilesPath = rf'{self.localConfigDir}/*.yaml'
38
+ configFiles = glob(configFilesPath)
39
+ if len(configFiles) == 0:
40
+ self.fatalError(f"No configuration files (*.yaml) were found in {self.localConfigDir}")
41
+
42
+ print_formatted_text("The following additional configurations will be applied:")
43
+ for cf in configFiles:
44
+ print_formatted_text(f" - {path.basename(cf)}")
45
+
46
+ if not self.noConfirm:
47
+ if not self.yesOrNo("Are these the correct configuration files to apply"):
48
+ print_formatted_text("Additional configuration files were not confirmed. Aborting installation")
49
+ exit(0)
50
+
51
+ # Generate the secret and apply it to the cluster
52
+ secret = {
53
+ "apiVersion": "v1",
54
+ "kind": "Secret",
55
+ "type": "Opaque",
56
+ "metadata": {
57
+ "name": "pipeline-additional-configs"
58
+ }
59
+ }
60
+ additionalConfigsSecret = self.addFilesToSecret(secret, self.localConfigDir, "yaml")
61
+ logger.debug(additionalConfigsSecret)
62
+ self.additionalConfigsSecret = additionalConfigsSecret
63
+
64
+ def podTemplates(self) -> None:
65
+ if self.interactiveMode:
66
+ self.printH1("Configure Pod Templates")
67
+ self.printDescription([
68
+ "The CLI supports two pod template profiles out of the box that allow you to reconfigure MAS for either a guaranteed or best effort QoS level",
69
+ "For more information about the Kubernetes quality of service (QoS) levels, see https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/",
70
+ "You may also choose to use your own customized pod template definitions",
71
+ ""
72
+ ])
73
+
74
+ if not self.yesOrNo("Use pod templates"):
75
+ return
76
+
77
+ self.printDescription([
78
+ "Make a selection from the list below:",
79
+ "",
80
+ "1. Guaranteed QoS",
81
+ "2. Best Effort QoS",
82
+ "3. Custom",
83
+ ""
84
+ ])
85
+
86
+ podTemplateChoice = self.promptForInt("Select pod templates profile")
87
+
88
+ if podTemplateChoice == 1:
89
+ self.setParam("mas_pod_templates_dir", path.join(self.templatesDir, "pod-templates", "guaranteed"))
90
+ elif podTemplateChoice == 2:
91
+ self.setParam("mas_pod_templates_dir", path.join(self.templatesDir, "pod-templates", "best-effort"))
92
+ elif podTemplateChoice == 3:
93
+ self.promptForDir("Pod templates directory", "mas_pod_templates_dir", mustExist=True)
94
+ else:
95
+ self.fatalError(f"Invalid selection: {podTemplateChoice}")
96
+
97
+ if self.getParam("mas_pod_templates_dir") != "":
98
+ templateFilesPath = rf'{self.getParam("mas_pod_templates_dir")}/*.yml'
99
+ templateFiles = glob(templateFilesPath)
100
+ if len(templateFiles) == 0:
101
+ self.fatalError(f"No pod templates (*.yml) were found in {self.getParam('mas_pod_templates_dir')}")
102
+
103
+ print_formatted_text("The following pod templates will be applied:")
104
+ for tf in templateFiles:
105
+ print_formatted_text(f" - {path.basename(tf)}")
106
+
107
+ if not self.noConfirm:
108
+ if not self.yesOrNo("Are these the correct pod templates to apply"):
109
+ print_formatted_text("Pod templates were not confirmed. Aborting installation")
110
+ exit(0)
111
+
112
+ # Generate the secret and apply it to the cluster
113
+ secret = {
114
+ "apiVersion": "v1",
115
+ "kind": "Secret",
116
+ "type": "Opaque",
117
+ "metadata": {
118
+ "name": "pipeline-pod-templates"
119
+ }
120
+ }
121
+ podTemplatesSecret = self.addFilesToSecret(secret, self.getParam("mas_pod_templates_dir"), "yml")
122
+ logger.debug(podTemplatesSecret)
123
+ self.podTemplatesSecret = podTemplatesSecret
124
+
125
+ def addFilesToSecret(self, secretDict: dict, configPath: str, extension: str) -> dict:
126
+ """
127
+ Add file (or files) to pipeline-additional-configs
128
+ """
129
+ filesToProcess = []
130
+ if path.isdir(configPath):
131
+ logger.debug(f"Adding all config files in directory {configPath}")
132
+ filesToProcess = glob(f"{configPath}/*.{extension}")
133
+ else:
134
+ logger.debug(f"Adding config file {configPath}")
135
+ filesToProcess = [configPath]
136
+
137
+ for fileToProcess in filesToProcess:
138
+ logger.debug(f" * Processing config file {fileToProcess}")
139
+ fileName = path.basename(fileToProcess)
140
+
141
+ # Load the file
142
+ with open(fileToProcess, 'r') as file:
143
+ data = file.read()
144
+
145
+ # Add/update an entry to the secret data
146
+ if "data" not in secretDict:
147
+ secretDict["data"] = {}
148
+ secretDict["data"][fileName] = b64encode(data.encode('ascii')).decode("ascii")
149
+
150
+ return secretDict
@@ -0,0 +1,173 @@
1
+ # *****************************************************************************
2
+ # Copyright (c) 2024 IBM Corporation and other Contributors.
3
+ #
4
+ # All rights reserved. This program and the accompanying materials
5
+ # are made available under the terms of the Eclipse Public License v1.0
6
+ # which accompanies this distribution, and is available at
7
+ # http://www.eclipse.org/legal/epl-v10.html
8
+ #
9
+ # *****************************************************************************
10
+
11
+ from os import path
12
+ from prompt_toolkit import print_formatted_text
13
+
14
+ class Db2SettingsMixin():
15
+ def configDb2(self) -> None:
16
+ self.printH1("Configure Databases")
17
+ # The channel used for Db2 used has not changed since the January 2024 catalog update
18
+ self.params["db2_channel"] = "v110509.0"
19
+
20
+ if not self.installIoT and not self.installManage:
21
+ print_formatted_text("No applications have been selected that require a Db2 installation")
22
+ self.setParam("db2_action_system", "none")
23
+ self.setParam("db2_action_manage", "none")
24
+ return
25
+
26
+ self.printDescription([
27
+ "The installer can setup one or more IBM Db2 instances in your OpenShift cluster for the use of applications that require a JDBC datasource (IoT, Manage, Monitor, & Predict) or you may choose to configure MAS to use an existing database"
28
+ ])
29
+
30
+ self.setParam("db2_cpu_requests", "4000m")
31
+ self.setParam("db2_cpu_limits", "6000m")
32
+ self.setParam("db2_memory_requests", "8Gi")
33
+ self.setParam("db2_memory_limits", "12Gi")
34
+
35
+ if self.isSNO():
36
+ # Set smaller defaults for SNO deployments
37
+ self.setParam("db2_meta_storage_size", "10Gi")
38
+ self.setParam("db2_backup_storage_size", "10Gi")
39
+ self.setParam("db2_logs_storage_size", "10Gi")
40
+ self.setParam("db2_temp_storage_size", "10Gi")
41
+ self.setParam("db2_data_storage_size", "20Gi")
42
+
43
+ # Configure the access mode to RWO
44
+ self.params["db2_meta_storage_accessmode"] = "ReadWriteOnce"
45
+ self.params["db2_backup_storage_accessmode"] = "ReadWriteOnce"
46
+ self.params["db2_logs_storage_accessmode"] = "ReadWriteOnce"
47
+ self.params["db2_data_storage_accessmode"] = "ReadWriteOnce"
48
+
49
+ # Also reduce the CPU requests
50
+ self.params["db2_cpu_requests"] = "300m"
51
+ else:
52
+ self.setParam("db2_meta_storage_size", "20Gi")
53
+ self.setParam("db2_backup_storage_size", "100Gi")
54
+ self.setParam("db2_logs_storage_size", "100Gi")
55
+ self.setParam("db2_temp_storage_size", "100Gi")
56
+ self.setParam("db2_data_storage_size", "100Gi")
57
+
58
+ instanceId = self.getParam('mas_instance_id')
59
+ # Do we need to set up an IoT database?
60
+ if self.installIoT:
61
+ self.printH2("Database Configuration for Maximo IoT")
62
+ self.printDescription([
63
+ "Maximo IoT requires a shared system-scope Db2 instance because others application in the suite require access to the same database source",
64
+ " - Only IBM Db2 is supported for this database"
65
+ ])
66
+ if self.yesOrNo("Create system Db2 instance using the IBM Db2 Universal Operator"):
67
+ self.setParam("db2_action_system", "install")
68
+ else:
69
+ self.setParam("db2_action_system", "byo")
70
+
71
+ self.selectLocalConfigDir()
72
+
73
+ # Check if a configuration already exists before creating a new one
74
+ jdbcCfgFile = path.join(self.localConfigDir, f"jdbc-{instanceId}-system.yaml")
75
+ print_formatted_text(f"Searching for system database configuration file in {jdbcCfgFile} ...")
76
+ if path.exists(jdbcCfgFile):
77
+ if self.yesOrNo(f"System database configuration file 'jdbc-{instanceId}-system.yaml' already exists. Do you want to generate a new one"):
78
+ self.generateJDBCCfg(instanceId=instanceId, scope="system", destination=jdbcCfgFile)
79
+ else:
80
+ print_formatted_text(f"Expected file ({jdbcCfgFile}) was not found, generating a valid system database configuration file now ...")
81
+ self.generateJDBCCfg(instanceId=instanceId, scope="system", destination=jdbcCfgFile)
82
+ else:
83
+ self.setParam("db2_action_system", "none")
84
+
85
+ if self.installManage:
86
+ self.printH2("Database Configuration for Maximo Manage")
87
+ self.printDescription([
88
+ "Maximo Manage can be configured to share the system Db2 instance or use it's own dedicated database:",
89
+ " - Use of a shared instance has a significant footprint reduction but is only recommended for development/test/demo installs",
90
+ " - In most production systems you will want to use a dedicated database",
91
+ " - IBM Db2, Oracle Database, & Microsoft SQL Server are all supported database options"
92
+ ])
93
+ # Determine whether to use the system or a dedicated database
94
+ if self.installIoT and self.yesOrNo("Re-use System Db2 instance for Manage application"):
95
+ # We are going to bind Manage to the system database, which has already been set up in the previous step
96
+ self.setParam("mas_appws_bindings_jdbc_manage", "system")
97
+ self.setParam("db2_action_manage", "none")
98
+ else:
99
+ self.setParam("mas_appws_bindings_jdbc_manage", "workspace-application")
100
+ if self.yesOrNo("Create manage dedicated Db2 instance using the IBM Db2 Universal Operator"):
101
+ self.setParam("db2_action_manage", "install")
102
+ self.printDescription([
103
+ "Available Db2 instance types for Manage:",
104
+ " 1. DB2 Warehouse (Default option)",
105
+ " 2. DB2 Online Transactional Processing (OLTP)"
106
+ ])
107
+ self.promptForListSelect(message="Select the Manage dedicated DB2 instance type", options=["db2wh", "db2oltp"], param="db2oltp", default="db2wh")
108
+ else:
109
+ workspaceId = self.getParam("mas_workspace_id")
110
+ self.setParam("db2_action_manage", "byo")
111
+
112
+ self.selectLocalConfigDir()
113
+
114
+ # Check if a configuration already exists before creating a new one
115
+ jdbcCfgFile = path.join(self.localConfigDir, f"jdbc-{instanceId}-manage.yaml")
116
+ print_formatted_text(f"Searching for Manage database configuration file in {jdbcCfgFile} ...")
117
+ if path.exists(jdbcCfgFile):
118
+ if self.yesOrNo(f"Manage database configuration file 'jdbc-{instanceId}-manage.yaml' already exists. Do you want to generate a new one"):
119
+ self.generateJDBCCfg(instanceId=instanceId, scope="workspace-application", workspaceId=workspaceId, appId="manage", destination=jdbcCfgFile)
120
+ else:
121
+ print_formatted_text(f"Expected file ({jdbcCfgFile}) was not found, generating a valid Manage database configuration file now ...")
122
+ self.generateJDBCCfg(instanceId=instanceId, scope="workspace-application", workspaceId=workspaceId, appId="manage", destination=jdbcCfgFile)
123
+ else:
124
+ self.setParam("db2_action_manage", "none")
125
+
126
+
127
+ # Do we need to configure Db2u?
128
+ if self.getParam("db2_action_system") == "install" or self.getParam("db2_action_manage") == "install":
129
+ self.printH2("Installation Namespace")
130
+ self.promptForString("Install namespace", "db2_namespace", default="db2u")
131
+
132
+ # Node Affinity & Tolerations
133
+ # -------------------------------------------------------------------------
134
+ self.printH2("Node Affinity and Tolerations")
135
+ self.printDescription([
136
+ "Note that the same settings are applied to both the IoT and Manage Db2 instances",
137
+ "Use existing node labels and taints to control scheduling of the Db2 workload in your cluster",
138
+ "For more information refer to the Red Hat documentation:",
139
+ " - <u>https://docs.openshift.com/container-platform/4.12/nodes/scheduling/nodes-scheduler-node-affinity.html</u>",
140
+ " - <u>https://docs.openshift.com/container-platform/4.12/nodes/scheduling/nodes-scheduler-taints-tolerations.html</u>"
141
+ ])
142
+
143
+ if self.yesOrNo("Configure node affinity"):
144
+ self.promptForString(" + Key", "db2_affinity_key")
145
+ self.promptForString(" + Value", "db2_affinity_value")
146
+
147
+ if self.yesOrNo("Configure node tolerations"):
148
+ self.promptForString(" + Key", "db2_tolerate_key")
149
+ self.promptForString(" + Value", "db2_tolerate_value")
150
+ self.promptForString(" + Effect", "db2_tolerate_effect")
151
+
152
+ self.printH2("Database CPU & Memory")
153
+ self.printDescription([
154
+ "Note that the same settings are applied to both the IoT and Manage Db2 instances"
155
+ ])
156
+
157
+ if self.yesOrNo("Customize CPU and memory request/limit"):
158
+ self.promptForString(" + CPU Request", "db2_cpu_requests", default=self.getParam("db2_cpu_requests"))
159
+ self.promptForString(" + CPU Limit", "db2_cpu_limits", default=self.getParam("db2_cpu_limits"))
160
+ self.promptForString(" + Memory Request", "db2_memory_requests", default=self.getParam("db2_memory_requests"))
161
+ self.promptForString(" + Memory Limit", "db2_memory_limits", default=self.getParam("db2_memory_limits"))
162
+
163
+ self.printH2("Database Storage Capacity")
164
+ self.printDescription([
165
+ "Note that the same settings are applied to both the IoT and Manage Db2 instances"
166
+ ])
167
+
168
+ if self.yesOrNo("Customize storage capacity"):
169
+ self.promptForString(" + Data Volume", "db2_data_storage_size", default=self.getParam("db2_data_storage_size"))
170
+ self.promptForString(" + Temporary Volume", "db2_temp_storage_size", default=self.getParam("db2_temp_storage_size"))
171
+ self.promptForString(" + Metadata Volume", "db2_meta_storage_size", default=self.getParam("db2_meta_storage_size"))
172
+ self.promptForString(" + Transaction Logs Volume", "db2_logs_storage_size", default=self.getParam("db2_logs_storage_size"))
173
+ self.promptForString(" + Backup Volume", "db2_backup_storage_size", default=self.getParam("db2_backup_storage_size"))
@@ -0,0 +1,103 @@
1
+ # *****************************************************************************
2
+ # Copyright (c) 2024 IBM Corporation and other Contributors.
3
+ #
4
+ # All rights reserved. This program and the accompanying materials
5
+ # are made available under the terms of the Eclipse Public License v1.0
6
+ # which accompanies this distribution, and is available at
7
+ # http://www.eclipse.org/legal/epl-v10.html
8
+ #
9
+ # *****************************************************************************
10
+
11
+ from os import path
12
+ from prompt_toolkit import print_formatted_text
13
+
14
+ class KafkaSettingsMixin():
15
+ def configKafka(self) -> None:
16
+ if self.installIoT:
17
+ self.printH1("Configure Kafka")
18
+ self.printDescription([
19
+ "Maximo IoT requires a shared system-scope Kafka instance",
20
+ "Supported Kafka providers: Strimzi, Red Hat AMQ Streams, IBM Cloud Event Streams and AWS MSK",
21
+ "You may also choose to configure MAS to use an existing Kafka instance by providing a pre-existing configuration file",
22
+ ""
23
+ ])
24
+ if self.yesOrNo("Create system Kafka instance using one of the supported providers"):
25
+ self.setParam("kafka_action_system", "install")
26
+
27
+ self.printDescription([
28
+ "",
29
+ "Kafka Provider:",
30
+ " 1. Strimzi (opensource)",
31
+ " 2. Red Hat AMQ Streams (requires a separate license)",
32
+ " 3. IBM Cloud Event Streams (paid IBM Cloud service)",
33
+ " 4. AWS MSK (paid AWS service)",
34
+ ""
35
+ ])
36
+ self.promptForListSelect("Select Kafka provider", ["strimzi", "redhat", "ibm", "aws"], "kafka_provider")
37
+
38
+ if self.getParam("kafka_provider") == "strimzi":
39
+ self.printDescription([
40
+ "",
41
+ "Strimzi: Cluster Version",
42
+ "The version of the Strimzi operator available on your cluster will determine the supported versions of Kafka that can be deployed.",
43
+ " - If you are using the latest available operator catalog then the default version below can be accepted",
44
+ " - If you are using older operator catalogs (e.g. in a disconnected install) you should confirm the supported versions in your OperatorHub",
45
+ ""
46
+ ])
47
+ self.promptForString("Install namespace", "kafka_namespace", default="strimzi")
48
+ self.promptForString("Kafka version", "kafka_version", default="3.7.0")
49
+
50
+ elif self.getParam("kafka_provider") == "redhat":
51
+ self.printDescription([
52
+ "",
53
+ "Red Hat AMQ Streams: Cluster Version",
54
+ "The version of the Red Hat AMQ Streams operator available on your cluster will determine the supported versions of Kafka that can be deployed.",
55
+ " - If you are using the latest available operator catalog then the default version below can be accepted",
56
+ " - If you are using older operator catalogs (e.g. in a disconnected install) you should confirm the supported versions in your OperatorHub",
57
+ ""
58
+ ])
59
+ self.promptForString("Install namespace", "kafka_namespace", default="amq-streams")
60
+ self.promptForString("Kafka version", "kafka_version", default="3.5.0")
61
+
62
+ elif self.getParam("kafka_provider") == "ibm":
63
+ print()
64
+ self.promptForString("IBM Cloud API Key", "ibmcloud_apikey", isPassword=True)
65
+ self.promptForString("IBM Event Streams resource group" "eventstreams_resourcegroup", default="Default")
66
+ self.promptForString("IBM Event Streams instance name", "eventstreams_name", default=f"eventstreams-{self.getParam('mas_instance_id')}")
67
+ self.promptForString("IBM Event Streams location", "eventstreams_location", default="us-east")
68
+
69
+ elif self.getParam("kafka_provider") == "aws":
70
+ self.printDescription([
71
+ "",
72
+ "While provisioning the AWS MSK instance, you will be required to provide the AWS Virtual Private Cloud ID and subnet details",
73
+ "where your instance will be deployed to properly configure inbound and outbound connectivity.",
74
+ "You should be able to find these information inside your VPC and subnet configurations in the target AWS account.",
75
+ "For more details about AWS subnet/CIDR configuration, refer: https://docs.aws.amazon.com/vpc/latest/userguide/subnet-sizing.html",
76
+ ""
77
+ ])
78
+ self.promptForString("AWS Access Key ID", "aws_access_key_id", isPassword=True)
79
+ self.promptForString("AWS Secret Access Key" "aws_secret_access_key", isPassword=True)
80
+ self.promptForString("AWS Region", "aws_region", default="us-east-1")
81
+ self.promptForString("Virtual Private Cloud (VPC) ID", "vpc_id")
82
+ self.promptForString("MSK Instance Username", "aws_kafka_user_name", default="masuser")
83
+ self.promptForString("MSK Instance Password", "aws_kafka_user_password", isPassword=True)
84
+ self.promptForString("MSK Instance Type", "aws_msk_instance_type", default="kafka.m5.large")
85
+ self.promptForString("MSK Total Number of Broker Nodes", "aws_msk_instance_number", default="3")
86
+ self.promptForString("MSK Storage Size (in GB)", "aws_msk_volume_size", defauklt="100")
87
+ self.promptForString("Availability Zone 1 CIDR", "aws_msk_cidr_az1")
88
+ self.promptForString("Availability Zone 2 CIDR", "aws_msk_cidr_az2")
89
+ self.promptForString("Availability Zone 3 CIDR", "aws_msk_cidr_az3")
90
+ self.promptForString("Ingress CIDR", "aws_msk_ingress_cidr")
91
+ self.promptForString("Egress CIDR", "aws_msk_egress_cidr")
92
+ else:
93
+ self.setParam("kafka_action_system", "byo")
94
+ self.selectLocalConfigDir()
95
+ instanceId = self.getParam('mas_instance_id')
96
+
97
+ # Check if a configuration already exists
98
+ kafkaCfgFile = path.join(self.localConfigDir, f"kafka-{instanceId}-system.yaml")
99
+ print_formatted_text(f"Searching for system kafka configuration file in {kafkaCfgFile} ...")
100
+ if path.exists(kafkaCfgFile):
101
+ print_formatted_text(f"Provided Kafka configuration file {kafkaCfgFile} will be applied")
102
+ else:
103
+ self.fatalError(f"Kafka configuration file does not exist: '{kafkaCfgFile}'. In order to continue, provide an existing Kafka configuration file or choose one of the supported Kafka providers to be installed")