Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(image-builder): Add field to allow api server env vars to be propagated to kaniko jobs #621

Merged
merged 5 commits into from
Dec 24, 2024

Conversation

deadlycoconuts
Copy link
Contributor

@deadlycoconuts deadlycoconuts commented Dec 20, 2024

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 builder
  • api/pkg/imagebuilder/imagebuilder.go - Addition of a step to add Merlin API server environment variables as Kaniko build args

Tests

Checklist

  • Added PR label
  • Added unit test, integration, and/or e2e tests
  • Tested locally
  • Updated documentation
  • Update Swagger spec if the PR introduce API changes
  • Regenerated Golang and Python client if the PR introduces API changes

Release Notes

NONE

@deadlycoconuts deadlycoconuts added the enhancement New feature or request label Dec 20, 2024
@deadlycoconuts deadlycoconuts self-assigned this Dec 20, 2024
@deadlycoconuts deadlycoconuts force-pushed the add_env_var_propagation_to_kaniko_jobs branch 2 times, most recently from 7835a6e to 1dd40b9 Compare December 22, 2024 18:48
@deadlycoconuts deadlycoconuts marked this pull request as ready for review December 23, 2024 07:05
Copy link
Contributor

@bthari bthari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one tiny comment, but the rest LGTM, so feel free to merge it once it's addressed. Thank you for the changes and improvement! 🚀

@deadlycoconuts deadlycoconuts force-pushed the add_env_var_propagation_to_kaniko_jobs branch from 3996844 to 66839b4 Compare December 24, 2024 15:37
@deadlycoconuts
Copy link
Contributor Author

Thanks for the quick review and for spotting the issue with the comments! Merging this now! 🚀

@deadlycoconuts deadlycoconuts merged commit 18945d2 into main Dec 24, 2024
33 checks passed
@deadlycoconuts deadlycoconuts deleted the add_env_var_propagation_to_kaniko_jobs branch December 24, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants