Skip to content
Merged
1 change: 1 addition & 0 deletions image/cli/mascli/functions/internal/save_config
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export MAS_DOMAIN=$MAS_DOMAIN
export CLUSTER_ISSUER_SELECTION=$CLUSTER_ISSUER_SELECTION
export MAS_CLUSTER_ISSUER=$MAS_CLUSTER_ISSUER

export MAS_ROUTING_MODE=$MAS_ROUTING_MODE
export MAS_TRUST_DEFAULT_CAS=$MAS_TRUST_DEFAULT_CAS
export OCP_INGRESS_TLS_SECRET_NAME=$OCP_INGRESS_TLS_SECRET_NAME

Expand Down
10 changes: 5 additions & 5 deletions python/src/mas/cli/displayMixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from prompt_toolkit.completion import WordCompleter
from prompt_toolkit.validation import Validator

from .validators import YesNoValidator, FileExistsValidator, DirectoryExistsValidator
from .validators import YesNoValidator, IntValidator, FileExistsValidator, DirectoryExistsValidator

import logging
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -100,20 +100,20 @@ def promptForString(self, message: str, param: str = None, default: str = "", is
self.params[param] = response
return response

def promptForInt(self, message: str, param: str = None, default: int = None) -> int:
def promptForInt(self, message: str, param: str = None, default: int = None, min=None, max=None) -> int:
if param is not None and default is None:
default = getenv(param.upper(), default=None)

if default is None:
response = int(prompt(message=masPromptValue(message)))
response = int(prompt(message=masPromptValue(message), validator=IntValidator(min, max)))
else:
response = int(prompt(message=masPromptValue(message), default=str(default)))
response = int(prompt(message=masPromptValue(message), validator=IntValidator(min, max), default=str(default)))
if param is not None:
self.params[param] = str(response)
return response

def promptForListSelect(self, message: str, options: list, param: str = None, default: int = None) -> str:
selection = self.promptForInt(message=message, default=default)
selection = self.promptForInt(message=message, default=default, min=1, max=len(options))
# List indices are 0 origin, so we need to subtract 1 from the selection made to arrive at the correct value
self.setParam(param, options[selection - 1])

Expand Down
27 changes: 21 additions & 6 deletions python/src/mas/cli/install/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def configSLS(self) -> None:
" 2. Install MAS with Dedicated License (AppPoints)",
]
)
self.slsMode = self.promptForInt("SLS Mode", default=1)
self.slsMode = self.promptForInt("SLS Mode", default=1, min=1, max=2)

if self.slsMode not in [1, 2]:
self.fatalError(f"Invalid selection: {self.slsMode}")
Expand Down Expand Up @@ -441,6 +441,7 @@ def configMAS(self):
self.setParam("sls_namespace", f"mas-{self.getParam('mas_instance_id')}-sls")

self.configOperationMode()
self.configRoutingMode()
self.configCATrust()
self.configDNSAndCerts()
self.configSSOProperties()
Expand Down Expand Up @@ -469,7 +470,21 @@ def configOperationMode(self):
" 1. Production",
" 2. Non-Production"
])
self.operationalMode = self.promptForInt("Operational Mode", default=1)
self.operationalMode = self.promptForInt("Operational Mode", default=1, min=1, max=2)

@logMethodCall
def configRoutingMode(self):
if self.showAdvancedOptions and isVersionEqualOrAfter('9.2.0', self.getParam("mas_channel")) and self.getParam("mas_channel") != '9.2.x-feature':
self.printH1("Configure Routing Mode")
self.printDescription([
"Maximo Application Suite can be installed so it can be accessed with single domain URLs (path mode) or multi-domain URLs (subdomain mode):",
Comment thread
stonepd marked this conversation as resolved.
"",
" 1. Path (single domain)",
" 2. Subdomain (multi domain)"
])
routingModeInt = self.promptForInt("Routing Mode", default=1, min=1, max=2)
routingModeOptions = ["path", "subdomain"]
self.setParam("mas_routing_mode", routingModeOptions[routingModeInt - 1])

@logMethodCall
def configAnnotations(self):
Expand Down Expand Up @@ -508,7 +523,7 @@ def configDNSAndCerts(self):
" 4. None (I will set up DNS myself)"
])

dnsProvider = self.promptForInt("DNS Provider")
dnsProvider = self.promptForInt("DNS Provider", min=1, max=4)

