[FIX] Add whitelisting of fields of various types to configMap.

This Patch Set enables whitelisting of proper field names
of different types(i.e string, integer)in configMap volume.
It makes the pauseImage for daemonjob configurable.

Change-Id: Ia2062c5bc9ba1d8783e9573d7f9ea315c34f7fe7
This commit is contained in:
Luna Das 2020-03-25 18:17:20 +05:30
parent 965fd345c3
commit ea7fdef8e5
3 changed files with 8 additions and 3 deletions

View File

@ -32,6 +32,7 @@ def is_job_finished(job):
def new_daemon(job):
pause_image = {{ .Values.images.tags.pause | quote }}
daemon = copy.deepcopy(job)
daemon['apiVersion'] = 'apps/v1'
daemon['kind'] = 'DaemonSet'
@ -45,7 +46,7 @@ def new_daemon(job):
job['spec']['template']['spec']['containers'])
daemon['spec']['template']['spec']['containers'] = [
{'name': "pause", 'image': job['spec'].get(
'pauseImage', 'gcr.io/google_containers/pause'),
'pauseImage', pause_image),
'resources': {'requests': {'cpu': '10m'}}}]
daemon['spec']['selector'] = {'matchLabels': copy.deepcopy(
job['spec']['template']['metadata']['labels'])}

View File

@ -343,8 +343,11 @@ spec:
type: string
configMap:
type: object
additionalProperties:
type: string
properties:
name:
type: string
defaultMode:
type: integer
restartPolicy:
type: string
tty:

View File

@ -19,6 +19,7 @@ release_group: null
images:
tags:
python: docker.io/python:3.6-slim
pause: gcr.io/google_containers/pause:latest
image_repo_sync: docker.io/docker:17.07.0
pullPolicy: IfNotPresent
local_registry: