Skip to content

[minor] SNO Support for aws-provision #1447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7ecf7e4
[minor] SNO Support
Jan 25, 2025
d7c53b0
[patch] provision sno
unnati-solanki-git Jan 25, 2025
7ff9e11
[patch] print echo
unnati-solanki-git Jan 25, 2025
7a691b0
[patch] force noninteractive
unnati-solanki-git Jan 27, 2025
75be1da
[patch] export before fun
unnati-solanki-git Jan 27, 2025
3a219db
[patch] revert export
unnati-solanki-git Jan 27, 2025
2992bec
[patch] add pull secret
unnati-solanki-git Jan 27, 2025
ba80a96
Merge branch 'master' into sno
unnati-solanki-git Jan 27, 2025
925af97
Merge branch 'master' into sno
alequint Feb 4, 2025
6d4481e
Merge branch 'master' into sno
unnati-solanki-git Feb 11, 2025
c86e306
Merge branch 'master' into sno
alequint Feb 14, 2025
f4fff91
Merge branch 'master' into sno
unnati-solanki-git Feb 18, 2025
7c8e720
Merge branch 'master' into sno
unnati-solanki-git Feb 25, 2025
4100d82
Merge branch 'master' into sno
unnati-solanki-git Feb 25, 2025
59c8011
Merge branch 'master' into sno
unnati-solanki-git Mar 19, 2025
c2ef021
[patch] Config sno defaults in non interactive
unnati-solanki-git Mar 19, 2025
dae8dd7
[patch] swap to test
unnati-solanki-git Mar 19, 2025
9ece1a2
[patch] revert test db2 and add non interactive
unnati-solanki-git Mar 20, 2025
a341e56
Merge branch 'master' into sno
unnati-solanki-git Mar 22, 2025
3573ed3
[patch] db2 settings for non interactive
unnati-solanki-git Mar 22, 2025
f7242ef
[patch] fix hook issue
unnati-solanki-git Mar 22, 2025
dde5f92
[patch] manage settings for sno
unnati-solanki-git Mar 23, 2025
9a5a90a
[patch] Fixed commit hook
unnati-solanki-git Mar 23, 2025
cb75489
Merge branch 'master' into sno
unnati-solanki-git Mar 25, 2025
6a2055e
Merge branch 'master' into sno
alequint Mar 31, 2025
1910591
[patch] review comment addressed
unnati-solanki-git Apr 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions image/cli/mascli/functions/provision_aws
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function provision_aws_help() {
reset_colors
cat << EOM
Usage:
mas provision-aws-sno [options]
mas provision-aws [options]
Where ${COLOR_YELLOW}specified${TEXT_RESET} each option may also be defined by setting the appropriate environment variable.
When no options are specified on the command line, interactive-mode will be enabled by default.

Expand All @@ -20,6 +20,10 @@ Cluster Configuration (Required):
IPI Configuration (Required):
-r, --region-name ${COLOR_YELLOW}IPI_REGION${TEXT_RESET} Region of the cluster to be provisioned (e.g. us-east-1, us-east-2)
-d, --domain-name ${COLOR_YELLOW}IPI_BASE_DOMAIN${TEXT_RESET} Base Domain name (e.g. buyermas4aws.com)
-f, --secret-file ${COLOR_YELLOW}IPI_PULL_SECRET_FILE${TEXT_RESET} Location of the file containing your Redhat OpenShift pull secret

Single Node OpenShift (Optional)
-s, --single-node ${COLOR_YELLOW}SNO_MODE${TEXT_RESET} SNO_MODE when 'true' indicates cluster must be configured with in a single node mode (e.g. 1 control plane replica, 1 mongodb replica, etc)

Other Commands:
--no-confirm Provision the cluster without prompting for confirmation
Expand Down Expand Up @@ -54,6 +58,12 @@ function provision_aws_noninteractive() {
-d|--domain-name)
export IPI_BASE_DOMAIN=$1 && shift
;;
-s|--single-node)
export SNO_MODE=$1 && shift
;;
-f|--secret-file)
export IPI_PULL_SECRET_FILE=$1 && shift
;;
--no-confirm)
export NO_CONFIRM=true
;;
Expand All @@ -76,6 +86,11 @@ function provision_aws_noninteractive() {
[[ -z "$OCP_VERSION" ]] && provision_aws_help "OCP_VERSION is not set"
[[ -z "$IPI_REGION" ]] && provision_aws_help "IPI_REGION is not set"
[[ -z "$IPI_BASE_DOMAIN" ]] && provision_aws_help "IPI_BASE_DOMAIN is not set"

# Set SNO Vars in case SNO_MODE = true
if [[ "$SNO_MODE" == "true" ]]; then
set_sno_vars
fi
}

