I am using Jsonnet to render Kubernetes objects, I would like to use a mixin to apply multiple volume mounts to a deployment.
An example of what I’ve tried:
config: {
volumeMounts: [
first: {
mountPath: '/path/to/first',
subPath: 'first',
data: {},
},
second: {
mountPath: '/path/to/second',
subPath: 'second',
data: {},
},
],
}
configMap: configMap.new('config')
+ configMap.withData(
{ [config.mountPath]: config.data }
for config in $.mountConfig
),
deployment: deployment.new(
name='dep1',
replicas='2',
containers=[container.new('name', 'image')]
)
+ k.util.configMapVolumeMount($.configMap, mountPath, subPath)
for mount on $.config.VolumeMounts
Obviously an incomplete example, I can’t figure out the syntax to do a + mixin for something in somethings
.
New contributor
pagey101 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.