Garden Cloud

Garden Cloud is a 3rd party hosted toolset extension for Garden that adds features and services that aid in our usage of Garden. These features include RBAC, secrets management, automatic environment cleanup, and triggered workflows. For now we will focus on using automatic environment cleanup to help keep costs down in GCP for remote dev deployments.

Docs for Garden Cloud can be found here: https://cloud.docs.garden.io/

Accessing Garden Cloud

You can access Garden Cloud including activity logs for the execution of AEC here: https://minted.app.garden/projects/1

Logging into Garden Cloud

Your local mntd-dot-dev repository should be logged into garden cloud using the cli to ensure that your deployment metadata is pushed to garden cloud so that these features can be used. Garden cloud uses our gitlab environment, and then OKTA, to authenticate. The login process will open a browser to gitlab, click the Sign in with GitLab, then authenticate with OKTA if necessary.

Execute this command from your mntd-dot-dev root:

1# authenticate and login to garden cloud
2garden login

If you are not able to authenticate, please post in #eng-gardening and tag @garden-admins to ensure your credentials are setup in garden cloud

Automatic Environment Cleanup

Garden Cloud will attempt to scale down kubernetes deployment and StatefulSets replicas to zero after a period of inactivity. Scaling down the replica counts will shutdown pods running the code you have deployed to the GKE kubernetes dev cluster. Scaling down replicas will leave your deployed code in the kubernetes cluster so that a re-deployment is not necessary.

Spinning your deployment back up after AEC has sput it down is done using the following command:

1# set deployment replicas to 1
2garden run workflow lights-on

AEC Operation

AEC will pause deployments after a period of inactivity. To start with we will use 6 hours of inactivity, but this will potentially change based on feedback from the developers. Inactivity refers to a namespace not being used by a garden command for a specified period of time.

When a deployment is paused, the replica count will be set to zero and kubernetes will spin down all pods managed by that deployment. This will not remove your code from GCP, it will just stop that code from being executed, freeing up resources for other usage and reducing the cost of our hosting.

Enabling AEC

AEC is enabled/disabled per cluster. In order for AEC to operate, you must be connected to garden cloud through the cli when your deployment is made, the deployment must be to a remote kubernetes cluster, and your namespace in that cluster needs to be created after AEC was setup.

If you have an existing namespace that was created before AEC was setup on ~ 2022-07-13, your namespace will need to be deleted in the gke-dev-01 cluster and recreated, this will require a redeploy

Disabling AEC

The Garden team has or plans to have a feature that will allow specific namespaces to be excluded from AEC. This documentation will be updated once documentation is provided by the Garden team.

Spinning Down

To manually spin down your deployment, run the following command from your garden project root:

1# set deployment replicas to 0
2garden run workflow lights-off

Spinning Up

To manually spin up your deployment, run the following command from your garden project root:

1# set deployment replicas to 1
2garden run workflow lights-on