Builder
Build and publish docker image from a repository within a kubernetes cluster running the Spot operator.
The Builder is an Spot's subsystem that handles retrieving the source from a repository, building the image, locally storing cache layers. Finally, it will export the final image to an external registry, ie. ECR, DockerHub.
The goal of this subsystem is to abstract away all the implementation details of building and maintaining cache layers from the operator. Configurations and settings are passed through by environment variables. Status updates are provided from within the builder by updating the associated Build custom resource that the operator used to spin up a pod running a builder instance.
BuildKit abstracted
Under the hood, buildkitd is the technology that execute the Dockerfile provided and generate and image. Buildkitd is completely isolated from the outside and runs within the pod as a sidecar. Interaction with buildkitd is exclusively done with the builder. Features like build arguments, ssh keys and secret mount is provided by passing the proper environment variables.
Context within the operator
The build is in charge of building the image and pushing it to a remote registry. Once the execution of the builder is started, it will be
in charge of monitoring its own progress as well as maintain the associated Custom Resource's Condition. It runs like a job where it is expected to ultimately terminates. When the pod running a builder
is terminated, the status of the Build's Custom Resource conditions will indicate the state it was in when the builder finished.
For a successful build, all conditions must be set to Success
.
A build can be configured through environment variables. You can read more about each of the environment variables that are supported and their format in the environment variable page