mas-cli 5.1.4__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 (114) hide show
  1. mas/cli/__init__.py +11 -0
  2. mas/cli/aiservice/install/__init__.py +11 -0
  3. mas/cli/aiservice/install/app.py +894 -0
  4. mas/cli/aiservice/install/argBuilder.py +180 -0
  5. mas/cli/aiservice/install/argParser.py +507 -0
  6. mas/cli/aiservice/install/params.py +100 -0
  7. mas/cli/aiservice/install/summarizer.py +134 -0
  8. mas/cli/cli.py +432 -0
  9. mas/cli/displayMixins.py +132 -0
  10. mas/cli/gencfg.py +113 -0
  11. mas/cli/install/__init__.py +11 -0
  12. mas/cli/install/app.py +1316 -0
  13. mas/cli/install/argBuilder.py +465 -0
  14. mas/cli/install/argParser.py +1176 -0
  15. mas/cli/install/catalogs.py +27 -0
  16. mas/cli/install/params.py +172 -0
  17. mas/cli/install/settings/__init__.py +23 -0
  18. mas/cli/install/settings/additionalConfigs.py +227 -0
  19. mas/cli/install/settings/db2Settings.py +252 -0
  20. mas/cli/install/settings/kafkaSettings.py +103 -0
  21. mas/cli/install/settings/manageSettings.py +273 -0
  22. mas/cli/install/settings/mongodbSettings.py +46 -0
  23. mas/cli/install/settings/turbonomicSettings.py +29 -0
  24. mas/cli/install/summarizer.py +398 -0
  25. mas/cli/templates/facilities-configs.yml.j2 +25 -0
  26. mas/cli/templates/ibm-mas-tekton.yaml +49772 -0
  27. mas/cli/templates/jdbccfg.yml.j2 +52 -0
  28. mas/cli/templates/pod-templates/best-effort/ibm-data-dictionary-assetdatadictionary.yml +26 -0
  29. mas/cli/templates/pod-templates/best-effort/ibm-mas-bascfg.yml +56 -0
  30. mas/cli/templates/pod-templates/best-effort/ibm-mas-coreidp.yml +21 -0
  31. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-actions.yml +28 -0
  32. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-auth.yml +32 -0
  33. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-datapower.yml +12 -0
  34. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-devops.yml +14 -0
  35. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-dm.yml +22 -0
  36. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-dsc.yml +40 -0
  37. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-edgeconfig.yml +10 -0
  38. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-fpl.yml +24 -0
  39. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-guardian.yml +20 -0
  40. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-iot.yml +10 -0
  41. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-mbgx.yml +18 -0
  42. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-mfgx.yml +14 -0
  43. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-monitor.yml +18 -0
  44. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-orgmgmt.yml +48 -0
  45. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-provision.yml +28 -0
  46. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-registry.yml +26 -0
  47. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-state.yml +40 -0
  48. mas/cli/templates/pod-templates/best-effort/ibm-mas-iot-webui.yml +22 -0
  49. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-healthextaccelerator.yml +13 -0
  50. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-healthextworkspace.yml +10 -0
  51. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-imagestitching.yml +10 -0
  52. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-manageaccelerators.yml +10 -0
  53. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-manageapp.yml +46 -0
  54. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-manageworkspace.yml +48 -0
  55. mas/cli/templates/pod-templates/best-effort/ibm-mas-manage-slackproxy.yml +10 -0
  56. mas/cli/templates/pod-templates/best-effort/ibm-mas-pushnotificationcfg.yml +13 -0
  57. mas/cli/templates/pod-templates/best-effort/ibm-mas-scimcfg.yml +14 -0
  58. mas/cli/templates/pod-templates/best-effort/ibm-mas-slscfg.yml +10 -0
  59. mas/cli/templates/pod-templates/best-effort/ibm-mas-smtpcfg.yml +10 -0
  60. mas/cli/templates/pod-templates/best-effort/ibm-mas-suite.yml +136 -0
  61. mas/cli/templates/pod-templates/best-effort/ibm-mas-visualinspection.yml +34 -0
  62. mas/cli/templates/pod-templates/best-effort/ibm-sls-licenseservice.yml +10 -0
  63. mas/cli/templates/pod-templates/guaranteed/ibm-data-dictionary-assetdatadictionary.yml +56 -0
  64. mas/cli/templates/pod-templates/guaranteed/ibm-mas-bascfg.yml +140 -0
  65. mas/cli/templates/pod-templates/guaranteed/ibm-mas-coreidp.yml +45 -0
  66. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-actions.yml +70 -0
  67. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-auth.yml +80 -0
  68. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-datapower.yml +24 -0
  69. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-devops.yml +26 -0
  70. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-dm.yml +52 -0
  71. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-dsc.yml +106 -0
  72. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-edgeconfig.yml +16 -0
  73. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-fpl.yml +62 -0
  74. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-guardian.yml +44 -0
  75. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-iot.yml +16 -0
  76. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-mbgx.yml +42 -0
  77. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-mfgx.yml +32 -0
  78. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-monitor.yml +42 -0
  79. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-orgmgmt.yml +126 -0
  80. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-provision.yml +70 -0
  81. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-registry.yml +62 -0
  82. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-state.yml +106 -0
  83. mas/cli/templates/pod-templates/guaranteed/ibm-mas-iot-webui.yml +52 -0
  84. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-healthextaccelerator.yml +28 -0
  85. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-healthextworkspace.yml +18 -0
  86. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-imagestitching.yml +16 -0
  87. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-manageaccelerators.yml +16 -0
  88. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-manageapp.yml +106 -0
  89. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-manageworkspace.yml +126 -0
  90. mas/cli/templates/pod-templates/guaranteed/ibm-mas-manage-slackproxy.yml +16 -0
  91. mas/cli/templates/pod-templates/guaranteed/ibm-mas-pushnotificationcfg.yml +25 -0
  92. mas/cli/templates/pod-templates/guaranteed/ibm-mas-scimcfg.yml +26 -0
  93. mas/cli/templates/pod-templates/guaranteed/ibm-mas-slscfg.yml +16 -0
  94. mas/cli/templates/pod-templates/guaranteed/ibm-mas-smtpcfg.yml +16 -0
  95. mas/cli/templates/pod-templates/guaranteed/ibm-mas-suite.yml +340 -0
  96. mas/cli/templates/pod-templates/guaranteed/ibm-mas-visualinspection.yml +76 -0
  97. mas/cli/templates/pod-templates/guaranteed/ibm-sls-licenseservice.yml +16 -0
  98. mas/cli/templates/suite_mongocfg.yml.j2 +55 -0
  99. mas/cli/uninstall/__init__.py +11 -0
  100. mas/cli/uninstall/app.py +197 -0
  101. mas/cli/uninstall/argParser.py +115 -0
  102. mas/cli/update/__init__.py +11 -0
  103. mas/cli/update/app.py +673 -0
  104. mas/cli/update/argParser.py +156 -0
  105. mas/cli/upgrade/__init__.py +11 -0
  106. mas/cli/upgrade/app.py +164 -0
  107. mas/cli/upgrade/argParser.py +68 -0
  108. mas/cli/upgrade/settings/__init__.py +19 -0
  109. mas/cli/validators.py +151 -0
  110. mas_cli-5.1.4.data/scripts/mas-cli +87 -0
  111. mas_cli-5.1.4.dist-info/METADATA +73 -0
  112. mas_cli-5.1.4.dist-info/RECORD +114 -0
  113. mas_cli-5.1.4.dist-info/WHEEL +5 -0
  114. mas_cli-5.1.4.dist-info/top_level.txt +1 -0
