From f4f17b01b8763c01df8d25d91254f647df0473b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dulko?= Date: Thu, 8 Jun 2017 14:46:26 +0200 Subject: [PATCH] heat-engine as Deployment or StatefulSet heat-engine service can be now configured to be either Deployment or StatefulSet. Additionally this commit removes /var/cache/heat volume, as it's not used by heat-engine or other heat services at all. Change-Id: I541a1efc7817beb5f05d4cce216d9ea1cf378d7a Co-Authored-By: Mateusz Blaszkowski --- heat/templates/bin/_heat-engine.sh.tpl | 14 +++++++-- heat/templates/deployment-api.yaml | 4 --- heat/templates/deployment-cfn.yaml | 4 --- heat/templates/deployment-cloudwatch.yaml | 4 --- ...set-engine.yaml => deployment-engine.yaml} | 29 ++++++++++++++----- heat/values.yaml | 5 +++- 6 files changed, 38 insertions(+), 22 deletions(-) rename heat/templates/{statefulset-engine.yaml => deployment-engine.yaml} (73%) diff --git a/heat/templates/bin/_heat-engine.sh.tpl b/heat/templates/bin/_heat-engine.sh.tpl index f51d9a251a..96e77dc57f 100644 --- a/heat/templates/bin/_heat-engine.sh.tpl +++ b/heat/templates/bin/_heat-engine.sh.tpl @@ -17,5 +17,15 @@ limitations under the License. */}} set -x -exec heat-engine \ - --config-file /etc/heat/heat.conf +COMMAND="${@:-start}" + +function start () { + exec heat-engine \ + --config-file /etc/heat/heat.conf +} + +function stop () { + kill -TERM 1 +} + +$COMMAND diff --git a/heat/templates/deployment-api.yaml b/heat/templates/deployment-api.yaml index be5e03827e..96bae85fe6 100644 --- a/heat/templates/deployment-api.yaml +++ b/heat/templates/deployment-api.yaml @@ -66,8 +66,6 @@ spec: volumeMounts: - name: pod-etc-heat mountPath: /etc/heat - - name: pod-var-cache-heat - mountPath: /var/cache/heat - name: heat-bin mountPath: /tmp/heat-api.sh subPath: heat-api.sh @@ -88,8 +86,6 @@ spec: volumes: - name: pod-etc-heat emptyDir: {} - - name: pod-var-cache-heat - emptyDir: {} - name: heat-bin configMap: name: heat-bin diff --git a/heat/templates/deployment-cfn.yaml b/heat/templates/deployment-cfn.yaml index f6e84c1f25..3d53fb59b4 100644 --- a/heat/templates/deployment-cfn.yaml +++ b/heat/templates/deployment-cfn.yaml @@ -66,8 +66,6 @@ spec: volumeMounts: - name: pod-etc-heat mountPath: /etc/heat - - name: pod-var-cache-heat - mountPath: /var/cache/heat - name: heat-bin mountPath: /tmp/heat-cfn.sh subPath: heat-cfn.sh @@ -88,8 +86,6 @@ spec: volumes: - name: pod-etc-heat emptyDir: {} - - name: pod-var-cache-heat - emptyDir: {} - name: heat-bin configMap: name: heat-bin diff --git a/heat/templates/deployment-cloudwatch.yaml b/heat/templates/deployment-cloudwatch.yaml index a8130d874d..3f0e9d7b35 100644 --- a/heat/templates/deployment-cloudwatch.yaml +++ b/heat/templates/deployment-cloudwatch.yaml @@ -66,8 +66,6 @@ spec: volumeMounts: - name: pod-etc-heat mountPath: /etc/heat - - name: pod-var-cache-heat - mountPath: /var/cache/heat - name: heat-bin mountPath: /tmp/heat-cloudwatch.sh subPath: heat-cloudwatch.sh @@ -88,8 +86,6 @@ spec: volumes: - name: pod-etc-heat emptyDir: {} - - name: pod-var-cache-heat - emptyDir: {} - name: heat-bin configMap: name: heat-bin diff --git a/heat/templates/statefulset-engine.yaml b/heat/templates/deployment-engine.yaml similarity index 73% rename from heat/templates/statefulset-engine.yaml rename to heat/templates/deployment-engine.yaml index 1fa82454dc..5b9af9de20 100644 --- a/heat/templates/statefulset-engine.yaml +++ b/heat/templates/deployment-engine.yaml @@ -14,28 +14,40 @@ See the License for the specific language governing permissions and limitations under the License. */}} -{{- if .Values.manifests.statefulset_engine }} +{{- if or ( .Values.manifests.deployment_engine ) ( .Values.manifests.statefulset_engine ) }} {{- $envAll := . }} {{- $dependencies := .Values.dependencies.engine }} {{- $mounts_heat_engine := .Values.pod.mounts.heat_engine.heat_engine }} {{- $mounts_heat_engine_init := .Values.pod.mounts.heat_engine.init_container }} --- apiVersion: apps/v1beta1 -kind: StatefulSet metadata: name: heat-engine +{{- if .Values.manifests.deployment_engine }} +kind: Deployment +spec: +{{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} +{{- else if .Values.manifests.statefulset_engine }} +kind: StatefulSet spec: serviceName: heat-engine +{{- end }} replicas: {{ .Values.pod.replicas.engine }} template: metadata: labels: {{ tuple $envAll "heat" "engine" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} +{{- if .Values.manifests.deployment_engine }} + annotations: + configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} + configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} +{{- end }} spec: affinity: -{{ tuple $envAll "heat" "engine" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} +{{- tuple $envAll "heat" "engine" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} + terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.engine.timeout | default "30" }} initContainers: {{ tuple $envAll $dependencies $mounts_heat_engine_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: @@ -47,11 +59,16 @@ spec: runAsUser: {{ .Values.pod.user.heat.uid }} command: - /tmp/heat-engine.sh + - start + lifecycle: + preStop: + exec: + command: + - /tmp/heat-engine.sh + - stop volumeMounts: - name: pod-etc-heat mountPath: /etc/heat - - name: pod-var-cache-heat - mountPath: /var/cache/heat - name: heat-bin mountPath: /tmp/heat-engine.sh subPath: heat-engine.sh @@ -68,8 +85,6 @@ spec: volumes: - name: pod-etc-heat emptyDir: {} - - name: pod-var-cache-heat - emptyDir: {} - name: heat-bin configMap: name: heat-bin diff --git a/heat/values.yaml b/heat/values.yaml index 5b482d2c26..920eddfecb 100644 --- a/heat/values.yaml +++ b/heat/values.yaml @@ -525,6 +525,8 @@ pod: timeout: 30 cloudwatch: timeout: 30 + engine: + timeout: 30 resources: enabled: false api: @@ -626,6 +628,7 @@ manifests: deployment_api: true deployment_cfn: true deployment_cloudwatch: true + deployment_engine: true ingress_api: true ingress_cfn: true ingress_cloudwatch: true @@ -647,4 +650,4 @@ manifests: service_ingress_api: true service_ingress_cfn: true service_ingress_cloudwatch: true - statefulset_engine: true + statefulset_engine: false