Skip to content

[BB-6208] Customize LMS and CMS env settings

Kaustav Banerjee requested to merge kaustav/customize_env_variables into main

Description

This MR adds the capability to configure the LMS and CMS environment settings and feature flags through Gitlab trigger payload.

This is achieved by modifying/adding patches to the yaml based groveoverride plugin which are available for each individual instances.

Supporting information

OpenCraft internal ticke: BB-6208

Testing instructions

Steps to test the changes:

  1. Setup a new cluster or change the grove commit repo in an existing cluster to this branch.
  2. Trigger a deployment through a REST request and provide the env variables. Sample:
curl -X POST \
    --header "Content-Type: application/json" \
    --data '{
    "ref": "main",
    "token": "YOUR_TOKEN",
    "variables": {
        "INSTANCE_NAME": "INSTANCE_NAME",
        "DEPLOYMENT_REQUEST_ID": "1",
        "TUTOR_CONTACT_EMAIL": "test@example.com",
        "NEW_INSTANCE_TRIGGER": "1"
    },
    "TUTOR_LMS_HOST":"LMS_HOST_NAME",
    "ENV_LMS": {
        "MKTG_URL_LINK_MAP": {
            "DONATE": null
        },
        "MKTG_URL_OVERRIDES": {
            "ABOUT": "https://opencraft.com/about-us/"
        }
    },
    "ENV_LMS_FEATURES": {
        "LMS_FEATURES_KEY1": "LMS_FEATURES_VALUE1",
        "LMS_FEATURES_KEY2": "LMS_FEATURES_VALUE2"
    },
    "ENV_CMS": {
        "CMS_KEY1": "CMS_VALUE1_1",
        "CMS_KEY3": "CMS_VALUE3"
    },
    "ENV_CMS_FEATURES": {
        "CMS_FEATURES_KEY1": "CMS_FEATURES_VALUE1",
        "CMS_FEATURES_KEY2": "CMS_FEATURES_VALUE2"
    },
    "ENV_COMMON_FEATURES": {
        "COMMON_FEATURES_KEY1": "COMMON_FEATURES_VALUE1",
        "COMMON_FEATURES_KEY2": "COMMON_FEATURES_VALUE2"
    }
}' \
https://gitlab.com/api/v4/projects/PROJECT_ID/trigger/pipeline
  1. Drop into the LMS shell using namespace=<NAME>; ./kubectl exec -it $(./kubectl get pods --namespace=$namespace -l app.kubernetes.io/name=lms -o jsonpath='{range .items[0]}{@.metadata.name}{end}') -n $namespace -- bash
  2. Checkout the LMS config file cat $LMS_CFG
  3. Verify the lms configs, lms feature configs, and the common feature configs are present as passed in the request
  4. Drop into the CMS shell and do the same.

Dependencies

List the dependencies required for this change, if any. Do not forget to link grove-template merge request here if that's affected by this change.

Screenshots

If applicable, add screenshots to help explain your feature.

Checklist

If any of the items below is not applicable, do not remove them, but put a check in it.

  • All providers include the new feature/change
  • All affected providers can provision new clusters
  • Unit tests are added/updated
  • Documentation is added/updated
  • The TOOLS_CONTAINER_IMAGE_VERSION in ci_vars.yml is updated
  • The grove-template repository is updated

Additional context

Add any other context about the merge request here.

Edited by Kaustav Banerjee

Merge request reports