Description
Which area this feature is related to?
/area devworkspace
Which functionality do you think we should add?
Add a field to the DevWorkspace CR spec that allows overriding fields in the k8s Deployment's pod template, e.g.
kind: DevWorkspace
apiVersion: workspace.devfile.io/v1alpha2
metadata:
name: myspacework
spec:
started: true
+ pods:
+ metadata:
+ annotations:
+ io.openshift.userns: "true"
+ io.kubernetes.cri-o.userns-mode: "auto:size=65536;map-to-root=true" # <-- user namespace
+ openshift.io/scc: container-build
+ spec:
+ runtimeClassName: kata
+ schedulerName: stork
template:
(...)
This field would not be included in the Devfile API
Why is this needed? Is your feature request related to a problem?
There are a variety of cases where overriding specific Pod fields is required by end-users. For example, a user may want to
- Apply specific annotations to configure how their DevWorkspace runs
- Override specific pod fields such as
runtimeClassName
andschedulerName
In general, there's a wide variety of potential things someone may need to override to make DevWorkspaces work for them, but each individual case is not common enough that it fits as part of the dedicated API. Up until now, we generally add special-case handling for individual fields (e.g. SCCs), but this is not flexible enough to cover all use cases, and complicates set up significantly.
Describe the solution you'd like
As above, add field pods
to the DevWorkspace API. The contents of the pods
field would be corev1.PodSpec
. Any value there would be strategic-merged into the resulting Pod spec generated from the DevWorkspace's spec.
Describe alternatives you've considered
This could also be implemented using free-form attributes, but this would mean
- It's harder to use when writing/editing a DevWorkspace by hand
- There is no validation or documentation on the field
- It's potentially more error-prone
Additional context
DevWorkspaceOperator issue: devfile/devworkspace-operator#852