actions / actions/actions-runner-controller
Add OpenAPI metadata for kustomize patches
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.5k
- Forks
- 1.5k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 27
Description
What would you like added?
Support for kustomize strategic merge patches. This can be done by adding specific x-kubernetes-patch-* metadata keys to the CRD OpenAPI schema.
Why is this needed?
Currently when applying a strategic merge patch to resources like RunnerDeployments or RunnerSets, lists/arrays of objects always get clobbered by the patch instead of merged. It would be nice to be able to apply a patch that contains baseline/required values for the resources, and have those values appended instead of replaced.
Here is an example of the issue and my specific use case:
runner.yaml:
---
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
name: my-runner
spec:
replicas: 1
template:
spec:
ephemeral: true
repository: my-repo
labels:
- runner-label
tolerations:
- key: firstTaint
operator: Equal
value: firstTaintValue
effect: NoSchedule
patch.yaml:
---
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
name: This field is required by kustomize but ignored
spec:
template:
spec:
labels:
- required-label
tolerations:
- key: secondTaint
operator: Equal
value: secondTaintValue
effect: NoSchedule
kustomization.yaml:
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: actions-runner-controller
resources:
- runner.yaml
# There are additional runners here that are omitted for brevity's sake
patches:
- path: ./patch.yaml
target:
kind: RunnerDeployment
Output:
---
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
name: my-runner
spec:
replicas: 1
template:
spec:
ephemeral: true
repository: my-repo
labels:
- runner-label
- required-label
tolerations:
- key: secondTaint
operator: Equal
value: secondTaintValue
effect: NoSchedule
This would be the ideal output:
---
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
name: my-runner
spec:
replicas: 1
template:
spec:
ephemeral: true
repository: my-repo
labels:
- runner-label
- required-label
tolerations:
- key: firstTaint
operator: Equal
value: firstTaintValue
effect: NoSchedule
- key: secondTaint
operator: Equal
value: secondTaintValue
effect: NoSchedule
Additional context
Here's details on the feature and how it can be added:
- Kustomize docs: https://github.com/kubernetes-sigs/kustomize/blob/master/examples/customOpenAPIschema.md
- KEP for the feature: https://github.com/kubernetes/enhancements/tree/master/keps/sig-cli/2206-openapi-features-in-kustomize
- Reference page for the feature: https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/openapi/
- How Argo Rollouts implemented the feature: https://github.com/argoproj/argo-rollouts/pull/1371
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Kustomize customOpenAPIschema documentation and the KEP linked in the issue, then inspect the CRD OpenAPI schema used for RunnerDeployment and RunnerSet. Use runner.yaml, patch.yaml, and kustomization.yaml as the reproduction, and verify that the resulting labels and tolerations preserve entries from both resources.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes, openapi
- Domain
- api, infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100