image-builder-mk3
is a service that runs in meta clusters, which provides APIs to create and list workspace image builds, resolve workspace docker image references, and listen to build updates and logs.
Once completed, #7845 will move
image-builder-mk3
(and image builds) from meta to workspace clusters.
The following diagram shows what happens during a workspace image build. See the (internal) Architecture page for more details.
Relevant:
To test local changes, the following script will compile and publish a docker image, and restart the image-builder-mk3 k8s deployment at your current kube context with this image:
# Careful: check you're pointing at the right cluster!
components/image-builder-mk3/debug.sh
Protocol changes are to be made in the image-builder-api
component.
Changes to the installed k8s config can be done here.
To run image-builder-mk3
locally, the example-config.json
can be used as follows:
cd /workspace/gitpod/components/image-builder-mk3
# Set up kube context, the image builder will connect to this cluster's ws-manager.
kubectx [cluster-name]
# Fetch ws-manager TLS config.
gpctl clusters get-tls-config
# Port forward to ws-manager.
kubectl port-forward deployment/ws-manager 12001:8080
# Run image-builder-mk3.
go run . run --config example-config.json
See metrics at http://localhost:9500/metrics
.
When image-builder-mk3
is running locally, you can use grpcurl
to make gRPC requests against the API:
go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
# Call RPC, e.g. ListBuilds:
grpcurl -plaintext -proto /workspace/gitpod/components/image-builder-api/imgbuilder.proto -import-path=/workspace/gitpod/components/ localhost:8080 builder.ImageBuilder.ListBuilds
See https://github.com/fullstorydev/grpcurl#invoking-rpcs for how to make different types of requests with grpcurl
.
To run all image-builder-mk3
tests:
go test -v ./...
If you want it to work in a particular public cloud, you may need to grant some permissions. Below is a reference for this.
If you would like to use ECR as a container registry, please add the following IAM policy below.
Also, if you want to use ECR as public, you should add ecr-public
too.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ecr:BatchGetImage",
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:PutImage"
],
"Resource": "*"
}
]
}