# function set_default_vars sets default variables for a generic AWS provisioning.
Expand All @@ -93,6 +108,7 @@ function set_default_vars() {
function set_sno_vars() {
export IPI_CONTROLPLANE_REPLICAS=1 # IPI_CONTROLPLANE_REPLICAS
export IPI_COMPUTE_REPLICAS=0 # IPI_COMPUTE_REPLICAS
export IPI_ROOTVOLUME_SIZE=250 # IPI_ROOTVOLUME_SIZE - 250GB following docs https://www.ibm.com/docs/en/masv-and-l/continuous-delivery?topic=clusters-installation-prerequisites
}

# function provision_aws_interactive contains the prompts for the different variables.
Expand Down Expand Up @@ -170,11 +186,13 @@ function provision_aws_interactive() {
# The following function is a work in progress and is not ready for testing
function provision_aws_cluster() {
# Take the first parameter off (it will be provision-aws-sno)
echo "Before shift the value is: $#"
shift
echo "$#"
if [[ $# -gt 0 ]]; then
provision_aws_noninteractive "$@"
else
provision_aws_interactive "$@"
provision_aws_interactive
fi

ansible-playbook ibm.mas_devops.ocp_aws_provision || exit 1
Expand Down
5 changes: 5 additions & 0 deletions python/src/mas/cli/install/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,8 @@ def nonInteractiveMode(self) -> None:
}

self.configGrafana()
self.configSNO()
self.setDB2DefaultSettings()

for key, value in vars(self.args).items():
# These fields we just pass straight through to the parameters and fail if they are not set
Expand Down Expand Up @@ -1025,6 +1027,9 @@ def nonInteractiveMode(self) -> None:
if self.getParam("is_full_manage") != "false":
self.setParam("is_full_manage", "true")

# Configure Storage and Access mode
self.manageStorageAndAccessMode()

# Load the catalog information
self.chosenCatalog = getCatalog(self.getParam("mas_catalog_version"))

Expand Down
57 changes: 30 additions & 27 deletions python/src/mas/cli/install/settings/db2Settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,33 +55,7 @@ def configDb2(self) -> None:
f"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, {self.manageAppName}, Monitor, &amp; Predict) or you may choose to configure MAS to use an existing database"
])

self.setParam("db2_cpu_requests", "4000m")
self.setParam("db2_cpu_limits", "6000m")
self.setParam("db2_memory_requests", "8Gi")
self.setParam("db2_memory_limits", "12Gi")

if self.isSNO():
# Set smaller defaults for SNO deployments
self.setParam("db2_meta_storage_size", "10Gi")
self.setParam("db2_backup_storage_size", "10Gi")
self.setParam("db2_logs_storage_size", "10Gi")
self.setParam("db2_temp_storage_size", "10Gi")
self.setParam("db2_data_storage_size", "20Gi")

# Configure the access mode to RWO
self.params["db2_meta_storage_accessmode"] = "ReadWriteOnce"
self.params["db2_backup_storage_accessmode"] = "ReadWriteOnce"
self.params["db2_logs_storage_accessmode"] = "ReadWriteOnce"
self.params["db2_data_storage_accessmode"] = "ReadWriteOnce"

# Also reduce the CPU requests
self.params["db2_cpu_requests"] = "300m"
else:
self.setParam("db2_meta_storage_size", "20Gi")
self.setParam("db2_backup_storage_size", "100Gi")
self.setParam("db2_logs_storage_size", "100Gi")
self.setParam("db2_temp_storage_size", "100Gi")
self.setParam("db2_data_storage_size", "100Gi")
self.setDB2DefaultSettings()

instanceId = self.getParam('mas_instance_id')
# Do we need to set up an IoT database?
Expand Down Expand Up @@ -201,3 +175,32 @@ def configDb2(self) -> None:
self.promptForString(" + Backup Volume", "db2_backup_storage_size", default=self.getParam("db2_backup_storage_size"))
else:
self.setParam("db2_namespace", "db2u")

def setDB2DefaultSettings(self) -> None:

self.setParam("db2_cpu_requests", "4000m")
self.setParam("db2_cpu_limits", "6000m")
self.setParam("db2_memory_requests", "8Gi")
self.setParam("db2_memory_limits", "12Gi")

if self.isSNO():
# Set smaller defaults for SNO deployments
self.setParam("db2_meta_storage_size", "10Gi")
self.setParam("db2_backup_storage_size", "10Gi")
self.setParam("db2_logs_storage_size", "10Gi")
self.setParam("db2_temp_storage_size", "10Gi")
self.setParam("db2_data_storage_size", "20Gi")

# Configure the access mode to RWO
self.params["db2_meta_storage_accessmode"] = "ReadWriteOnce"
self.params["db2_backup_storage_accessmode"] = "ReadWriteOnce"
self.params["db2_logs_storage_accessmode"] = "ReadWriteOnce"
self.params["db2_data_storage_accessmode"] = "ReadWriteOnce"
self.params["db2_cpu_requests"] = "300m"

else:
self.setParam("db2_meta_storage_size", "20Gi")
self.setParam("db2_backup_storage_size", "100Gi")
self.setParam("db2_logs_storage_size", "100Gi")
self.setParam("db2_temp_storage_size", "100Gi")
self.setParam("db2_data_storage_size", "100Gi")
18 changes: 10 additions & 8 deletions python/src/mas/cli/install/settings/manageSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,16 @@ def manageSettings(self) -> None:
self.manageSettingsDatabase()
self.manageSettingsCustomizationArchive()
self.manageSettingsOther()

# Default to RWX storage classes, but fall back to RWO in SNO or when user
# has chosen not to provide a RWX storage class
storageClass = self.getParam("storage_class_rwx")
accessMode = "ReadWriteMany"
if self.isSNO() or self.getParam("storage_class_rwx") == "none":
storageClass = self.getParam("storage_class_rwo")
accessMode = "ReadWriteOnce"
self.manageStorageAndAccessMode()

def manageStorageAndAccessMode(self) -> None:
# Default to RWX storage classes, but fall back to RWO in SNO or when user
# has chosen not to provide a RWX storage class
storageClass = self.getParam("storage_class_rwx")
accessMode = "ReadWriteMany"
if self.isSNO() or self.getParam("storage_class_rwx") == "none":
storageClass = self.getParam("storage_class_rwo")
accessMode = "ReadWriteOnce"

self.setParam("mas_app_settings_doclinks_pvc_storage_class", storageClass)
self.setParam("mas_app_settings_bim_pvc_storage_class", storageClass)
Expand Down