Add support for daemonsets to the Kubernetes-Entrypoint init-container.

It also makes two other changes:

 * Moves the entrypoint container manifest snippet to its own file to reduce loading on the _funcs.tpl file
 * Changes dep-check-init-cont to dep_check_init_cont to match the formatting of other defines used in OpenStack Helm
This commit is contained in:
Pete Birley 2017-01-22 05:35:31 +00:00
parent ca1360c9f3
commit 1a13f9ba83
38 changed files with 85 additions and 68 deletions

View File

@ -22,7 +22,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -22,7 +22,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -22,7 +22,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -9,7 +9,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
restartPolicy: OnFailure

View File

@ -9,7 +9,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
restartPolicy: OnFailure

View File

@ -10,7 +10,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
restartPolicy: OnFailure

View File

@ -10,7 +10,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
restartPolicy: OnFailure

View File

@ -11,7 +11,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
restartPolicy: OnFailure

View File

@ -21,35 +21,3 @@
{{- $wtf := $context.Template.Name | replace $last $name -}}
{{- include $wtf $context | sha256sum | quote -}}
{{- end -}}
{{- define "dep-check-init-cont" -}}
{{- $envAll := index . 0 -}}
{{- $deps := index . 1 -}}
{
"name": "init",
"image": {{ $envAll.Values.images.dep_check | quote }},
"imagePullPolicy": {{ $envAll.Values.images.pull_policy | quote }},
"env": [
{
"name": "NAMESPACE",
"value": "{{ $envAll.Release.Namespace }}"
},
{
"name": "INTERFACE_NAME",
"value": "eth0"
},
{
"name": "DEPENDENCY_SERVICE",
"value": "{{ include "joinListWithColon" $deps.service }}"
},
{
"name": "DEPENDENCY_JOBS",
"value": "{{ include "joinListWithColon" $deps.jobs }}"
},
{
"name": "COMMAND",
"value": "echo done"
}
]
}
{{- end -}}

View File

@ -0,0 +1,49 @@
{{- define "dep_check_init_cont" -}}
{{- $envAll := index . 0 -}}
{{- $deps := index . 1 -}}
{
"name": "init",
"image": {{ $envAll.Values.images.dep_check | quote }},
"imagePullPolicy": {{ $envAll.Values.images.pull_policy | quote }},
"env": [
{
"name": "POD_NAME",
"valueFrom": {
"fieldRef": {
"APIVersion": "v1",
"fieldPath": "metadata.name"
}
}
},
{
"name": "NAMESPACE",
"valueFrom": {
"fieldRef": {
"APIVersion": "v1",
"fieldPath": "metadata.namespace"
}
}
},
{
"name": "INTERFACE_NAME",
"value": "eth0"
},
{
"name": "DEPENDENCY_SERVICE",
"value": "{{ include "joinListWithColon" $deps.service }}"
},
{
"name": "DEPENDENCY_JOBS",
"value": "{{ include "joinListWithColon" $deps.jobs }}"
},
{
"name": "DEPENDENCY_DAEMONSET",
"value": "{{ include "joinListWithColon" $deps.daemonset }}"
},
{
"name": "COMMAND",
"value": "echo done"
}
]
}
{{- end -}}

View File

@ -26,7 +26,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -18,7 +18,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -9,7 +9,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
restartPolicy: OnFailure

View File

@ -9,7 +9,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
restartPolicy: OnFailure

View File

@ -9,7 +9,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -12,7 +12,7 @@ spec:
app: heat-api
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -12,7 +12,7 @@ spec:
app: heat-cfn
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -12,7 +12,7 @@ spec:
app: heat-cloudwatch
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -9,7 +9,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
restartPolicy: OnFailure

View File

@ -9,7 +9,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
restartPolicy: OnFailure

View File

@ -10,7 +10,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
restartPolicy: OnFailure

View File

@ -10,7 +10,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
restartPolicy: OnFailure

View File

@ -14,7 +14,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
restartPolicy: OnFailure

View File

@ -13,7 +13,7 @@ spec:
app: heat-engine
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -22,7 +22,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -22,7 +22,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependecies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependecies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -9,7 +9,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependecies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependecies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
restartPolicy: OnFailure

View File

@ -9,7 +9,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
restartPolicy: OnFailure

View File

@ -13,7 +13,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -13,7 +13,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -22,7 +22,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -22,7 +22,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -22,7 +22,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -22,7 +22,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -22,7 +22,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }}
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
nodeSelector:

View File

@ -9,7 +9,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
restartPolicy: OnFailure

View File

@ -9,7 +9,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
restartPolicy: OnFailure

View File

@ -9,7 +9,7 @@ spec:
metadata:
annotations:
pod.beta.kubernetes.io/init-containers: '[
{{ tuple $envAll $dependencies | include "dep-check-init-cont" | indent 10 }}
{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }}
]'
spec:
restartPolicy: OnFailure