diff --git a/image/cli/mascli/functions/gitops_suite_app_config b/image/cli/mascli/functions/gitops_suite_app_config index 556401d5317..239706d875c 100644 --- a/image/cli/mascli/functions/gitops_suite_app_config +++ b/image/cli/mascli/functions/gitops_suite_app_config @@ -645,6 +645,27 @@ function gitops_suite_app_config() { fi fi + if [[ "${MAS_APP_ID}" == "monitor" ]]; then + if [[ -n "$MAS_APPWS_SPEC" ]]; then + + # While we wait for Monitor StorageClass name to be made configurable (see https://jsw.ibm.com/browse/MASCORE-14484), hard-code it to use generated(efs) + # This will look up and use EFS instance with creation token "efs-${CLUSTER_NAME}-${MAS_INSTANCE_ID}-monitor-main" now created by gitops-efs in fvtsaas runs + # Once Monitor supports storage class name configuration, MONITOR_STORAGE_CLASS_NAME should be looked up from the workspace spec + # MONITOR_STORAGE_CLASS_PATH="" + MONITOR_STORAGE_CLASS_NAME="generated(efs)" + + + STORAGE_CLASS_DEFINITIONS=$(generate_storage_class_def "${MONITOR_STORAGE_CLASS_NAME}" "${CLUSTER_ID}" "${MAS_INSTANCE_ID}" ${MAS_APP_ID} "main" "${STORAGE_CLASS_DEFINITIONS}") || exit 1 + + # For now, Monitor expects there to be a StorageClass named exactly "efs", so we are going to override the name generated by the generate_storage_class_def function call above + STORAGE_CLASS_DEFINITIONS=$(echo "$STORAGE_CLASS_DEFINITIONS" | yq eval 'with_entries(.key = "efs")') + + # Once Monitor supports storage class name configuration, replace generated(efs) in MAS_APPWS_SPEC with name of generated storage class + # MONITOR_STORAGE_CLASS=$(generate_storage_class_name "${MONITOR_STORAGE_CLASS_NAME}" "${CLUSTER_ID}" "${MAS_INSTANCE_ID}" ${MAS_APP_ID} "main") + # MAS_APPWS_SPEC=$(echo "${MAS_APPWS_SPEC}" | yq ${MONITOR_STORAGE_CLASS_PATH}' = "'${MONITOR_STORAGE_CLASS}'"') + fi + fi + # Generate ArgoApps # --------------------------------------------------------------------------- echo diff --git a/tekton/src/tasks/gitops/gitops-deprovision-efs.yml.j2 b/tekton/src/tasks/gitops/gitops-deprovision-efs.yml.j2 index 0728cf37c53..b058aa6ee4d 100644 --- a/tekton/src/tasks/gitops/gitops-deprovision-efs.yml.j2 +++ b/tekton/src/tasks/gitops/gitops-deprovision-efs.yml.j2 @@ -120,6 +120,15 @@ spec: --skip-delete-storage-class \ || exit 1 + mas gitops-deprovision-efs -c $CLUSTER_NAME -m $MAS_INSTANCE_ID \ + --cloud-provider $CLOUD_PROVIDER \ + --aws-region $SM_AWS_REGION \ + --aws-secret-key $SM_AWS_SECRET_ACCESS_KEY \ + --aws-access-key $SM_AWS_ACCESS_KEY_ID \ + --efs-unique-id "efs-${CLUSTER_NAME}-${MAS_INSTANCE_ID}-monitor-main" \ + --skip-delete-storage-class \ + || exit 1 + command: - /bin/sh - -c diff --git a/tekton/src/tasks/gitops/gitops-efs.yml.j2 b/tekton/src/tasks/gitops/gitops-efs.yml.j2 index 6aa0cb4e880..bd300ec60fd 100644 --- a/tekton/src/tasks/gitops/gitops-efs.yml.j2 +++ b/tekton/src/tasks/gitops/gitops-efs.yml.j2 @@ -134,6 +134,16 @@ spec: --skip-create-storage-class \ || exit 1 + + mas gitops-efs -c $CLUSTER_NAME -m $MAS_INSTANCE_ID \ + --cloud-provider $CLOUD_PROVIDER \ + --aws-region $SM_AWS_REGION \ + --aws-secret-key $SM_AWS_SECRET_ACCESS_KEY \ + --aws-access-key $SM_AWS_ACCESS_KEY_ID \ + --creation-token-prefix "" \ + --efs-unique-id "efs-${CLUSTER_NAME}-${MAS_INSTANCE_ID}-monitor-main" \ + --skip-create-storage-class \ + || exit 1 command: - /bin/sh - -c