From 1a13f9ba837739a1ac93fb64c8e51992aef057d4 Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Sun, 22 Jan 2017 05:35:31 +0000 Subject: [PATCH 1/4] 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 --- cinder/templates/deployment-api.yaml | 2 +- cinder/templates/deployment-scheduler.yaml | 2 +- cinder/templates/deployment-volume.yaml | 2 +- cinder/templates/job-db-init.yaml | 2 +- cinder/templates/job-db-sync.yaml | 2 +- cinder/templates/job-ks-endpoints.yaml.yaml | 2 +- cinder/templates/job-ks-service.yaml | 2 +- cinder/templates/job-ks-user.yaml | 2 +- common/templates/_funcs.tpl | 32 ------------ .../snippets/_k8s_init_dep_check.tpl | 49 +++++++++++++++++++ glance/templates/deployment-api.yaml | 2 +- glance/templates/deployment-registry.yaml | 2 +- glance/templates/job-db-sync.yaml | 2 +- glance/templates/job-init.yaml | 2 +- glance/templates/job-post.yaml | 2 +- heat/templates/deployment-api.yaml | 2 +- heat/templates/deployment-cfn.yaml | 2 +- heat/templates/deployment-cloudwatch.yaml | 2 +- heat/templates/job-db-init.yaml | 2 +- heat/templates/job-db-sync.yaml | 2 +- heat/templates/job-ks-endpoints.yaml.yaml | 2 +- heat/templates/job-ks-service.yaml | 2 +- heat/templates/job-ks-user.yaml | 2 +- heat/templates/statefulset-engine.yaml | 2 +- horizon/templates/deployment.yaml | 2 +- keystone/templates/deployment.yaml | 2 +- keystone/templates/job-db-sync.yaml | 2 +- keystone/templates/job-init.yaml | 2 +- nova/templates/daemonset-compute.yaml | 2 +- nova/templates/daemonset-libvirt.yaml | 2 +- nova/templates/deployment-api-metadata.yaml | 2 +- nova/templates/deployment-api-osapi.yaml | 2 +- nova/templates/deployment-conductor.yaml | 2 +- nova/templates/deployment-consoleauth.yaml | 2 +- nova/templates/deployment-scheduler.yaml | 2 +- nova/templates/job-db-sync.yaml | 2 +- nova/templates/job-init.yaml | 2 +- nova/templates/job-post.yaml | 2 +- 38 files changed, 85 insertions(+), 68 deletions(-) create mode 100644 common/templates/snippets/_k8s_init_dep_check.tpl diff --git a/cinder/templates/deployment-api.yaml b/cinder/templates/deployment-api.yaml index b5a05f8f77..cc3c3f6b19 100644 --- a/cinder/templates/deployment-api.yaml +++ b/cinder/templates/deployment-api.yaml @@ -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: diff --git a/cinder/templates/deployment-scheduler.yaml b/cinder/templates/deployment-scheduler.yaml index e18425e2b1..39663097ef 100644 --- a/cinder/templates/deployment-scheduler.yaml +++ b/cinder/templates/deployment-scheduler.yaml @@ -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: diff --git a/cinder/templates/deployment-volume.yaml b/cinder/templates/deployment-volume.yaml index 1545b37279..cb6c958ccc 100644 --- a/cinder/templates/deployment-volume.yaml +++ b/cinder/templates/deployment-volume.yaml @@ -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: diff --git a/cinder/templates/job-db-init.yaml b/cinder/templates/job-db-init.yaml index f731d4fcec..8c8338b0cf 100644 --- a/cinder/templates/job-db-init.yaml +++ b/cinder/templates/job-db-init.yaml @@ -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 diff --git a/cinder/templates/job-db-sync.yaml b/cinder/templates/job-db-sync.yaml index f38c18cfa9..045f46227f 100644 --- a/cinder/templates/job-db-sync.yaml +++ b/cinder/templates/job-db-sync.yaml @@ -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 diff --git a/cinder/templates/job-ks-endpoints.yaml.yaml b/cinder/templates/job-ks-endpoints.yaml.yaml index 0d91fccf6a..455c0f3439 100644 --- a/cinder/templates/job-ks-endpoints.yaml.yaml +++ b/cinder/templates/job-ks-endpoints.yaml.yaml @@ -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 diff --git a/cinder/templates/job-ks-service.yaml b/cinder/templates/job-ks-service.yaml index 52585cf0f5..73934938f2 100644 --- a/cinder/templates/job-ks-service.yaml +++ b/cinder/templates/job-ks-service.yaml @@ -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 diff --git a/cinder/templates/job-ks-user.yaml b/cinder/templates/job-ks-user.yaml index 9937ca2642..49bc179a89 100644 --- a/cinder/templates/job-ks-user.yaml +++ b/cinder/templates/job-ks-user.yaml @@ -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 diff --git a/common/templates/_funcs.tpl b/common/templates/_funcs.tpl index 115892b10d..fe6c9a675e 100644 --- a/common/templates/_funcs.tpl +++ b/common/templates/_funcs.tpl @@ -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 -}} diff --git a/common/templates/snippets/_k8s_init_dep_check.tpl b/common/templates/snippets/_k8s_init_dep_check.tpl new file mode 100644 index 0000000000..d55e0bc654 --- /dev/null +++ b/common/templates/snippets/_k8s_init_dep_check.tpl @@ -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 -}} diff --git a/glance/templates/deployment-api.yaml b/glance/templates/deployment-api.yaml index e4431c0460..d998fb5ded 100644 --- a/glance/templates/deployment-api.yaml +++ b/glance/templates/deployment-api.yaml @@ -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: diff --git a/glance/templates/deployment-registry.yaml b/glance/templates/deployment-registry.yaml index 3df9090a0e..2d1f023b35 100644 --- a/glance/templates/deployment-registry.yaml +++ b/glance/templates/deployment-registry.yaml @@ -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: diff --git a/glance/templates/job-db-sync.yaml b/glance/templates/job-db-sync.yaml index 6cd0dd9b6c..3ecfb6af7b 100644 --- a/glance/templates/job-db-sync.yaml +++ b/glance/templates/job-db-sync.yaml @@ -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 diff --git a/glance/templates/job-init.yaml b/glance/templates/job-init.yaml index 2fd28805eb..5bf5f0635c 100644 --- a/glance/templates/job-init.yaml +++ b/glance/templates/job-init.yaml @@ -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 diff --git a/glance/templates/job-post.yaml b/glance/templates/job-post.yaml index da362afe25..bbb53d760a 100644 --- a/glance/templates/job-post.yaml +++ b/glance/templates/job-post.yaml @@ -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: diff --git a/heat/templates/deployment-api.yaml b/heat/templates/deployment-api.yaml index 2b2d4d5b18..25197f76ef 100755 --- a/heat/templates/deployment-api.yaml +++ b/heat/templates/deployment-api.yaml @@ -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: diff --git a/heat/templates/deployment-cfn.yaml b/heat/templates/deployment-cfn.yaml index d90355513d..0cce31b80e 100644 --- a/heat/templates/deployment-cfn.yaml +++ b/heat/templates/deployment-cfn.yaml @@ -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: diff --git a/heat/templates/deployment-cloudwatch.yaml b/heat/templates/deployment-cloudwatch.yaml index ccb6647980..6f624a65f4 100644 --- a/heat/templates/deployment-cloudwatch.yaml +++ b/heat/templates/deployment-cloudwatch.yaml @@ -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: diff --git a/heat/templates/job-db-init.yaml b/heat/templates/job-db-init.yaml index 6a7e343cae..a98c571d95 100644 --- a/heat/templates/job-db-init.yaml +++ b/heat/templates/job-db-init.yaml @@ -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 diff --git a/heat/templates/job-db-sync.yaml b/heat/templates/job-db-sync.yaml index 4a9b004db2..5f962a9d3e 100644 --- a/heat/templates/job-db-sync.yaml +++ b/heat/templates/job-db-sync.yaml @@ -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 diff --git a/heat/templates/job-ks-endpoints.yaml.yaml b/heat/templates/job-ks-endpoints.yaml.yaml index e0a90d6a28..6bfcfb7018 100644 --- a/heat/templates/job-ks-endpoints.yaml.yaml +++ b/heat/templates/job-ks-endpoints.yaml.yaml @@ -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 diff --git a/heat/templates/job-ks-service.yaml b/heat/templates/job-ks-service.yaml index 06738e162c..8dba89f883 100644 --- a/heat/templates/job-ks-service.yaml +++ b/heat/templates/job-ks-service.yaml @@ -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 diff --git a/heat/templates/job-ks-user.yaml b/heat/templates/job-ks-user.yaml index 270154045b..7fd8f6d2f2 100644 --- a/heat/templates/job-ks-user.yaml +++ b/heat/templates/job-ks-user.yaml @@ -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 diff --git a/heat/templates/statefulset-engine.yaml b/heat/templates/statefulset-engine.yaml index e494378ce0..0c5c8f007b 100644 --- a/heat/templates/statefulset-engine.yaml +++ b/heat/templates/statefulset-engine.yaml @@ -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: diff --git a/horizon/templates/deployment.yaml b/horizon/templates/deployment.yaml index 12fe799116..9d97e9cdfe 100644 --- a/horizon/templates/deployment.yaml +++ b/horizon/templates/deployment.yaml @@ -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: diff --git a/keystone/templates/deployment.yaml b/keystone/templates/deployment.yaml index 54cff70871..21321c994b 100644 --- a/keystone/templates/deployment.yaml +++ b/keystone/templates/deployment.yaml @@ -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: diff --git a/keystone/templates/job-db-sync.yaml b/keystone/templates/job-db-sync.yaml index e38bce91a0..d38bbc9e66 100644 --- a/keystone/templates/job-db-sync.yaml +++ b/keystone/templates/job-db-sync.yaml @@ -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 diff --git a/keystone/templates/job-init.yaml b/keystone/templates/job-init.yaml index be64047d69..4e41f4ff86 100644 --- a/keystone/templates/job-init.yaml +++ b/keystone/templates/job-init.yaml @@ -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 diff --git a/nova/templates/daemonset-compute.yaml b/nova/templates/daemonset-compute.yaml index c40c3c5aaa..896739cfba 100644 --- a/nova/templates/daemonset-compute.yaml +++ b/nova/templates/daemonset-compute.yaml @@ -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: diff --git a/nova/templates/daemonset-libvirt.yaml b/nova/templates/daemonset-libvirt.yaml index 692728fa1a..bb461bc4da 100644 --- a/nova/templates/daemonset-libvirt.yaml +++ b/nova/templates/daemonset-libvirt.yaml @@ -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: diff --git a/nova/templates/deployment-api-metadata.yaml b/nova/templates/deployment-api-metadata.yaml index 8543f46910..5ca429e8ca 100644 --- a/nova/templates/deployment-api-metadata.yaml +++ b/nova/templates/deployment-api-metadata.yaml @@ -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: diff --git a/nova/templates/deployment-api-osapi.yaml b/nova/templates/deployment-api-osapi.yaml index a60c4d6985..f0940a524c 100644 --- a/nova/templates/deployment-api-osapi.yaml +++ b/nova/templates/deployment-api-osapi.yaml @@ -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: diff --git a/nova/templates/deployment-conductor.yaml b/nova/templates/deployment-conductor.yaml index b52408cea8..8879851371 100644 --- a/nova/templates/deployment-conductor.yaml +++ b/nova/templates/deployment-conductor.yaml @@ -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: diff --git a/nova/templates/deployment-consoleauth.yaml b/nova/templates/deployment-consoleauth.yaml index 6234e5368e..c62de2559d 100644 --- a/nova/templates/deployment-consoleauth.yaml +++ b/nova/templates/deployment-consoleauth.yaml @@ -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: diff --git a/nova/templates/deployment-scheduler.yaml b/nova/templates/deployment-scheduler.yaml index 4db74f7798..14f12e2c29 100644 --- a/nova/templates/deployment-scheduler.yaml +++ b/nova/templates/deployment-scheduler.yaml @@ -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: diff --git a/nova/templates/job-db-sync.yaml b/nova/templates/job-db-sync.yaml index b8df59b65d..94befb39e2 100644 --- a/nova/templates/job-db-sync.yaml +++ b/nova/templates/job-db-sync.yaml @@ -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 diff --git a/nova/templates/job-init.yaml b/nova/templates/job-init.yaml index addc34d2b5..8db6c2b664 100644 --- a/nova/templates/job-init.yaml +++ b/nova/templates/job-init.yaml @@ -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 diff --git a/nova/templates/job-post.yaml b/nova/templates/job-post.yaml index 4df83ae874..c91e752117 100644 --- a/nova/templates/job-post.yaml +++ b/nova/templates/job-post.yaml @@ -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 From 2d5fd2da73cddac53355c3013cd2b4bbda5d3d23 Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Sun, 22 Jan 2017 05:39:25 +0000 Subject: [PATCH 2/4] Neutron: Move to use init-containers for dependency checking Brings Neutron inline with other services, by moving the dependency checks to an init-container. --- neutron/templates/daemonset-dhcp-agent.yaml | 34 ++++++---------- neutron/templates/daemonset-l3-agent.yaml | 36 +++++++---------- .../templates/daemonset-metadata-agent.yaml | 40 ++++++++----------- neutron/templates/daemonset-ovs-agent.yaml | 31 +++++--------- neutron/templates/daemonset-ovs-db.yaml | 21 +++------- neutron/templates/daemonset-ovs-vswitchd.yaml | 20 +++------- neutron/templates/deployment-server.yaml | 32 ++++++--------- neutron/templates/job-db-sync.yaml | 36 +++++++++-------- neutron/templates/job-init.yaml | 27 +++++-------- neutron/templates/job-post.yaml | 26 +++++------- neutron/values.yaml | 20 +++++----- 11 files changed, 127 insertions(+), 196 deletions(-) diff --git a/neutron/templates/daemonset-dhcp-agent.yaml b/neutron/templates/daemonset-dhcp-agent.yaml index 11ef4e05c9..4a56ee6ed1 100644 --- a/neutron/templates/daemonset-dhcp-agent.yaml +++ b/neutron/templates/daemonset-dhcp-agent.yaml @@ -1,3 +1,5 @@ +{{- $envAll := . }} +{{- $dependencies := .Values.dependencies.dhcp }} apiVersion: extensions/v1beta1 kind: DaemonSet metadata: @@ -9,7 +11,10 @@ spec: app: neutron-dhcp-agent annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }} - configmap-etc-hash: {{ tuple "configmap-etc.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 }} + ]' spec: nodeSelector: {{ .Values.labels.agent.dhcp.node_selector_key }}: {{ .Values.labels.agent.dhcp.node_selector_value }} @@ -23,25 +28,12 @@ spec: imagePullPolicy: {{ .Values.images.pull_policy }} securityContext: privileged: true - env: - - name: INTERFACE_NAME - value: {{ .Values.network.interface.dhcp | default .Values.network.interface.default }} - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: COMMAND - value: "neutron-dhcp-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp-agent.ini" - - name: DEPENDENCY_JOBS - value: "{{ include "joinListWithColon" .Values.dependencies.dhcp.jobs }}" - - name: DEPENDENCY_SERVICE - value: "{{ include "joinListWithColon" .Values.dependencies.dhcp.service }}" - - name: DEPENDENCY_DAEMONSET - value: "{{ include "joinListWithColon" .Values.dependencies.dhcp.daemonset }}" + command: + - neutron-dhcp-agent + - --config-file + - /etc/neutron/neutron.conf + - --config-file + - /etc/neutron/dhcp-agent.ini volumeMounts: - name: neutronconf mountPath: /etc/neutron/neutron.conf @@ -61,7 +53,7 @@ spec: mountPath: /var/lib/neutron/openstack-helm - name: resolvconf mountPath: /etc/resolv.conf - subPath: resolv.conf + subPath: resolv.conf volumes: - name: neutronconf configMap: diff --git a/neutron/templates/daemonset-l3-agent.yaml b/neutron/templates/daemonset-l3-agent.yaml index 7428f94419..c73ba0da3c 100644 --- a/neutron/templates/daemonset-l3-agent.yaml +++ b/neutron/templates/daemonset-l3-agent.yaml @@ -1,3 +1,5 @@ +{{- $envAll := . }} +{{- $dependencies := .Values.dependencies.l3 }} apiVersion: extensions/v1beta1 kind: DaemonSet metadata: @@ -9,7 +11,10 @@ spec: app: neutron-l3-agent annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }} - configmap-etc-hash: {{ tuple "configmap-etc.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 }} + ]' spec: nodeSelector: {{ .Values.labels.agent.l3.node_selector_key }}: {{ .Values.labels.agent.l3.node_selector_value }} @@ -23,25 +28,14 @@ spec: imagePullPolicy: {{ .Values.images.pull_policy }} securityContext: privileged: true - env: - - name: INTERFACE_NAME - value: {{ .Values.network.interface.l3 | default .Values.network.interface.default }} - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: COMMAND - value: "neutron-l3-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/l3-agent.ini --config-file /etc/neutron/plugins/ml2/ml2-conf.ini" - - name: DEPENDENCY_JOBS - value: "{{ include "joinListWithColon" .Values.dependencies.l3.jobs }}" - - name: DEPENDENCY_SERVICE - value: "{{ include "joinListWithColon" .Values.dependencies.l3.service }}" - - name: DEPENDENCY_DAEMONSET - value: "{{ include "joinListWithColon" .Values.dependencies.l3.daemonset }}" + command: + - neutron-l3-agent + - --config-file + - /etc/neutron/neutron.conf + - --config-file + - /etc/neutron/l3-agent.ini + - --config-file + - /etc/neutron/plugins/ml2/ml2-conf.ini volumeMounts: - name: neutronconf mountPath: /etc/neutron/neutron.conf @@ -54,7 +48,7 @@ spec: subPath: l3-agent.ini - name: resolvconf mountPath: /etc/resolv.conf - subPath: resolv.conf + subPath: resolv.conf - name: runopenvswitch mountPath: /run/openvswitch - name: socket diff --git a/neutron/templates/daemonset-metadata-agent.yaml b/neutron/templates/daemonset-metadata-agent.yaml index 2ffc16df5c..6d1804aec8 100644 --- a/neutron/templates/daemonset-metadata-agent.yaml +++ b/neutron/templates/daemonset-metadata-agent.yaml @@ -1,3 +1,5 @@ +{{- $envAll := . }} +{{- $dependencies := .Values.dependencies.metadata }} apiVersion: extensions/v1beta1 kind: DaemonSet metadata: @@ -9,7 +11,10 @@ spec: app: neutron-metadata-agent annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }} - configmap-etc-hash: {{ tuple "configmap-etc.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 }} + ]' spec: nodeSelector: {{ .Values.labels.agent.metadata.node_selector_key }}: {{ .Values.labels.agent.metadata.node_selector_value }} @@ -23,27 +28,14 @@ spec: imagePullPolicy: {{ .Values.images.pull_policy }} securityContext: privileged: true - env: - - name: INTERFACE_NAME - value: {{ .Values.network.interface.metadata | default .Values.network.interface.default }} - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: COMMAND - value: "neutron-metadata-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata-agent.ini" - - name: DEPENDENCY_JOBS - value: "{{ include "joinListWithColon" .Values.dependencies.metadata.jobs }}" - - name: DEPENDENCY_SERVICE - value: "{{ include "joinListWithColon" .Values.dependencies.metadata.service }}" - - name: DEPENDENCY_DAEMONSET - value: "{{ include "joinListWithColon" .Values.dependencies.metadata.daemonset }}" + command: + - neutron-metadata-agent + - --config-file + - /etc/neutron/neutron.conf + - --config-file + - /etc/neutron/metadata-agent.ini ports: - - containerPort: {{ .Values.network.port.metadata }} + - containerPort: {{ .Values.network.port.metadata }} volumeMounts: - name: neutronconf mountPath: /etc/neutron/neutron.conf @@ -56,7 +48,7 @@ spec: subPath: metadata-agent.ini - name: resolvconf mountPath: /etc/resolv.conf - subPath: resolv.conf + subPath: resolv.conf - name: runopenvswitch mountPath: /run/openvswitch - name: socket @@ -73,10 +65,10 @@ spec: name: neutron-etc - name: resolvconf configMap: - name: neutron-etc + name: neutron-etc - name: runopenvswitch hostPath: path: /run/openvswitch - name: socket hostPath: - path: /var/lib/neutron/openstack-helm \ No newline at end of file + path: /var/lib/neutron/openstack-helm diff --git a/neutron/templates/daemonset-ovs-agent.yaml b/neutron/templates/daemonset-ovs-agent.yaml index f1518ab3aa..a0e173c7ce 100644 --- a/neutron/templates/daemonset-ovs-agent.yaml +++ b/neutron/templates/daemonset-ovs-agent.yaml @@ -1,3 +1,5 @@ +{{- $envAll := . }} +{{- $dependencies := .Values.dependencies.ovs_agent }} apiVersion: extensions/v1beta1 kind: DaemonSet metadata: @@ -9,10 +11,13 @@ spec: app: ovs-agent annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }} - configmap-etc-hash: {{ tuple "configmap-etc.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 }} + ]' spec: nodeSelector: - {{ .Values.labels.ovs.node_selector_key }}: {{ .Values.labels.ovs.node_selector_value }} + {{ .Values.labels.ovs.node_selector_key }}: {{ .Values.labels.ovs.node_selector_value }} securityContext: runAsUser: 0 dnsPolicy: ClusterFirst @@ -23,6 +28,9 @@ spec: imagePullPolicy: {{ .Values.images.pull_policy }} securityContext: privileged: true + command: + - bash + - /tmp/neutron-openvswitch-agent.sh # ensures this container can can see a br-int # bridge before its marked as ready readinessProbe: @@ -31,23 +39,6 @@ spec: - bash - -c - 'ovs-vsctl list-br | grep -q br-int' - env: - - name: INTERFACE_NAME - value: {{ .Values.network.interface.openvswitch | default .Values.network.interface.default }} - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: COMMAND - value: "bash /tmp/neutron-openvswitch-agent.sh" - - name: DEPENDENCY_JOBS - value: "{{ include "joinListWithColon" .Values.dependencies.ovs_agent.jobs }}" - - name: DEPENDENCY_SERVICE - value: "{{ include "joinListWithColon" .Values.dependencies.ovs_agent.service }}" volumeMounts: - name: neutronopenvswitchagentsh mountPath: /tmp/neutron-openvswitch-agent.sh @@ -86,4 +77,4 @@ spec: path: /lib/modules - name: run hostPath: - path: /run + path: /run diff --git a/neutron/templates/daemonset-ovs-db.yaml b/neutron/templates/daemonset-ovs-db.yaml index 6b877abff9..f503231c71 100644 --- a/neutron/templates/daemonset-ovs-db.yaml +++ b/neutron/templates/daemonset-ovs-db.yaml @@ -9,10 +9,10 @@ spec: app: ovs-db annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }} - configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }} + configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }} spec: nodeSelector: - {{ .Values.labels.ovs.node_selector_key }}: {{ .Values.labels.ovs.node_selector_value }} + {{ .Values.labels.ovs.node_selector_key }}: {{ .Values.labels.ovs.node_selector_value }} securityContext: runAsUser: 0 dnsPolicy: ClusterFirst @@ -23,19 +23,9 @@ spec: imagePullPolicy: {{ .Values.images.pull_policy }} securityContext: privileged: true - env: - - name: INTERFACE_NAME - value: {{ .Values.network.interface.openvswitch | default .Values.network.interface.default }} - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: COMMAND - value: "bash /tmp/openvswitch-db-server.sh" + command: + - bash + - /tmp/openvswitch-db-server.sh volumeMounts: - name: openvswitchdbserversh mountPath: /tmp/openvswitch-db-server.sh @@ -62,4 +52,3 @@ spec: - name: run hostPath: path: /run - diff --git a/neutron/templates/daemonset-ovs-vswitchd.yaml b/neutron/templates/daemonset-ovs-vswitchd.yaml index b07047e376..da33099bd8 100644 --- a/neutron/templates/daemonset-ovs-vswitchd.yaml +++ b/neutron/templates/daemonset-ovs-vswitchd.yaml @@ -9,10 +9,10 @@ spec: app: ovs-vswitchd annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }} - configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }} + configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "hash" }} spec: nodeSelector: - {{ .Values.labels.ovs.node_selector_key }}: {{ .Values.labels.ovs.node_selector_value }} + {{ .Values.labels.ovs.node_selector_key }}: {{ .Values.labels.ovs.node_selector_value }} securityContext: runAsUser: 0 dnsPolicy: ClusterFirst @@ -30,19 +30,9 @@ spec: command: - /usr/bin/ovs-vsctl - show - env: - - name: INTERFACE_NAME - value: {{ .Values.network.interface.openvswitch | default .Values.network.interface.default }} - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: COMMAND - value: "bash /tmp/openvswitch-vswitchd.sh" + command: + - bash + - /tmp/openvswitch-vswitchd.sh volumeMounts: - name: openvswitchvswitchdsh mountPath: /tmp/openvswitch-vswitchd.sh diff --git a/neutron/templates/deployment-server.yaml b/neutron/templates/deployment-server.yaml index 66aa7412d7..95abe45084 100644 --- a/neutron/templates/deployment-server.yaml +++ b/neutron/templates/deployment-server.yaml @@ -1,3 +1,5 @@ +{{- $envAll := . }} +{{- $dependencies := .Values.dependencies.server }} apiVersion: extensions/v1beta1 kind: Deployment metadata: @@ -11,14 +13,17 @@ spec: rollingUpdate: maxUnavailable: {{ .Values.upgrades.rolling_update.max_unavailable }} maxSurge: {{ .Values.upgrades.rolling_update.max_surge }} - {{ end }} + {{ end }} template: metadata: labels: app: neutron-server annotations: configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "hash" }} - configmap-etc-hash: {{ tuple "configmap-etc.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 }} + ]' spec: nodeSelector: {{ .Values.labels.server.node_selector_key }}: {{ .Values.labels.server.node_selector_value }} @@ -26,23 +31,12 @@ spec: - name: neutron-server image: {{ .Values.images.server }} imagePullPolicy: {{ .Values.images.pull_policy }} - env: - - name: INTERFACE_NAME - value: "eth0" - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: COMMAND - value: "neutron-server --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2-conf.ini" - - name: DEPENDENCY_JOBS - value: "{{ include "joinListWithColon" .Values.dependencies.server.jobs }}" - - name: DEPENDENCY_SERVICE - value: "{{ include "joinListWithColon" .Values.dependencies.server.service }}" + command: + - neutron-server + - --config-file + - /etc/neutron/neutron.conf + - --config-file + - /etc/neutron/plugins/ml2/ml2-conf.ini ports: - containerPort: {{ .Values.network.port.server }} readinessProbe: diff --git a/neutron/templates/job-db-sync.yaml b/neutron/templates/job-db-sync.yaml index e34f36dc3a..1070a2da58 100644 --- a/neutron/templates/job-db-sync.yaml +++ b/neutron/templates/job-db-sync.yaml @@ -1,9 +1,16 @@ +{{- $envAll := . }} +{{- $dependencies := .Values.dependencies.db_sync }} apiVersion: batch/v1 kind: Job metadata: name: neutron-db-sync spec: template: + metadata: + annotations: + pod.beta.kubernetes.io/init-containers: '[ +{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }} + ]' spec: restartPolicy: OnFailure nodeSelector: @@ -12,24 +19,17 @@ spec: - name: neutron-db-sync image: {{ .Values.images.db_sync }} imagePullPolicy: {{ .Values.images.pull_policy }} - env: - - name: INTERFACE_NAME - value: "eth0" - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: COMMAND - value: "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2-conf.ini upgrade head" - - name: DEPENDENCY_JOBS - value: "{{ include "joinListWithColon" .Values.dependencies.db_sync.jobs }}" - - name: DEPENDENCY_SERVICE - value: "{{ include "joinListWithColon" .Values.dependencies.db_sync.service }}" + command: + - neutron-db-manage + - --config-file + - /etc/neutron/neutron.conf + - --config-file + - /etc/neutron/plugins/ml2/ml2-conf.ini + - upgrade + - head volumeMounts: + - name: pod-etc-neutron + mountPath: /etc/neutron - name: neutronconf mountPath: /etc/neutron/neutron.conf subPath: neutron.conf @@ -37,6 +37,8 @@ spec: mountPath: /etc/neutron/plugins/ml2/ml2-conf.ini subPath: ml2-conf.ini volumes: + - name: pod-etc-neutron + emptyDir: {} - name: neutronconf configMap: name: neutron-etc diff --git a/neutron/templates/job-init.yaml b/neutron/templates/job-init.yaml index d7d3401714..430601b35d 100644 --- a/neutron/templates/job-init.yaml +++ b/neutron/templates/job-init.yaml @@ -1,9 +1,16 @@ +{{- $envAll := . }} +{{- $dependencies := .Values.dependencies.db_init }} apiVersion: batch/v1 kind: Job metadata: name: neutron-init spec: template: + metadata: + annotations: + pod.beta.kubernetes.io/init-containers: '[ +{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }} + ]' spec: restartPolicy: OnFailure nodeSelector: @@ -12,23 +19,9 @@ spec: - name: neutron-init image: {{ .Values.images.init }} imagePullPolicy: {{ .Values.images.pull_policy }} - env: - - name: INTERFACE_NAME - value: "eth0" - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: COMMAND - value: "bash /tmp/init.sh" - - name: DEPENDENCY_JOBS - value: "{{ include "joinListWithColon" .Values.dependencies.init.jobs }}" - - name: DEPENDENCY_SERVICE - value: "{{ include "joinListWithColon" .Values.dependencies.init.service }}" + command: + - bash + - /tmp/init.sh volumeMounts: - name: initsh mountPath: /tmp/init.sh diff --git a/neutron/templates/job-post.yaml b/neutron/templates/job-post.yaml index 6c3a05d280..80dc94f2b8 100644 --- a/neutron/templates/job-post.yaml +++ b/neutron/templates/job-post.yaml @@ -1,9 +1,16 @@ +{{- $envAll := . }} +{{- $dependencies := .Values.dependencies.db_sync }} apiVersion: batch/v1 kind: Job metadata: name: neutron-post spec: template: + metadata: + annotations: + pod.beta.kubernetes.io/init-containers: '[ +{{ tuple $envAll $dependencies | include "dep_check_init_cont" | indent 10 }} + ]' spec: restartPolicy: OnFailure nodeSelector: @@ -12,23 +19,10 @@ spec: - name: neutron-post image: {{ .Values.images.post }} imagePullPolicy: {{ .Values.images.pull_policy }} + command: + - bash + - /tmp/post.sh env: - - name: INTERFACE_NAME - value: "eth0" - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: COMMAND - value: "bash /tmp/post.sh" - - name: DEPENDENCY_JOBS - value: "{{ include "joinListWithColon" .Values.dependencies.post.jobs }}" - - name: DEPENDENCY_SERVICE - value: "{{ include "joinListWithColon" .Values.dependencies.post.service }}" - name: ANSIBLE_LIBRARY value: /usr/share/ansible/ volumeMounts: diff --git a/neutron/values.yaml b/neutron/values.yaml index 434ea41fd7..7f965b51b4 100644 --- a/neutron/values.yaml +++ b/neutron/values.yaml @@ -17,7 +17,7 @@ images: openvswitch_db_server: quay.io/attcomdev/openvswitch-vswitchd:latest openvswitch_vswitchd: quay.io/attcomdev/openvswitch-vswitchd:latest post: quay.io/stackanetes/stackanetes-kolla-toolbox:newton - entrypoint: quay.io/stackanetes/kubernetes-entrypoint:v0.1.0 + dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.1.0 pull_policy: "IfNotPresent" upgrades: @@ -39,7 +39,7 @@ labels: dhcp: node_selector_key: openstack-control-plane node_selector_value: enabled - l3: + l3: node_selector_key: openstack-control-plane node_selector_value: enabled metadata: @@ -54,7 +54,7 @@ network: kubernetes_domain: cluster.local # this must list the skydns server first, and in calico # this is consistently 10.96.0.10 - servers: + servers: - 10.96.0.10 - 8.8.8.8 external_bridge: br-ex @@ -62,14 +62,14 @@ network: interface: external: enp12s0f0 default: enp11s0f0 - port: + port: server: 9696 metadata: 8775 -memcached: +memcached: address: "memcached:11211" -rabbitmq: +rabbitmq: address: rabbitmq admin_user: rabbitmq admin_password: password @@ -136,7 +136,7 @@ ml2: bridge_mappings: - "physnet1:br-physnet1" -dependencies: +dependencies: server: jobs: - neutron-db-sync @@ -185,10 +185,10 @@ dependencies: - ovs-agent db_sync: jobs: - - neutron-init + - neutron-db-init service: - mariadb - init: + db_init: jobs: - mariadb-seed service: @@ -199,7 +199,7 @@ dependencies: jobs: - neutron-db-sync -# typically overriden by environmental +# typically overriden by environmental # values, but should include all endpoints # required by this chart endpoints: From 8317202e3d8fd3df3e98007a77d3da9e71b32949 Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Sun, 22 Jan 2017 05:45:30 +0000 Subject: [PATCH 3/4] Standardise DB Job names Standardise the DB creation job name to service-db-init for all services. --- .../{job-init.yaml => job-db-init.yaml} | 6 ++--- glance/values.yaml | 17 +++++++------ .../{job-init.yaml => job-db-init.yaml} | 6 ++--- keystone/values.yaml | 4 ++-- .../{job-init.yaml => job-db-init.yaml} | 6 ++--- neutron/values.yaml | 10 ++++---- .../{job-init.yaml => job-db-init.yaml} | 6 ++--- nova/values.yaml | 24 +++++++++---------- 8 files changed, 39 insertions(+), 40 deletions(-) rename glance/templates/{job-init.yaml => job-db-init.yaml} (89%) rename keystone/templates/{job-init.yaml => job-db-init.yaml} (88%) rename neutron/templates/{job-init.yaml => job-db-init.yaml} (88%) rename nova/templates/{job-init.yaml => job-db-init.yaml} (89%) diff --git a/glance/templates/job-init.yaml b/glance/templates/job-db-init.yaml similarity index 89% rename from glance/templates/job-init.yaml rename to glance/templates/job-db-init.yaml index 5bf5f0635c..c66375c96e 100644 --- a/glance/templates/job-init.yaml +++ b/glance/templates/job-db-init.yaml @@ -3,7 +3,7 @@ apiVersion: batch/v1 kind: Job metadata: - name: glance-init + name: glance-db-init spec: template: metadata: @@ -16,8 +16,8 @@ spec: nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} containers: - - name: glance-init - image: {{ .Values.images.init }} + - name: glance-db-init + image: {{ .Values.images.db_init }} imagePullPolicy: {{ .Values.images.pull_policy }} env: - name: ANSIBLE_LIBRARY diff --git a/glance/values.yaml b/glance/values.yaml index d10670fea6..e8ab2f70a2 100644 --- a/glance/values.yaml +++ b/glance/values.yaml @@ -16,9 +16,9 @@ labels: node_selector_value: enabled images: + db_init: quay.io/stackanetes/stackanetes-kolla-toolbox:newton db_sync: quay.io/stackanetes/stackanetes-glance-api:newton api: quay.io/stackanetes/stackanetes-glance-api:newton - init: quay.io/stackanetes/stackanetes-kolla-toolbox:newton registry: quay.io/stackanetes/stackanetes-glance-registry:newton post: quay.io/stackanetes/stackanetes-kolla-toolbox:newton dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.1.0 @@ -75,7 +75,7 @@ misc: dependencies: api: jobs: - - glance-init + - glance-db-init - glance-db-sync - keystone-db-sync service: @@ -83,7 +83,7 @@ dependencies: - mariadb registry: jobs: - - glance-init + - glance-db-init - glance-db-sync - keystone-db-sync service: @@ -92,9 +92,9 @@ dependencies: - glance-api db_sync: jobs: - - keystone-init + - keystone-db-init - keystone-db-sync - - glance-init + - glance-db-init - mariadb-seed service: - mariadb @@ -105,10 +105,10 @@ dependencies: - mariadb post: jobs: - - glance-init + - glance-db-init - glance-db-sync - keystone-db-sync - - keystone-init + - keystone-db-init - mariadb-seed service: - mariadb @@ -116,7 +116,7 @@ dependencies: - glance-api - glance-registry -# typically overriden by environmental +# typically overriden by environmental # values, but should include all endpoints # required by this chart endpoints: @@ -138,4 +138,3 @@ endpoints: port: admin: 35357 public: 5000 - diff --git a/keystone/templates/job-init.yaml b/keystone/templates/job-db-init.yaml similarity index 88% rename from keystone/templates/job-init.yaml rename to keystone/templates/job-db-init.yaml index 4e41f4ff86..b0443a5931 100644 --- a/keystone/templates/job-init.yaml +++ b/keystone/templates/job-db-init.yaml @@ -3,7 +3,7 @@ apiVersion: batch/v1 kind: Job metadata: - name: keystone-init + name: keystone-db-init spec: template: metadata: @@ -16,8 +16,8 @@ spec: nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} containers: - - name: keystone-init - image: {{ .Values.images.init }} + - name: keystone-db-init + image: {{ .Values.images.db_init }} imagePullPolicy: {{ .Values.images.pull_policy }} command: - bash diff --git a/keystone/values.yaml b/keystone/values.yaml index 6e7fd06dce..1aa064a1d0 100644 --- a/keystone/values.yaml +++ b/keystone/values.yaml @@ -10,9 +10,9 @@ labels: node_selector_value: enabled images: + db_init: quay.io/stackanetes/stackanetes-kolla-toolbox:newton db_sync: quay.io/stackanetes/stackanetes-keystone-api:newton api: quay.io/stackanetes/stackanetes-keystone-api:newton - init: quay.io/stackanetes/stackanetes-kolla-toolbox:newton dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.1.0 pull_policy: "IfNotPresent" @@ -67,7 +67,7 @@ dependencies: - mariadb db_sync: jobs: - - keystone-init + - keystone-db-init - mariadb-seed service: - mariadb diff --git a/neutron/templates/job-init.yaml b/neutron/templates/job-db-init.yaml similarity index 88% rename from neutron/templates/job-init.yaml rename to neutron/templates/job-db-init.yaml index 430601b35d..b04d7c6338 100644 --- a/neutron/templates/job-init.yaml +++ b/neutron/templates/job-db-init.yaml @@ -3,7 +3,7 @@ apiVersion: batch/v1 kind: Job metadata: - name: neutron-init + name: neutron-db-init spec: template: metadata: @@ -16,8 +16,8 @@ spec: nodeSelector: {{ .Values.labels.server.node_selector_key }}: {{ .Values.labels.server.node_selector_value }} containers: - - name: neutron-init - image: {{ .Values.images.init }} + - name: neutron-db-init + image: {{ .Values.images.db_init }} imagePullPolicy: {{ .Values.images.pull_policy }} command: - bash diff --git a/neutron/values.yaml b/neutron/values.yaml index 7f965b51b4..4502fe0d8c 100644 --- a/neutron/values.yaml +++ b/neutron/values.yaml @@ -7,7 +7,7 @@ replicas: server: 1 images: - init: quay.io/stackanetes/stackanetes-kolla-toolbox:newton + db_init: quay.io/stackanetes/stackanetes-kolla-toolbox:newton db_sync: quay.io/stackanetes/stackanetes-neutron-server:newton server: quay.io/stackanetes/stackanetes-neutron-server:newton dhcp: quay.io/stackanetes/stackanetes-neutron-dhcp-agent:newton @@ -151,7 +151,7 @@ dependencies: - rabbitmq - nova-api jobs: - - neutron-init + - neutron-db-init - nova-post daemonset: - ovs-agent @@ -160,7 +160,7 @@ dependencies: - rabbitmq - nova-api jobs: - - neutron-init + - neutron-db-init - nova-post daemonset: - ovs-agent @@ -178,8 +178,8 @@ dependencies: - rabbitmq - nova-api jobs: - - nova-init - - neutron-init + - nova-db-init + - neutron-db-init - nova-post daemonset: - ovs-agent diff --git a/nova/templates/job-init.yaml b/nova/templates/job-db-init.yaml similarity index 89% rename from nova/templates/job-init.yaml rename to nova/templates/job-db-init.yaml index 8db6c2b664..dce9a652a7 100644 --- a/nova/templates/job-init.yaml +++ b/nova/templates/job-db-init.yaml @@ -3,7 +3,7 @@ apiVersion: batch/v1 kind: Job metadata: - name: nova-init + name: nova-db-init spec: template: metadata: @@ -16,8 +16,8 @@ spec: nodeSelector: {{ .Values.labels.control_node_selector_key }}: {{ .Values.labels.control_node_selector_value }} containers: - - name: nova-init - image: {{ .Values.images.init }} + - name: nova-db-init + image: {{ .Values.images.db_init }} imagePullPolicy: {{ .Values.images.pull_policy }} command: - bash diff --git a/nova/values.yaml b/nova/values.yaml index 1888add52b..6cc3baa28f 100644 --- a/nova/values.yaml +++ b/nova/values.yaml @@ -13,7 +13,7 @@ control_replicas: 1 compute_replicas: 1 images: - init: quay.io/stackanetes/stackanetes-kolla-toolbox:newton + db_init: quay.io/stackanetes/stackanetes-kolla-toolbox:newton db_sync: quay.io/stackanetes/stackanetes-nova-api:newton api: quay.io/stackanetes/stackanetes-nova-api:newton conductor: quay.io/stackanetes/stackanetes-nova-conductor:newton @@ -108,31 +108,31 @@ memcached: dependencies: api: - jobs: + jobs: - keystone-db-sync - - nova-init + - nova-db-init - nova-db-sync service: - mariadb db_sync: jobs: - - nova-init - - keystone-init + - nova-db-init + - keystone-db-init - mariadb-seed service: - mariadb db_sync: jobs: - - nova-init - - keystone-init + - nova-db-init + - keystone-db-init - mariadb-seed - keystone-db-sync service: - mariadb post: jobs: - - nova-init - - keystone-init + - nova-db-init + - keystone-db-init - mariadb-seed service: - mariadb @@ -152,7 +152,7 @@ dependencies: - ovs-agent libvirt: jobs: - - nova-init + - nova-db-init - nova-post - nova-db-sync service: @@ -162,7 +162,7 @@ dependencies: jobs: - mariadb-seed - keystone-db-sync - - nova-init + - nova-db-init - nova-db-sync service: - mariadb @@ -177,7 +177,7 @@ dependencies: service: - mariadb -# typically overriden by environmental +# typically overriden by environmental # values, but should include all endpoints # required by this chart endpoints: From 73ca6d8fee563fff8796ec4c7a66bf57bc2f8ff2 Mon Sep 17 00:00:00 2001 From: "Brandon B. Jozsa" Date: Wed, 25 Jan 2017 14:39:06 -0600 Subject: [PATCH 4/4] Initial Commit for Community Readme Docs (#146) * initial readme.md for docs * initial readme.md for docs * initial readme.md for docs * formatting, updates, and additions to minikube docs --- docs/README.md | 51 ++++++++++++++++++++++++++++++++++ docs/developer/minikube.md | 56 +++++++++++++++++++++++++++++++++++++- 2 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 docs/README.md diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000000..3d83f9708d --- /dev/null +++ b/docs/README.md @@ -0,0 +1,51 @@ +# Openstack-Helm Documentation + + +## Table of Contents + +##  1. [Openstack-Helm Design Principals]() +###    1.1 [Mission]() +#####      1.1.1 [Resiliency]() +#####      1.1.2 [Scaling]() +###    1.2 [Helm Overrides]() +#####      1.2.1 [Resource Limits]() +#####      1.2.2 [Conditionals]() +###    1.3 [Init-Containers]() +#####      1.3.1 [Dependency Checking]() +###    1.4 [Kubernetes Jobs]() +#####      1.4.1 [Service Registration]() +#####      1.4.2 [User Registration]() +#####      1.4.3 [Database Creation]() +#####      1.4.4 [Database Migration]() +###    1.5 [Complimentary Efforts]() +####      1.5.1 [Image-Based Project Considerations]() +###    1.6 [Kubernetes State]() +####      1.6.1 [Third Party Resources]() +####      1.6.2 [Add-Ons]() +##  2. [Repository Structure]() +###    2.1 [Infrastructure Components]() +###    2.2 [Openstack-Helm Core Services]() +###    2.3 [Openstack-Helm Add-Ons]() +##  3. [Operator Resources]() +###     3.1 [Installation](https://github.com/att-comdev/openstack-helm/blob/master/docs/installation/getting-started.md) +###     3.2 [Openstack-Helm Chart Definition Overrides]() +###     3.2 [Openstacak-Helm Upgrades]() +##  4. [Openstack-Helm Networking]() +###    4.1 [Kubernetes Control Plane]() +####     4.1.1 [CNI SDN Considerations]() +####     4.1.2 [Calico Networking]() +###    4.2 [Ingress Philosophy]() +###    4.3 [Openstack Networking]() +####     4.3.1 [Flat Networking]() +####     4.3.1 [L2 Networking]() +##  5. [Security Guidelines]() +###    5.1 [Network Policies]() +###    5.2 [Advanced Network Policies]() +###    5.3 [Role-Based Access Controls]() +###    5.4 [Security Contexts]() +###    5.5 [Security Add-Ons]() +##  6. [Developer Resources](https://github.com/att-comdev/openstack-helm/tree/master/docs/developer) +###    6.1 [Contributions and Guidelines]() +###    6.2 [Development Tools]() +####     6.2.1 [Minikube Development](https://github.com/att-comdev/openstack-helm/blob/master/docs/developer/minikube.md) +###    6.3 [Tips and Considerations]() diff --git a/docs/developer/minikube.md b/docs/developer/minikube.md index 1058a984ed..0e6ece1851 100644 --- a/docs/developer/minikube.md +++ b/docs/developer/minikube.md @@ -3,7 +3,9 @@ Community development is extremely important to us. As an open source development team, we want the development of Openstack-Helm to be an easy experience. Please evaluate, and make recommendations. We want developers to feel welcome to contribute to this project. Below are some instructions and suggestions to help you get started. # Requirements -We've tried to minimize the number of prerequisites required in order to get started. The main prerequisite is to install the most recent versions of Minikube and Helm. +We've tried to minimize the number of prerequisites required in order to get started. For most users, the main prerequisites are to install the most recent versions of Minikube and Helm. For fresh installations, you may also need to install a Hypervisor that works for your system (that is supported by [Minikube](https://kubernetes.io/docs/getting-started-guides/minikube/#requirements)). + +**Kubectl:** Download and install the version of [`kubectl`](https://kubernetes.io/docs/getting-started-guides/kubectl/) that matches your Kubernetes deployment. **Kubernetes Minikube:** Ensure that you have installed a recent version of [Kubernetes/Minikube](http://kubernetes.io/docs/getting-started-guides/minikube/). @@ -19,6 +21,58 @@ $ chmod 700 get_helm.sh $ ./get_helm.sh ``` +# TLDR; + +If your environment meets all of the prerequisites above, you can simply use the following commands: + +``` +# Clone the project: +$ git clone https://github.com/att-comdev/openstack-helm.git && cd openstack-helm + +# Get a list of the current tags: +$ git tag -l +0.1.0 + +# Checkout the tag you want to work with (if desired, or use master for development): +$ git checkout 0.1.0 + +# Start a local Helm Server: +$ helm serve & + +# You may need to change these params for your environment. Look up use of --iso-url if needed: +$ minikube start \ + --network-plugin=cni \ + --kubernetes-version v1.5.1 \ + --disk-size 40g \ + --memory 16384 \ + --cpus 4 \ + --vm-driver kvm \ + --iso-url=https://storage.googleapis.com/minikube/iso/minikube-v1.0.4.iso + +# Deploy a CNI/SDN: +kubectl create -f http://docs.projectcalico.org/v2.0/getting-started/kubernetes/installation/hosted/calico.yaml + +# Initialize Helm/Deploy Tiller: +$ helm init + +# Package the Openstack-Helm Charts, and push them to your local Helm repository: +$ make + +# Label the Minikube as an Openstack Control Plane node: +$ kubectl label nodes openstack-control-plane=enabled --all --namespace=openstack + +# Deploy each chart: +$ helm install --name mariadb --set development.enabled=true local/mariadb --namespace=openstack +$ helm install --name=memcached local/memcached --namespace=openstack +$ helm install --name=rabbitmq local/rabbitmq --namespace=openstack +$ helm install --name=keystone local/keystone --namespace=openstack +$ helm install --name=cinder local/cinder --namespace=openstack +$ helm install --name=glance local/glance --namespace=openstack +$ helm install --name=heat local/heat --namespace=openstack +$ helm install --name=nova local/nova --namespace=openstack +$ helm install --name=neutron local/neutron --namespace=openstack +$ helm install --name=horizon local/horizon --namespace=openstack +``` # Getting Started