General
Extending kubernetes resources
This section describes how you can extend Kubernetes resources for container components through pod-overrides
and container-overrides
attributes.
container-overrides
container-overrides
attributes allow you to override properties of a container in a pod spec such as securityContext
and resources
. However, it restricts from overriding properties such as image
, name
, ports
, env
, volumesMounts
, command
, and args
.
This attribute can be defined at the component level.
Procedure
- Specify "container-overrides" at the component level.
Specify container-overrides to override security context for container at component level
devfile.yamlschemaVersion: 2.2.0 components: - name: maven attributes: container-overrides: securityContext: runAsUser: 1001 runAsGroup: 1001 container: image: eclipse/maven-jdk8:latest
The data inside container-overrides
can also be specified as a JSON.
container-overrides:
securityContext: {"runAsUser": 1001, "runAsGroup": 1001}
pod-overrides
pod-overrides
attribute allow you to override properties of a pod spec such as securityContext
, serviceAccountName
, schedulerName
, etc. However, it restricts overriding properties such as containers
, initContainers
, and volumes
.
This attribute can be defined at the component and devfile attributes levels. If it is defined at both the levels, the attribute at the devfile attributes level will be parsed first and then the component level.Strategic Merge Patch strategy is used to merge the attributes defined at both the levels.
Procedure
Specify "pod-overrides" at the component level.
Specify pod-overrides to override security context for container at component level
devfile.yamlschemaVersion: 2.2.0 components: - name: maven attributes: pod-overrides: spec: serviceAccountName: new-service-account container: image: eclipse/maven-jdk8:latest
Specify "pod-overrides" at the devfile attributes level. It will be defined as a top-level attribute.
Specify pod-overrides to override resources for container at the devfile level
devfile.yamlschemaVersion: 2.2.0 attributes: pod-overrides: spec: serviceAccountName: new-service-account components: - name: maven container: image: eclipse/maven-jdk8:latest
The data inside pod-overrides
can also be specified as a JSON.
pod-overrides:
spec: {"serviceAccountName": "new-service-account"}