Search documentation
karat

+

K

End-to-end workflow [Experimental]

The commands used in this workflow are Experimental. To enable these commands, run the apollo-cli configure command.

This guide will walk through how to:

  1. Create a new Environment
  2. Install the Apollo Control Plane Module into the Environment
  3. Generate the Environment manifest and apply it to a Kubernetes cluster
  4. Initialize a new Helm chart Product manifest
  5. Create a new Product Release from the Product manifest
  6. Install the new Product Release in the Environment

Prerequisites

Environment variables

You should define the following environment variables at the beginning of the script:

  • ENVIRONMENT_PREFIX: The name of your new Environment.
  • OWNER_TEAM_RID: The RID of the Team that should own the Environment. You can find this value by navigating to the Team in Apollo and copying the RID.
  • MODULE_ID: The ID for the Spoke Control Plane Module that you want to install in the new Environment. You can find this value by running apollo-cli module list. Learn more about the available Spoke Control Plane Modules.
  • NAMESPACE: The Kubernetes namespace in which Apollo will install the Product.
  • MANIFEST_OUTPUT_DIR: The directory where Apollo should save the generated Product manifest.
  • PRODUCT_GROUP: The group ID for the Product.
  • PRODUCT_NAME: The name of the Helm chart in your repository, which you can find by running helm search repo <keyword>.
  • PRODUCT_VERSION: The version of the Helm chart to publishYou can find this value by running helm search repo <keyword>.
  • HELM_REPOSITORY_URL: The URL where the Helm chart is hosted. You can find this value by running helm repo list.

Full script

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 #!/usr/bin/env bash set -euo pipefail ENVIRONMENT_PREFIX="new-environment" OWNER_TEAM_RID="ri.autopilot.main.team.6dc1963c-c822-4242-a228-e25bd13db9bf" MODULE_ID="EggKnW549ZC:35" NAMESPACE="example-namespace" MANIFEST_OUTPUT_DIR=$PWD PRODUCT_GROUP="com.palantir.example" PRODUCT_NAME="test-helm-chart" PRODUCT_VERSION="0.186.0" HELM_REPOSITORY_URL="oci://docker.external.repository.build/example/charts/test-helm-chart" # 1. Create a new Environment ENVIRONMENT_ID=$(apollo-cli environment create --environment "$ENVIRONMENT_PREFIX" --owner-team-rid "$OWNER_TEAM_RID" | jq -r '.environment') # 2. Install the Apollo Control Plane Module into the Environment apollo-cli module install \ --module-id $MODULE_ID \ --environment "$ENVIRONMENT_ID" \ --variable environmentId="$ENVIRONMENT_ID" # 3. Generate the Environment manifest and apply it to a Kubernetes cluster echo "Press enter to generate the environment manifest and apply it to the k8s cluster" read apollo-cli environment generate-manifest --environment "$ENVIRONMENT_ID" | kubectl apply -f - # 4. Initialize a new Helm chart Product manifest apollo-cli product-release helm-chart init \ --repository-url "$HELM_REPOSITORY_URL" \ --maven-coordinate "${PRODUCT_GROUP}:${PRODUCT_NAME}:${PRODUCT_VERSION}" \ --name "$HELM_REPOSITORY_URL" \ --version "$PRODUCT_VERSION" \ --values values.yaml \ --output-dir "$MANIFEST_OUTPUT_DIR" # 5. Create a new Helm chart Product Release apollo-cli product-release create --manifest "$MANIFEST_OUTPUT_DIR"/manifest.yml # 6. Install the new Helm chart Product Release in the Environment apollo-cli entity helm-chart create \ --environment "$ENVIRONMENT_ID" \ --k8s-namespace "$NAMESPACE" \ --name "$PRODUCT_NAME" \ --product-id "${PRODUCT_GROUP}:${PRODUCT_NAME}"