From 385a8a099ee2fb5bbc58b588226372e26645c3cb Mon Sep 17 00:00:00 2001 From: Alan Meadows Date: Fri, 16 Dec 2016 15:22:16 -0800 Subject: [PATCH 1/2] Keystone chart bugfixes * start.sh was added back, which had requiring sourcing * the naming convention for charts is finalized with this example landing on configmap-*.yaml to satisfy those of us with OCD * imagePullPolicies added for init-containers, required by helm 2.1.0 which does not supply them by default --- common/templates/_hosts.tpl | 2 +- keystone/templates/bin/_start.sh.tpl | 8 +++++++ ...{bin-configmap.yaml => configmap-bin.yaml} | 2 ++ ...{etc-configmap.yaml => configmap-etc.yaml} | 2 +- keystone/templates/deployment.yaml | 23 +++++++++---------- keystone/templates/job-db-sync.yaml | 3 ++- keystone/templates/job-init.yaml | 3 ++- keystone/values.yaml | 1 + 8 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 keystone/templates/bin/_start.sh.tpl rename keystone/templates/{bin-configmap.yaml => configmap-bin.yaml} (74%) rename keystone/templates/{etc-configmap.yaml => configmap-etc.yaml} (94%) diff --git a/common/templates/_hosts.tpl b/common/templates/_hosts.tpl index bf55a255ce..38df30afa0 100644 --- a/common/templates/_hosts.tpl +++ b/common/templates/_hosts.tpl @@ -8,7 +8,7 @@ {{- define "mariadb_host"}}mariadb.{{.Release.Namespace}}.svc.{{ include "region" . }}.{{ include "tld" . }}{{- end}} # keystone -{{- define "keystone_db_host"}}{{ include "mariadb_host" . }}{{end}} +{{- define "keystone_db_host"}}{{ include "mariadb_host" . }}{{- end}} {{- define "keystone_api_endpoint_host_admin"}}keystone-api.{{.Release.Namespace}}.svc.{{ include "region" . }}.{{ include "tld" . }}{{- end}} {{- define "keystone_api_endpoint_host_internal"}}keystone-api.{{.Release.Namespace}}.svc.{{ include "region" . }}.{{ include "tld" . }}{{- end}} {{- define "keystone_api_endpoint_host_public"}}keystone-api.{{ include "region" . }}.{{ include "tld" . }}{{- end}} diff --git a/keystone/templates/bin/_start.sh.tpl b/keystone/templates/bin/_start.sh.tpl new file mode 100644 index 0000000000..4bafe63ee4 --- /dev/null +++ b/keystone/templates/bin/_start.sh.tpl @@ -0,0 +1,8 @@ +#!/bin/bash +set -ex + +# Loading Apache2 ENV variables +source /etc/apache2/envvars + +# start apache with any container arguments +apache2 -DFOREGROUND $* diff --git a/keystone/templates/bin-configmap.yaml b/keystone/templates/configmap-bin.yaml similarity index 74% rename from keystone/templates/bin-configmap.yaml rename to keystone/templates/configmap-bin.yaml index ea514e46fa..76e0f7cf14 100644 --- a/keystone/templates/bin-configmap.yaml +++ b/keystone/templates/configmap-bin.yaml @@ -7,3 +7,5 @@ data: {{ tuple "bin/_db-sync.sh.tpl" . | include "template" | indent 4 }} init.sh: | {{ tuple "bin/_init.sh.tpl" . | include "template" | indent 4 }} + start.sh: | +{{ tuple "bin/_start.sh.tpl" . | include "template" | indent 4 }} diff --git a/keystone/templates/etc-configmap.yaml b/keystone/templates/configmap-etc.yaml similarity index 94% rename from keystone/templates/etc-configmap.yaml rename to keystone/templates/configmap-etc.yaml index 48821fb3c8..b59534ee98 100644 --- a/keystone/templates/etc-configmap.yaml +++ b/keystone/templates/configmap-etc.yaml @@ -5,7 +5,7 @@ metadata: data: keystone.conf: |+ {{ tuple "etc/_keystone.conf.tpl" . | include "template" | indent 4 }} - mpm-event.conf: |+ + mpm_event.conf: |+ {{ tuple "etc/_mpm_event.conf.tpl" . | include "template" | indent 4 }} wsgi-keystone.conf: |+ {{ tuple "etc/_wsgi-keystone.conf.tpl" . | include "template" | indent 4 }} diff --git a/keystone/templates/deployment.yaml b/keystone/templates/deployment.yaml index d4ebbaa3e6..e2b17ffeda 100644 --- a/keystone/templates/deployment.yaml +++ b/keystone/templates/deployment.yaml @@ -13,6 +13,7 @@ spec: { "name": "init", "image": "{{ .Values.images.entrypoint }}", + "imagePullPolicy": "{{ .Values.images.pull_policy }}", "env": [ { "name": "NAMESPACE", @@ -43,9 +44,10 @@ spec: containers: - name: keystone-api image: {{ .Values.images.api }} + imagePullPolicy: {{ .Values.images.pull_policy }} command: - - apache2 - - -DFOREGROUND + - bash + - /tmp/start.sh ports: - containerPort: {{ .Values.network.port.public }} - containerPort: {{ .Values.network.port.admin }} @@ -58,26 +60,23 @@ spec: subPath: keystone.conf - name: wsgikeystone mountPath: /etc/apache2/conf-enabled/wsgi-keystone.conf - subPath: wsgi_keystone.conf + subPath: wsgi-keystone.conf - name: mpmeventconf mountPath: /etc/apache2/mods-available/mpm_event.conf subPath: mpm_event.conf + - name: startsh + mountPath: /tmp/start.sh + subPath: start.sh volumes: - name: keystoneconf configMap: name: keystone-etc - items: - - key: keystone.conf - path: keystone.conf - name: wsgikeystone configMap: name: keystone-etc - items: - - key: wsgi-keystone.conf - path: wsgi_keystone.conf - name: mpmeventconf configMap: name: keystone-etc - items: - - key: mpm-event.conf - path: mpm_event.conf + - name: startsh + configMap: + name: keystone-bin \ No newline at end of file diff --git a/keystone/templates/job-db-sync.yaml b/keystone/templates/job-db-sync.yaml index 74a26545a4..a1fe50e1ec 100644 --- a/keystone/templates/job-db-sync.yaml +++ b/keystone/templates/job-db-sync.yaml @@ -10,6 +10,7 @@ spec: { "name": "init", "image": "{{ .Values.images.entrypoint }}", + "imagePullPolicy": "{{ .Values.images.pull_policy }}", "env": [ { "name": "NAMESPACE", @@ -35,7 +36,7 @@ spec: containers: - name: keystone-db-sync image: {{ .Values.images.db_sync }} - imagePullPolicy: Always + imagePullPolicy: {{ .Values.images.pull_policy }} command: - bash - /tmp/db-sync.sh diff --git a/keystone/templates/job-init.yaml b/keystone/templates/job-init.yaml index 140885f3c3..fa9f68081f 100644 --- a/keystone/templates/job-init.yaml +++ b/keystone/templates/job-init.yaml @@ -10,6 +10,7 @@ spec: { "name": "init", "image": "{{ .Values.images.entrypoint }}", + "imagePullPolicy": "{{ .Values.images.pull_policy }}", "env": [ { "name": "NAMESPACE", @@ -35,7 +36,7 @@ spec: containers: - name: keystone-init image: {{ .Values.images.init }} - imagePullPolicy: Always + imagePullPolicy: {{ .Values.images.pull_policy }} command: - bash - /tmp/init.sh diff --git a/keystone/values.yaml b/keystone/values.yaml index 53765b262b..3b7b8e67b0 100644 --- a/keystone/values.yaml +++ b/keystone/values.yaml @@ -14,6 +14,7 @@ images: api: quay.io/stackanetes/stackanetes-keystone-api:newton init: quay.io/stackanetes/stackanetes-kolla-toolbox:newton entrypoint: quay.io/stackanetes/kubernetes-entrypoint:v0.1.0 + pull_policy: "IfNotPresent" keystone: version: v2.0 From ff61c50dcc15e855c73ae6be0d711d0ccc7c5ee4 Mon Sep 17 00:00:00 2001 From: Alan Meadows Date: Fri, 16 Dec 2016 15:39:10 -0800 Subject: [PATCH 2/2] Add trailing line to deployment.yaml --- keystone/templates/deployment.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/keystone/templates/deployment.yaml b/keystone/templates/deployment.yaml index e2b17ffeda..2a94d2498c 100644 --- a/keystone/templates/deployment.yaml +++ b/keystone/templates/deployment.yaml @@ -79,4 +79,5 @@ spec: name: keystone-etc - name: startsh configMap: - name: keystone-bin \ No newline at end of file + name: keystone-bin +