@@ -0,0 +1,27 @@
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
+ supportedCatalogs = {
11
+ "amd64": [
12
+ "v9-250731-amd64",
13
+ "v9-250624-amd64",
14
+ "v9-250501-amd64",
15
+ "v9-250403-amd64",
16
+ ],
17
+ "s390x": [
18
+ "v9-250731-s390x",
19
+ "v9-250624-s390x",
20
+ "v9-250501-s390x",
21
+ "v9-250403-s390x",
22
+ ],
23
+ "ppc64le": [
24
+ "v9-250731-ppc64le",
25
+ "v9-250624-ppc64le",
26
+ ],
27
+ }
@@ -0,0 +1,172 @@
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
+ requiredParams = [
12
+ # MAS
13
+ "mas_catalog_version",
14
+ "mas_channel",
15
+ "mas_instance_id",
16
+ "mas_workspace_id",
17
+ "mas_workspace_name",
18
+ # Storage classes
19
+ "storage_class_rwo",
20
+ "storage_class_rwx",
21
+ # Entitlement
22
+ "ibm_entitlement_key",
23
+ # DRO
24
+ "uds_contact_email",
25
+ "uds_contact_firstname",
26
+ "uds_contact_lastname"
27
+ ]
28
+
29
+ optionalParams = [
30
+ # Pipeline
31
+ "image_pull_policy",
32
+ "service_account_name",
33
+ # OpenShift
34
+ "ocp_ingress_tls_secret_name",
35
+ # MAS
36
+ "mas_catalog_digest",
37
+ "mas_superuser_username",
38
+ "mas_superuser_password",
39
+ "mas_trust_default_cas",
40
+ "mas_app_settings_server_bundles_size",
41
+ "mas_app_settings_default_jms",
42
+ "mas_app_settings_persistent_volumes_flag",
43
+ "mas_app_settings_demodata",
44
+ "mas_app_settings_customization_archive_name",
45
+ "mas_app_settings_customization_archive_url",
46
+ "mas_app_settings_customization_archive_username",
47
+ "mas_app_settings_customization_archive_password",
48
+ "mas_app_settings_tablespace",
49
+ "mas_app_settings_indexspace",
50
+ "mas_app_settings_db2_schema",
51
+ "mas_app_settings_crypto_key",
52
+ "mas_app_settings_cryptox_key",
53
+ "mas_app_settings_old_crypto_key",
54
+ "mas_app_settings_old_cryptox_key",
55
+ "mas_app_settings_override_encryption_secrets_flag",
56
+ "mas_app_settings_base_lang",
57
+ "mas_app_settings_secondary_langs",
58
+ "mas_app_settings_server_timezone",
59
+ "mas_appws_bindings_jdbc_manage",
60
+ "mas_appws_components",
61
+ "mas_appws_bindings_health_wsl_flag",
62
+ "mas_domain",
63
+ "mas_appws_upgrade_type",
64
+ # IPV6
65
+ "enable_ipv6",
66
+ # SLS
67
+ "sls_namespace",
68
+ # DNS Providers
69
+ # TODO: Add CloudFlare and Route53 support
70
+ "dns_provider",
71
+ "cis_email",
72
+ "cis_apikey",
73
+ "cis_crn",
74
+ "cis_subdomain",
75
+ "mas_cluster_issuer",
76
+ # DRO
77
+ "dro_namespace",
78
+ # Db2
79
+ "db2_action_system",
80
+ "db2_action_manage",
81
+ "db2_action_facilities",
82
+ "db2_type",
83
+ "db2_timezone",
84
+ "db2_namespace",
85
+ "db2_channel",
86
+ "db2_affinity_key",
87
+ "db2_affinity_value",
88
+ "db2_tolerate_key",
89
+ "db2_tolerate_value",
90
+ "db2_tolerate_effect",
91
+ "db2_cpu_requests",
92
+ "db2_cpu_limits",
93
+ "db2_memory_requests",
94
+ "db2_memory_limits",
95
+ "db2_backup_storage_size",
96
+ "db2_data_storage_size",
97
+ "db2_logs_storage_size",
98
+ "db2_meta_storage_size",
99
+ "db2_temp_storage_size",
100
+ # CP4D
101
+ "cpd_product_version",
102
+ "cpd_install_cognos",
103
+ "cpd_install_spss",
104
+ "cpd_install_ws",
105
+ "cpd_install_wml",
106
+ "cpd_install_ae",
107
+ # Kafka
108
+ "kafka_namespace",
109
+ "kafka_version",
110
+ "aws_msk_instance_type",
111
+ "aws_msk_instance_number",
112
+ "aws_msk_volume_size",
113
+ "aws_msk_cidr_az1",
114
+ "aws_msk_cidr_az2",
115
+ "aws_msk_cidr_az3",
116
+ "aws_msk_egress_cidr",
117
+ "aws_msk_ingress_cidr",
118
+ "eventstreams_resourcegroup",
119
+ "eventstreams_name",
120
+ "eventstreams_location",
121
+ # COS
122
+ "cos_type",
123
+ "cos_resourcegroup",
124
+ "cos_apikey",
125
+ "cos_instance_name",
126
+ "cos_bucket_name",
127
+ # Attachments
128
+ "mas_manage_attachments_provider",
129
+ "mas_manage_attachment_configuration_mode",
130
+ # ECK
131
+ "eck_action",
132
+ "eck_enable_logstash",
133
+ "eck_remote_es_hosts",
134
+ "eck_remote_es_username",
135
+ "eck_remote_es_password",
136
+ # Turbonomic
137
+ "turbonomic_target_name",
138
+ "turbonomic_server_url",
139
+ "turbonomic_server_version",
140
+ "turbonomic_username",
141
+ "turbonomic_password",
142
+ # Cloud Providers
143
+ "ibmcloud_apikey",
144
+ "aws_region",
145
+ "aws_access_key_id",
146
+ "secret_access_key",
147
+ "aws_vpc_id",
148
+ # Dev Mode
149
+ "artifactory_username",
150
+ "artifactory_token",
151
+ # TODO: The way arcgis has been implemented needs to be fixed
152
+ "install_arcgis",
153
+ "mas_arcgis_channel",
154
+ # Guided Tour
155
+ "mas_enable_walkme",
156
+ # Facilities
157
+ "mas_ws_facilities_size",
158
+ "mas_ws_facilities_routes_timeout",
159
+ "mas_ws_facilities_liberty_extension_XML",
160
+ "mas_ws_facilities_vault_secret",
161
+ "mas_ws_facilities_pull_policy",
162
+ "mas_ws_facilities_storage_log_class",
163
+ "mas_ws_facilities_storage_log_mode",
164
+ "mas_ws_facilities_storage_log_size",
165
+ "mas_ws_facilities_storage_userfiles_class",
166
+ "mas_ws_facilities_storage_userfiles_mode",
167
+ "mas_ws_facilities_storage_userfiles_size",
168
+ "mas_ws_facilities_dwfagents",
169
+ "mas_ws_facilities_db_maxconnpoolsize",
170
+ # Special chars
171
+ "mas_special_characters"
172
+ ]
@@ -0,0 +1,23 @@
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 .mongodbSettings import MongoDbSettingsMixin
13
+ from .kafkaSettings import KafkaSettingsMixin
14
+ from .manageSettings import ManageSettingsMixin
15
+ from .turbonomicSettings import TurbonomicSettingsMixin
16
+ from .additionalConfigs import AdditionalConfigsMixin
17
+
18
+
19
+ class InstallSettingsMixin(Db2SettingsMixin, MongoDbSettingsMixin, KafkaSettingsMixin, ManageSettingsMixin, TurbonomicSettingsMixin, AdditionalConfigsMixin):
20
+ """
21
+ This class collects all the Mixins providing interactive prompts for mas-install
22
+ """
23
+ pass
@@ -0,0 +1,227 @@
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
+
20
+ class AdditionalConfigsMixin():
21
+ def additionalConfigs(self) -> None:
22
+ if self.interactiveMode:
23
+ self.printH1("Additional Configuration")
24
+ self.printDescription([
25
+ "Additional resource definitions can be applied to the OpenShift Cluster during the MAS configuration step",
26
+ "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"
27
+ ])
28
+
29
+ # If the user already set up BYO MongoDb or Kafka then they have already chosen to use additional configs
30
+ if self.localConfigDir is None:
31
+ if self.yesOrNo("Use additional configurations"):
32
+ self.selectLocalConfigDir()
33
+
34
+ # If we've set up a local config directory then provide details about what's included in it
35
+ # and generate the secret that will be used in the pipeline
36
+ if self.localConfigDir is not None:
37
+ # Get list of files in localConfigDir
38
+ configFilesPath = rf'{self.localConfigDir}/*.yaml'
39
+ configFiles = glob(configFilesPath)
40
+ if len(configFiles) == 0:
41
+ self.fatalError(f"No configuration files (*.yaml) were found in {self.localConfigDir}")
42
+
43
+ print_formatted_text("The following additional configurations will be applied:")
44
+ for cf in configFiles:
45
+ print_formatted_text(f" - {path.basename(cf)}")
46
+
47
+ if not self.noConfirm:
48
+ if not self.yesOrNo("Are these the correct configuration files to apply"):
49
+ print_formatted_text("Additional configuration files were not confirmed. Aborting installation")
50
+ exit(0)
51
+
52
+ # Generate the secret and apply it to the cluster
53
+ secret = {
54
+ "apiVersion": "v1",
55
+ "kind": "Secret",
56
+ "type": "Opaque",
57
+ "metadata": {
58
+ "name": "pipeline-additional-configs"
59
+ }
60
+ }
61
+ additionalConfigsSecret = self.addFilesToSecret(secret, self.localConfigDir, "yaml")
62
+ logger.debug(additionalConfigsSecret)
63
+ self.additionalConfigsSecret = additionalConfigsSecret
64
+
65
+ def podTemplates(self) -> None:
66
+ if self.interactiveMode and self.showAdvancedOptions:
67
+ self.printH1("Configure Pod Templates")
68
+ self.printDescription([
69
+ "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",
70
+ "For more information about the Kubernetes quality of service (QoS) levels, see <Orange><u>https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/</u></Orange>",
71
+ "You may also choose to use your own customized pod template definitions"
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
+ podTemplateChoice = self.promptForInt("Select pod templates profile")
86
+
87
+ if podTemplateChoice == 1:
88
+ self.setParam("mas_pod_templates_dir", path.join(self.templatesDir, "pod-templates", "guaranteed"))
89
+ elif podTemplateChoice == 2:
90
+ self.setParam("mas_pod_templates_dir", path.join(self.templatesDir, "pod-templates", "best-effort"))
91
+ elif podTemplateChoice == 3:
92
+ self.setParam("mas_pod_templates_dir", self.promptForDir("Pod templates directory", mustExist=True))
93
+ else:
94
+ self.fatalError(f"Invalid selection: {podTemplateChoice}")
95
+
96
+ if self.getParam("mas_pod_templates_dir") != "":
97
+ templateFilesPath = rf'{self.getParam("mas_pod_templates_dir")}/*.yml'
98
+ templateFiles = glob(templateFilesPath)
99
+ if len(templateFiles) == 0:
100
+ self.fatalError(f"No pod templates (*.yml) were found in {self.getParam('mas_pod_templates_dir')}")
101
+
102
+ print_formatted_text("The following pod templates will be applied:")
103
+ for tf in templateFiles:
104
+ print_formatted_text(f" - {path.basename(tf)}")
105
+
106
+ if not self.noConfirm:
107
+ if not self.yesOrNo("Are these the correct pod templates to apply"):
108
+ print_formatted_text("Pod templates were not confirmed. Aborting installation")
109
+ exit(0)
110
+
111
+ # Generate the secret and apply it to the cluster
112
+ secret = {
113
+ "apiVersion": "v1",
114
+ "kind": "Secret",
115
+ "type": "Opaque",
116
+ "metadata": {
117
+ "name": "pipeline-pod-templates"
118
+ }
119
+ }
120
+ podTemplatesSecret = self.addFilesToSecret(secret, self.getParam("mas_pod_templates_dir"), "yml")
121
+ logger.debug(podTemplatesSecret)
122
+ self.podTemplatesSecret = podTemplatesSecret
123
+
124
+ def manualCertificates(self) -> None:
125
+
126
+ if self.getParam("mas_manual_cert_mgmt"):
127
+ certsSecret = {
128
+ "apiVersion": "v1",
129
+ "kind": "Secret",
130
+ "type": "Opaque",
131
+ "metadata": {
132
+ "name": "pipeline-certificates"
133
+ }
134
+ }
135
+
136
+ extensions = ["key", "crt"]
137
+
138
+ apps = {
139
+ "mas_app_channel_assist": {
140
+ "dir": self.manualCertsDir + "/assist/",
141
+ "keyPrefix": "assist."
142
+ },
143
+ "mas_app_channel_manage": {
144
+ "dir": self.manualCertsDir + "/manage/",
145
+ "keyPrefix": "manage."
146
+ },
147
+ "mas_app_channel_iot": {
148
+ "dir": self.manualCertsDir + "/iot/",
149
+ "keyPrefix": "iot."
150
+ },
151
+ "mas_app_channel_monitor": {
152
+ "dir": self.manualCertsDir + "/monitor/",
153
+ "keyPrefix": "monitor."
154
+ },
155
+ "mas_app_channel_predict": {
156
+ "dir": self.manualCertsDir + "/predict/",
157
+ "keyPrefix": "predict."
158
+ },
159
+ "mas_app_channel_visualinspection": {
160
+ "dir": self.manualCertsDir + "/visualinspection/",
161
+ "keyPrefix": "visualinspection."
162
+ },
163
+ "mas_app_channel_optimizer": {
164
+ "dir": self.manualCertsDir + "/optimizer/",
165
+ "keyPrefix": "optimizer."
166
+ },
167
+ "mas_app_channel_facilities": {
168
+ "dir": self.manualCertsDir + "/facilities/",
169
+ "keyPrefix": "facilities."
170
+ }
171
+ }
172
+
173
+ for file in ["ca.crt", "tls.crt", "tls.key"]:
174
+ if file not in map(path.basename, glob(f'{self.manualCertsDir}/core/*')):
175
+ self.fatalError(f'{file} is not present in {self.manualCertsDir}/core/')
176
+ for ext in extensions:
177
+ certsSecret = self.addFilesToSecret(certsSecret, self.manualCertsDir + '/core/', ext, "core.")
178
+
179
+ for app in apps:
180
+ if self.getParam(app) != "":
181
+ for file in ["ca.crt", "tls.crt", "tls.key"]:
182
+ if file not in map(path.basename, glob(f'{apps[app]["dir"]}/*')):
183
+ self.fatalError(f'{file} is not present in {apps[app]["dir"]}')
184
+ for ext in extensions:
185
+ certsSecret = self.addFilesToSecret(certsSecret, apps[app]["dir"], ext, apps[app]["keyPrefix"])
186
+
187
+ self.certsSecret = certsSecret
188
+
189
+ def slsLicenseFile(self) -> None:
190
+ if self.slsLicenseFileLocal:
191
+ slsLicenseFileSecret = {
192
+ "apiVersion": "v1",
193
+ "kind": "Secret",
194
+ "type": "Opaque",
195
+ "metadata": {
196
+ "name": "pipeline-sls-entitlement"
197
+ }
198
+ }
199
+ self.setParam("sls_entitlement_file", f"/workspace/entitlement/{path.basename(self.slsLicenseFileLocal)}")
200
+ self.slsLicenseFileSecret = self.addFilesToSecret(slsLicenseFileSecret, self.slsLicenseFileLocal, '')
201
+
202
+ def addFilesToSecret(self, secretDict: dict, configPath: str, extension: str, keyPrefix: str = '') -> dict:
203
+ """
204
+ Add file (or files) to pipeline-additional-configs
205
+ """
206
+ filesToProcess = []
207
+ if path.isdir(configPath):
208
+ logger.debug(f"Adding all config files in directory {configPath}")
209
+ filesToProcess = glob(f"{configPath}/*.{extension}")
210
+ else:
211
+ logger.debug(f"Adding config file {configPath}")
212
+ filesToProcess = [configPath]
213
+
214
+ for fileToProcess in filesToProcess:
215
+ logger.debug(f" * Processing config file {fileToProcess}")
216
+ fileName = path.basename(fileToProcess)
217
+
218
+ # Load the file
219
+ with open(fileToProcess, 'r') as file:
220
+ data = file.read()
221
+
222
+ # Add/update an entry to the secret data
223
+ if "data" not in secretDict:
224
+ secretDict["data"] = {}
225
+ secretDict["data"][keyPrefix + fileName] = b64encode(data.encode('ascii')).decode("ascii")
226
+
227
+ return secretDict