Skip to content
36 changes: 36 additions & 0 deletions python/src/mas/cli/install/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1542,6 +1542,40 @@ def facilitiesSettings(self) -> None:
"mas_ws_facilities_vault_secret",
)

# Prompt for custom FACILITIES.properties file
if self.yesOrNo("Upload custom FACILITIES.properties file"):
self.printDescription(
[
"Provide the path to your custom FACILITIES.properties file.",
"This file will be uploaded as a secret in OpenShift.",
"If you choose not to upload a custom file, the default FACILITIES.properties will be used.",
]
)
facilitiesPropertiesFile = self.promptForString(
"Path to FACILITIES.properties file",
"mas_ws_facilities_properties_file_local",
)
if facilitiesPropertiesFile and path.exists(facilitiesPropertiesFile):
self.setParam("mas_ws_facilities_properties_file_local", facilitiesPropertiesFile)
self.setParam("mas_ws_facilities_custom_properties", "true")

# Prompt for custom secret name
if self.yesOrNo("Specify a custom name for the secret"):
customSecretName = self.promptForString(
"Secret name (default: facilities-properties)", "mas_ws_facilities_properties_secret_name", default="facilities-properties"
)
if customSecretName and customSecretName != "":
self.setParam("mas_ws_facilities_properties_secret_name", customSecretName)
else:
self.setParam("mas_ws_facilities_properties_secret_name", "facilities-properties")
else:
self.setParam("mas_ws_facilities_properties_secret_name", "facilities-properties")
else:
print_formatted_text(HTML("<Red>File not found. Default FACILITIES.properties will be used.</Red>"))
self.setParam("mas_ws_facilities_custom_properties", "false")
else:
self.setParam("mas_ws_facilities_custom_properties", "false")

self.promptForString(
"Set Real Estate and Facilities Routes Timeout:",
"mas_ws_facilities_routes_timeout",
Expand Down Expand Up @@ -2538,6 +2572,7 @@ def install(self, argv):
self.podTemplates()
self.slsLicenseFile()
self.db2LicenseFile()
self.facilitiesPropertiesFile()
self.manualCertificates()
self.aiserviceConfig()

Expand Down Expand Up @@ -2744,6 +2779,7 @@ def install(self, argv):
namespace=pipelinesNamespace,
slsLicenseFile=self.slsLicenseFileSecret,
db2LicenseFile=self.db2LicenseFileSecret,
facilitiesProperties=self.facilitiesPropertiesSecret,
additionalConfigs=self.additionalConfigsSecret,
podTemplates=self.podTemplatesSecret,
certs=self.certsSecret,
Expand Down
5 changes: 5 additions & 0 deletions python/src/mas/cli/install/argBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,11 @@ def buildCommand(self) -> str:
if self.getParam("mas_ws_facilities_storage_userfiles_size") != "":
command += f" --facilities-userfiles-storage-size \"{self.getParam('mas_ws_facilities_storage_userfiles_size')}\"{newline}"

if self.getParam("mas_ws_facilities_properties_file_local") != "":
command += f" --facilities-properties-file \"{self.getParam('mas_ws_facilities_properties_file_local')}\"{newline}"
if self.getParam("mas_ws_facilities_properties_secret_name") != "":
command += f" --facilities-properties-secret-name \"{self.getParam('mas_ws_facilities_properties_secret_name')}\"{newline}"

# AI Service Advanced Settings
# -----------------------------------------------------------------------------
if self.installAIService:
Expand Down
13 changes: 13 additions & 0 deletions python/src/mas/cli/install/argParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,19 @@ def isValidFile(parser: argparse.ArgumentParser, arg: str) -> str:
help="Storage size for Facilities user files",
default=50,
)
facilitiesArgGroup.add_argument(
"--facilities-properties-file",
dest="mas_ws_facilities_properties_file_local",
required=False,
help="Path to the custom FACILITIES.properties file to upload as secret",
)
facilitiesArgGroup.add_argument(
"--facilities-properties-secret-name",
dest="mas_ws_facilities_properties_secret_name",
required=False,
help="Custom name for the Facilities properties secret (default: facilities-properties)",
default="facilities-properties",
)