if dnsProvider == 1:
self.configDNSAndCertsCloudflare()
Expand Down Expand Up @@ -555,7 +570,7 @@ def configDNSAndCertsCloudflare(self):
" 2. LetsEncrypt (Staging)",
" 3. Self-Signed"
])
certIssuer = self.promptForInt("Certificate issuer")
certIssuer = self.promptForInt("Certificate issuer", min=1, max=3)
certIssuerOptions = [
f"{self.getParam('mas_instance_id')}-cloudflare-le-prod",
f"{self.getParam('mas_instance_id')}-cloudflare-le-stg",
Expand All @@ -577,7 +592,7 @@ def configDNSAndCertsCIS(self):
" 2. LetsEncrypt (Staging)",
" 3. Self-Signed"
])
certIssuer = self.promptForInt("Certificate issuer")
certIssuer = self.promptForInt("Certificate issuer", min=1, max=3)
certIssuerOptions = [
f"{self.getParam('mas_instance_id')}-cis-le-prod",
f"{self.getParam('mas_instance_id')}-cis-le-stg",
Expand Down Expand Up @@ -851,7 +866,7 @@ def chooseInstallFlavour(self) -> None:
" - Configure whether to trust well-known certificate authorities by default (defaults to enabled)",
" - Configure whether the Guided Tour feature is enabled (defaults to enabled)",
" - Configure whether special characters are allowed in usernames and userids (defaults to disabled)",
" - Configure a custom domain, DNS integrations, and manual certificates",
" - Configure a custom domain, DNS integrations, routing mode and manual certificates",
" - Customize Maximo Manage database settings (schema, tablespace, indexspace)",
" - Customize Maximo Manage server bundle configuration (defaults to \"all\" configuration)",
" - Enable optional Maximo Manage integration Cognos Analytics and Watson Studio Local",
Expand Down
3 changes: 3 additions & 0 deletions python/src/mas/cli/install/argBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ def buildCommand(self) -> str:
if self.getParam('mas_manual_cert_mgmt') is True:
command += f" --manual-certificates \"{self.manualCertsDir}\"{newline}"

if self.getParam('mas_routing_mode') != "":
command += f" --routing \"{self.getParam('mas_routing_mode')}\"{newline}"

if self.getParam('mas_domain') != "":
command += f" --domain \"{self.getParam('mas_domain')}\"{newline}"

Expand Down
7 changes: 7 additions & 0 deletions python/src/mas/cli/install/argParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ def isValidFile(parser, arg) -> str:
action="store_const",
const="false"
)
masAdvancedArgGroup.add_argument(
"--routing",
dest="mas_routing_mode",
required=False,
help="Configure MAS with path or subdomain routing",
choices=["path", "subdomain"]
)
masAdvancedArgGroup.add_argument(
"--manual-certificates",
required=False,
Expand Down
1 change: 1 addition & 0 deletions python/src/mas/cli/install/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"mas_superuser_username",
"mas_superuser_password",
"mas_trust_default_cas",
"mas_routing_mode",
"mas_app_settings_server_bundles_size",
"mas_app_settings_default_jms",
"mas_app_settings_persistent_volumes_flag",
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 @@ -75,6 +75,9 @@ def masSummary(self) -> None:
elif self.getParam('dns_provider') == "":
pass

print()
self.printParamSummary("Network Routing Mode", "mas_routing_mode")

print()
self.printParamSummary("Configure Suite to run in IPV6", "enable_ipv6")

Expand Down
20 changes: 20 additions & 0 deletions python/src/mas/cli/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,26 @@ def validate(self, document):
raise ValidationError(message='Enter a valid response: y(es), n(o)', cursor_position=len(response))


class IntValidator(Validator):
def __init__(self, min, max):
self.min = min
self.max = max

def validate(self, document):
"""
Validate that a response is understandable as a yes/no response
"""
response = document.text
if not str.isdigit(response):
raise ValidationError(message='Enter a valid number', cursor_position=len(response))

if self.min and int(response) < self.min:
raise ValidationError(message=f'Enter a number not less than {self.min}', cursor_position=len(response))

if self.max and int(response) > self.max:
raise ValidationError(message=f'Enter a number not more than {self.max}', cursor_position=len(response))


class FileExistsValidator(Validator):
def validate(self, document):
"""
Expand Down
3 changes: 3 additions & 0 deletions tekton/src/params/install.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,9 @@
- name: mas_annotations
type: string
default: ""
- name: mas_routing_mode
type: string
default: ""
- name: mas_trust_default_cas
type: string
default: ""
Expand Down
2 changes: 2 additions & 0 deletions tekton/src/pipelines/taskdefs/core/suite-install.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
value: $(params.disable_ldap_cookie)
- name: allow_custom_cache_key
value: $(params.allow_custom_cache_key)
- name: mas_routing_mode
value: $(params.mas_routing_mode)
- name: mas_manual_cert_mgmt
value: $(params.mas_manual_cert_mgmt)
- name: mas_trust_default_cas
Expand Down
6 changes: 6 additions & 0 deletions tekton/src/tasks/suite-install.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ spec:
type: string
description: Optional boolean parameter that when set to True, indicates that manually created certificates will be used to certify MAS and application routes
default: ""
- name: mas_routing_mode
type: string
description: Optional string parameter, either path or subdomain, defines the network routing mode used for the suite.
default: ""
- name: mas_trust_default_cas
type: string
description: Optional boolean parameter that when set to False, disables the normal trust of well known public certificate authorities
Expand Down Expand Up @@ -150,6 +154,8 @@ spec:
value: $(params.mas_domain)
- name: MAS_CLUSTER_ISSUER
value: $(params.mas_cluster_issuer)
- name: MAS_ROUTING_MODE
value: $(params.mas_routing_mode)
- name: MAS_MANUAL_CERT_MGMT
value: $(params.mas_manual_cert_mgmt)
- name: MAS_TRUST_DEFAULT_CAS
Expand Down