uselagoon / lagoon

Lagoon, the developer-focused application delivery platform
https://docs.lagoon.sh/
Apache License 2.0
567 stars 148 forks source link

Make `api` the source of truth for cascaded environment variables #3001

Open rocketeerbkw opened 2 years ago

rocketeerbkw commented 2 years ago

When a deployment of an environment is scheduled, the api sends along all the environment variables that have been configured at the project and environment level, then it's up to kubectl-build-deploy-dind to determine which variables are "final" and what scope they have. Since this needs to happen multiple times, it leads to a lot of copy/paste of the logic, makes it difficult to override at the build-pod/cluster level, and doesn't give any insight to users what environment variables may have been overridden.

We should move all this logic to the api and send the final, cascaded list, split by scope. This would allow, for example, the UI to show all configured variables and their overrides to end users. It also removes a bunch of business logic out of the builder.

tobybellwood commented 2 years ago

Agree - the API should send a build to the remote-controller with a fully resolved set of variables. The controller should be able to provide default/override variables that are applied as-needed to these resolved vars.

rocketeerbkw commented 2 years ago

The controller should be able to provide default/override variables that are applied as-needed to these resolved vars.

I left that for a separate issue since I couldn't remember the specifics that we agreed on, figured this would need to be done either way.