# Open Data Hub
# -----------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions python/src/mas/cli/install/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@
"mas_ws_facilities_storage_userfiles_size",
"mas_ws_facilities_dwfagents",
"mas_ws_facilities_db_maxconnpoolsize",
"mas_ws_facilities_properties_file_local",
"mas_ws_facilities_custom_properties",
"mas_ws_facilities_properties_secret_name",
# Special chars
"mas_special_characters",
# ODH
Expand Down
20 changes: 20 additions & 0 deletions python/src/mas/cli/install/settings/additionalConfigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,26 @@ def db2LicenseFile(self) -> None:
else:
self.db2LicenseFileSecret = None

def facilitiesPropertiesFile(self) -> None:
"""Handle Facilities properties file upload"""
self.facilitiesPropertiesSecret = None
facilitiesPropertiesFileLocal = self.getParam("mas_ws_facilities_properties_file_local")

if facilitiesPropertiesFileLocal and facilitiesPropertiesFileLocal != "":
# Get custom secret name or use default
secretName = self.getParam("mas_ws_facilities_properties_secret_name")
if not secretName or secretName == "":
secretName = "facilities-properties"

facilitiesPropertiesSecret = {"apiVersion": "v1", "kind": "Secret", "type": "Opaque", "metadata": {"name": "pipeline-facilities-properties"}}
# Set the path in workspace where Ansible will find the file
self.setParam("mas_ws_facilities_properties_file_local", "/workspace/facilities/FACILITIES.properties")
self.setParam("mas_ws_facilities_properties_secret_name", secretName)
self.facilitiesPropertiesSecret = self.addFilesToSecret(facilitiesPropertiesSecret, facilitiesPropertiesFileLocal, "")
else:
self.setParam("mas_ws_facilities_properties_file_local", "")
self.setParam("mas_ws_facilities_properties_secret_name", "")

def addFilesToSecret(self, secretDict: dict, configPath: str, extension: str, keyPrefix: str = "") -> dict:
"""
Add file (or files) to pipeline-additional-configs
Expand Down
3 changes: 3 additions & 0 deletions python/src/mas/cli/install/summarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ def facilitiesSummary(self) -> None:
"mas_ws_facilities_storage_userfiles_mode",
)
# self.printParamSummary(" + User files Storage Size", "mas_ws_facilities_storage_userfiles_size")
self.printParamSummary(" + Custom FACILITIES.properties", "mas_ws_facilities_custom_properties")
self.printParamSummary(" + Custom FACILITIES.properties File path", "mas_ws_facilities_properties_file_local")
self.printParamSummary(" + Custom FACILITIES.properties Secret Name", "mas_ws_facilities_properties_secret_name")
if self.getParam("db2_action_facilities") == "none":
self.printParamSummary(" + Dedicated DB2 Database", "No")
else:
Expand Down
12 changes: 12 additions & 0 deletions tekton/src/params/install.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,18 @@
description: ConfigMap with configurations not supported by Tekton
type: string
default: ""
- name: mas_ws_facilities_custom_properties
description: Flag indicating if custom FACILITIES.properties file is provided
type: string
default: ""
- name: mas_ws_facilities_properties_file_local
description: Path to custom FACILITIES.properties file in pipeline workspace
type: string
default: ""
- name: mas_ws_facilities_properties_secret_name
description: Name of the secret containing custom FACILITIES.properties
type: string
default: ""

# AI Service Configuration
# -----------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions tekton/src/pipelines/mas-install.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ spec:
- name: shared-db2
# AIService configurations. Contains Scheduling config file for AI workloads for tenant.
- name: shared-aiservice-config
# Facilities Properties File
- name: shared-facilities-properties
optional: true

params:
# 1. Common Parameters
Expand Down
8 changes: 8 additions & 0 deletions tekton/src/pipelines/taskdefs/apps/facilities-app.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,19 @@
value: $(params.mas_ws_facilities_storage_userfiles_mode)
- name: mas_ws_facilities_config_map_name
value: $(params.mas_ws_facilities_config_map_name)
- name: mas_ws_facilities_custom_properties
value: $(params.mas_ws_facilities_custom_properties)
- name: mas_ws_facilities_properties_file_local
value: $(params.mas_ws_facilities_properties_file_local)
- name: mas_ws_facilities_properties_secret_name
value: $(params.mas_ws_facilities_properties_secret_name)
workspaces:
- name: configs
workspace: shared-configs
- name: pod-templates
workspace: shared-pod-templates
- name: facilities
workspace: shared-facilities-properties
when:
- input: "$(params.mas_app_channel_facilities)"
operator: notin
Expand Down
Loading