From 206190782b8f57e83966115302dba50573e485c8 Mon Sep 17 00:00:00 2001 From: yshah Date: Fri, 13 Jun 2025 14:56:25 +0000 Subject: [PATCH] Feature: 11055 Support of several node groups in clusters created by OSM Change-Id: I8c02465364c4b465a6503b19c8983e1587eaa5d4 Signed-off-by: yshah --- .../scripts/library/krm-functions.rc | 173 +++++++++++ .../manifests/base/node-group.yaml | 53 ++++ .../manifests/role/kustomization.yaml | 21 ++ .../role/role-policy-attachment.yaml | 95 ++++++ .../eks-nodegroup/manifests/role/role.yaml | 49 +++ .../eks-nodegroup/templates/nodegroup.yaml | 53 ++++ .../nodegroup-management-wft.yaml | 264 ++++++++++++++++ .../full-create-nodegroup-wft.yaml | 294 ++++++++++++++++++ .../full-delete-nodegroup-wft.yaml | 144 +++++++++ .../full-scale-nodegroup-wft.yaml | 251 +++++++++++++++ 10 files changed, 1397 insertions(+) create mode 100644 installers/flux/templates/sw-catalogs/cloud-resources/eks-nodegroup/manifests/base/node-group.yaml create mode 100644 installers/flux/templates/sw-catalogs/cloud-resources/eks-nodegroup/manifests/role/kustomization.yaml create mode 100644 installers/flux/templates/sw-catalogs/cloud-resources/eks-nodegroup/manifests/role/role-policy-attachment.yaml create mode 100644 installers/flux/templates/sw-catalogs/cloud-resources/eks-nodegroup/manifests/role/role.yaml create mode 100644 installers/flux/templates/sw-catalogs/cloud-resources/eks-nodegroup/templates/nodegroup.yaml create mode 100644 installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/building-blocks/nodegroup-management-wft.yaml create mode 100644 installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-create-nodegroup-wft.yaml create mode 100644 installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-delete-nodegroup-wft.yaml create mode 100644 installers/flux/templates/sw-catalogs/infra-configs/osm-workflows/templates/wf-templates/canned-operations/full-scale-nodegroup-wft.yaml diff --git a/docker/osm-krm-functions/scripts/library/krm-functions.rc b/docker/osm-krm-functions/scripts/library/krm-functions.rc index 1a3c0bd0..1d457053 100644 --- a/docker/osm-krm-functions/scripts/library/krm-functions.rc +++ b/docker/osm-krm-functions/scripts/library/krm-functions.rc @@ -112,6 +112,179 @@ function add_providerconfig_for_gcp() { } +# Create remote NodeGroup in AWS +function create_nodegroup() { + local NODEGROUP_NAME="$1" + local NODEGROUP_KUSTOMIZATION_NAME="$2" + local CLUSTER_NAME="$3" + local CLUSTER_TYPE="$4" + local PROVIDERCONFIG_NAME="${5:-default}" + local VM_SIZE="$6" + local NODE_COUNT="$7" + local CLUSTER_LOCATION="$8" + local CONFIGMAP_NAME="${9}" + local NODEGROUP_ROLE="${10}" + local PUBLIC_KEY_MGMT="${11:-"${PUBLIC_KEY_MGMT}"}" + local PUBLIC_KEY_NEW_CLUSTER="${12}" + local PRIVATE_KEY_NEW_CLUSTER="${13:-"${PRIVATE_KEY_NEW_CLUSTER}"}" + local AKS_RG_NAME="${14:-""}" + local GKE_PREEMPTIBLE_NODES="${15:-""}" + local FLEET_REPO_DIR="${16:-"${FLEET_REPO_DIR}"}" + local FLEET_REPO_URL="${17:-""}" + local SW_CATALOGS_REPO_DIR="${18:-"${SW_CATALOGS_REPO_DIR}"}" + local SW_CATALOGS_REPO_URL="${19:-""}" + local SKIP_BOOTSTRAP="${20:"false"}" + local MGMT_PROJECT_NAME="${21:-"osm_admin"}" + local MGMT_CLUSTER_NAME="${22:-"_management"}" + local BASE_TEMPLATES_PATH="${23:-"cloud-resources"}" + local TEMPLATE_MANIFEST_FILENAME="${24:-"nodegroup.yaml"}" + local MANIFEST_FILENAME="${25:-"${NODEGROUP_NAME}.yaml"}" + + # Is the provider type supported? + local VALID_PROVIDERS=("eks" "aks" "gke") + CLUSTER_TYPE="${CLUSTER_TYPE,,}" + [[ ! ($(echo ${VALID_PROVIDERS[@]} | grep -w "${CLUSTER_TYPE}")) ]] && return 1 + + # Determines the source dir for the templates and the target folder in Fleet + local TEMPLATES_DIR="${SW_CATALOGS_REPO_DIR}/${BASE_TEMPLATES_PATH}/eks-nodegroup/templates" + local TARGET_FOLDER="${FLEET_REPO_DIR}/${MGMT_PROJECT_NAME}/managed-resources/${MGMT_CLUSTER_NAME}/${CLUSTER_NAME}" + + local IS_NODEGROUP_ROLE=$([[ "${NODEGROUP_ROLE}" != "default" ]]; echo $?) + local IS_DEFAULT_NODEGROUP_ROLE=$([[ "${NODEGROUP_ROLE}" == "default" ]]; echo $?) + + local PATCH_VALUE="" + local COMPONENT=() + if [[ "${IS_NODEGROUP_ROLE}" == "0" ]]; + then + PATCH_VALUE=$(cat <