feat(image-builder): Add field to allow api server env vars to be propagated to kaniko jobs #621
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a new mechanism for environment variables from the Merlin API server to be propagated to the build environment of the Kaniko build jobs that it spins up, reducing the need for redundant repetition of configuration, especially if these environment variables are common to both the Merlin API server and the build environment of the Kaniko build jobs.
Since these variables are passed to the Kaniko build jobs as build arguments (as opposed to environment variables of the container where the image gets built; see GoogleContainerTools/kaniko#2824 for more details), these variables get passed as additional arguments in the Kaniko build job.
This PR additionally introduces a cluster connectivity check (done by a simple list pods operation) for the image builder to ensure that the cluster controller has been successfully initialised at start up of the Merlin API server, instead of allowing errors to only be thrown when an image building job has been triggered.
Modifications
api/cmd/api/setup.go
- Addition of a connectivity check during initialisation of the image builderapi/pkg/imagebuilder/imagebuilder.go
- Addition of a step to add Merlin API server environment variables as Kaniko build argsTests
Checklist
Release Notes