driver/kubernetes: add ownerrefs driver option for owner references#3791
Open
abhay1999 wants to merge 1 commit intodocker:masterfrom
Open
driver/kubernetes: add ownerrefs driver option for owner references#3791abhay1999 wants to merge 1 commit intodocker:masterfrom
abhay1999 wants to merge 1 commit intodocker:masterfrom
Conversation
Add support for setting Kubernetes ownerReferences on the builder Deployment/StatefulSet via a new 'ownerrefs' driver option. This allows the builder to be automatically garbage-collected by Kubernetes when its owning resource (e.g. an ephemeral GitHub Actions runner) is deleted. Usage: docker buildx create --driver kubernetes --driver-opt ownerrefs=apiVersion=actions.github.com/v1alpha1,kind=EphemeralRunner,name=runner-xyz,uid=<uid>,controller=true,blockOwnerDeletion=false Multiple owner references can be specified by separating them with semicolons. Each owner reference supports the following fields: apiVersion, kind, name, uid, controller, blockOwnerDeletion closes docker#2626 Signed-off-by: abhay1999 <abhaychaurasiya19@gmail.com>
AkihiroSuda
reviewed
Apr 10, 2026
|
|
||
| deploymentOpt.Tolerations = append(deploymentOpt.Tolerations, t) | ||
| } | ||
| case k == "ownerrefs": |
Collaborator
There was a problem hiding this comment.
To avoid inflation of the switch{}, can we rather support an arbitrary yq/jq expression to patch the manfiest?
scutuatua-crypto
approved these changes
Apr 11, 2026
scutuatua-crypto
approved these changes
Apr 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #2626
Add support for setting Kubernetes ownerReferences on the builder
Deployment/StatefulSet via a new ownerrefs driver option.
This allows the builder to be automatically garbage-collected by
Kubernetes when its owning resource (e.g. an ephemeral GitHub Actions
runner) is deleted, removing the need to manually patch the Deployment
after creation.
Usage:
Multiple owner references can be specified by separating them with
semicolons:
Each owner reference supports the following fields:
apiVersion, kind, name, uid, controller, blockOwnerDeletion
The implementation follows the same parsing pattern as the existing
tolerations driver option (semicolon-separated entries, each with
comma-separated key=value fields).
Changes:
to DeploymentOpt and set it on the Deployment/StatefulSet ObjectMeta
multiple owner refs, and invalid inputs
Signed-off-by: abhay1999 abhaychaurasiya19@gmail.com