From 73f89ba9702850049afdad047f1118763cee56eb Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Thu, 3 May 2018 16:42:20 -0500 Subject: [PATCH] Senlin: fix chart This ps updates the senlin chart to operate. Change-Id: I7f15bcf1c4c36688d1979026f992938335467baa --- .../bin/_senlin-engine-cleaner.sh.tpl | 21 +++++ senlin/templates/bin/_senlin-engine.sh.tpl | 2 +- senlin/templates/configmap-bin.yaml | 2 + senlin/templates/configmap-etc.yaml | 19 +++++ senlin/templates/cron-job-engine-cleaner.yaml | 83 +++++++++++++++++++ senlin/templates/deployment-api.yaml | 6 +- ...set-engine.yaml => deployment-engine.yaml} | 12 ++- senlin/values.yaml | 34 +++++++- 8 files changed, 169 insertions(+), 10 deletions(-) create mode 100644 senlin/templates/bin/_senlin-engine-cleaner.sh.tpl create mode 100644 senlin/templates/cron-job-engine-cleaner.yaml rename senlin/templates/{statefulset-engine.yaml => deployment-engine.yaml} (91%) diff --git a/senlin/templates/bin/_senlin-engine-cleaner.sh.tpl b/senlin/templates/bin/_senlin-engine-cleaner.sh.tpl new file mode 100644 index 0000000000..c63cf90860 --- /dev/null +++ b/senlin/templates/bin/_senlin-engine-cleaner.sh.tpl @@ -0,0 +1,21 @@ +#!/bin/bash + +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +set -ex + +senlin-manage service clean diff --git a/senlin/templates/bin/_senlin-engine.sh.tpl b/senlin/templates/bin/_senlin-engine.sh.tpl index b3a4dacab4..0e1fe1e333 100644 --- a/senlin/templates/bin/_senlin-engine.sh.tpl +++ b/senlin/templates/bin/_senlin-engine.sh.tpl @@ -16,6 +16,6 @@ See the License for the specific language governing permissions and limitations under the License. */}} -set -x +set -ex exec senlin-engine \ --config-file /etc/senlin/senlin.conf diff --git a/senlin/templates/configmap-bin.yaml b/senlin/templates/configmap-bin.yaml index be92adf09e..cfe6c6cfba 100644 --- a/senlin/templates/configmap-bin.yaml +++ b/senlin/templates/configmap-bin.yaml @@ -42,6 +42,8 @@ data: {{ tuple "bin/_senlin-api.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} senlin-engine.sh: | {{ tuple "bin/_senlin-engine.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} + senlin-engine-cleaner.sh: | +{{ tuple "bin/_senlin-engine-cleaner.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} rabbit-init.sh: | {{- include "helm-toolkit.scripts.rabbit_init" . | indent 4 }} {{- end }} diff --git a/senlin/templates/configmap-etc.yaml b/senlin/templates/configmap-etc.yaml index 50e95232df..1ec2cf8859 100644 --- a/senlin/templates/configmap-etc.yaml +++ b/senlin/templates/configmap-etc.yaml @@ -64,6 +64,25 @@ limitations under the License. {{- tuple "clustering" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | set .Values.conf.senlin.senlin_api "bind_port" | quote | trunc 0 -}} {{- end -}} +{{- if empty .Values.conf.senlin.authentication.auth_url -}} +{{- tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | set .Values.conf.senlin.authentication "auth_url" | quote | trunc 0 -}} +{{- end -}} +{{- if empty .Values.conf.senlin.authentication.service_password -}} +{{- set .Values.conf.senlin.authentication "service_password" .Values.endpoints.identity.auth.senlin.password | quote | trunc 0 -}} +{{- end -}} +{{- if empty .Values.conf.senlin.authentication.service_project_domain -}} +{{- set .Values.conf.senlin.authentication "service_project_domain" .Values.endpoints.identity.auth.senlin.project_domain_name | quote | trunc 0 -}} +{{- end -}} +{{- if empty .Values.conf.senlin.authentication.service_project_name -}} +{{- set .Values.conf.senlin.authentication "service_project_name" .Values.endpoints.identity.auth.senlin.project_name | quote | trunc 0 -}} +{{- end -}} +{{- if empty .Values.conf.senlin.authentication.service_user_domain -}} +{{- set .Values.conf.senlin.authentication "service_user_domain" .Values.endpoints.identity.auth.senlin.user_domain_name | quote | trunc 0 -}} +{{- end -}} +{{- if empty .Values.conf.senlin.authentication.service_username -}} +{{- set .Values.conf.senlin.authentication "service_username" .Values.endpoints.identity.auth.senlin.username | quote | trunc 0 -}} +{{- end -}} + --- apiVersion: v1 kind: ConfigMap diff --git a/senlin/templates/cron-job-engine-cleaner.yaml b/senlin/templates/cron-job-engine-cleaner.yaml new file mode 100644 index 0000000000..3cb7c58d24 --- /dev/null +++ b/senlin/templates/cron-job-engine-cleaner.yaml @@ -0,0 +1,83 @@ +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +{{- if .Values.manifests.cron_job_engine_cleaner }} +{{- $envAll := . }} +{{- $dependencies := .Values.dependencies.static.engine_cleaner }} + +{{- $mounts_senlin_engine_cleaner := .Values.pod.mounts.senlin_engine_cleaner.senlin_engine_cleaner }} +{{- $mounts_senlin_engine_cleaner_init := .Values.pod.mounts.senlin_engine_cleaner.init_container }} + +{{- $serviceAccountName := "senlin-engine-cleaner" }} +{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} +--- +apiVersion: batch/v1beta1 +kind: CronJob +metadata: + name: senlin-engine-cleaner +spec: + schedule: {{ .Values.jobs.engine_cleaner.cron | quote }} + successfulJobsHistoryLimit: {{ .Values.jobs.engine_cleaner.history.success }} + failedJobsHistoryLimit: {{ .Values.jobs.engine_cleaner.history.failed }} + concurrencyPolicy: Forbid + jobTemplate: + metadata: + labels: +{{ tuple $envAll "senlin" "engine-cleaner" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} + spec: + template: + metadata: + labels: +{{ tuple $envAll "senlin" "engine-cleaner" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 12 }} + spec: + serviceAccountName: {{ $serviceAccountName }} + restartPolicy: OnFailure + nodeSelector: + {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} + initContainers: +{{ tuple $envAll $dependencies $mounts_senlin_engine_cleaner_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 12 }} + containers: + - name: senlin-engine-cleaner + image: {{ .Values.images.tags.senlin_engine_cleaner }} + imagePullPolicy: {{ .Values.images.pull_policy }} +{{ tuple $envAll $envAll.Values.pod.resources.jobs.engine_cleaner | include "helm-toolkit.snippets.kubernetes_resources" | indent 14 }} + command: + - /tmp/senlin-engine-cleaner.sh + volumeMounts: + - name: senlin-bin + mountPath: /tmp/senlin-engine-cleaner.sh + subPath: senlin-engine-cleaner.sh + readOnly: true + - name: etcsenlin + mountPath: /etc/senlin + - name: senlin-etc + mountPath: /etc/senlin/senlin.conf + subPath: senlin.conf + readOnly: true +{{ if $mounts_senlin_engine_cleaner.volumeMounts }}{{ toYaml $mounts_senlin_engine_cleaner.volumeMounts | indent 14 }}{{ end }} + volumes: + - name: etcsenlin + emptyDir: {} + - name: senlin-etc + configMap: + name: senlin-etc + defaultMode: 0444 + - name: senlin-bin + configMap: + name: senlin-bin + defaultMode: 0555 +{{ if $mounts_senlin_engine_cleaner.volumes }}{{ toYaml $mounts_senlin_engine_cleaner.volumes | indent 10 }}{{ end }} +{{- end }} diff --git a/senlin/templates/deployment-api.yaml b/senlin/templates/deployment-api.yaml index 8f55adc044..021e4f9970 100644 --- a/senlin/templates/deployment-api.yaml +++ b/senlin/templates/deployment-api.yaml @@ -67,8 +67,12 @@ spec: - name: s-api containerPort: {{ tuple "clustering" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} readinessProbe: - tcpSocket: + httpGet: + scheme: HTTP + path: / port: {{ tuple "clustering" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} + initialDelaySeconds: 15 + periodSeconds: 10 volumeMounts: - name: senlin-bin mountPath: /tmp/senlin-api.sh diff --git a/senlin/templates/statefulset-engine.yaml b/senlin/templates/deployment-engine.yaml similarity index 91% rename from senlin/templates/statefulset-engine.yaml rename to senlin/templates/deployment-engine.yaml index 791ce824e1..fd968b1eba 100644 --- a/senlin/templates/statefulset-engine.yaml +++ b/senlin/templates/deployment-engine.yaml @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */}} -{{- if .Values.manifests.statefulset_engine }} +{{- if .Values.manifests.deployment_engine }} {{- $envAll := . }} {{- $dependencies := .Values.dependencies.static.engine }} @@ -25,16 +25,18 @@ limitations under the License. {{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} --- apiVersion: apps/v1beta1 -kind: StatefulSet +kind: Deployment metadata: name: senlin-engine spec: - serviceName: senlin-engine replicas: {{ .Values.pod.replicas.engine }} template: metadata: labels: {{ tuple $envAll "senlin" "engine" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} + 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" }} spec: serviceAccountName: {{ $serviceAccountName }} affinity: @@ -59,8 +61,6 @@ spec: readOnly: true - name: pod-etc-senlin mountPath: /etc/senlin - - name: pod-var-cache-senlin - mountPath: /var/cache/senlin - name: senlin-etc mountPath: /etc/senlin/senlin.conf subPath: senlin.conf @@ -73,8 +73,6 @@ spec: volumes: - name: pod-etc-senlin emptyDir: {} - - name: pod-var-cache-senlin - emptyDir: {} - name: senlin-bin configMap: name: senlin-bin diff --git a/senlin/values.yaml b/senlin/values.yaml index 281a4ab955..d7f5b0ccdc 100644 --- a/senlin/values.yaml +++ b/senlin/values.yaml @@ -42,9 +42,17 @@ images: ks_endpoints: docker.io/openstackhelm/heat:newton senlin_api: docker.io/openstackhelm/senlin:newton senlin_engine: docker.io/openstackhelm/senlin:newton + senlin_engine_cleaner: docker.io/openstackhelm/senlin:newton dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1 pull_policy: "IfNotPresent" +jobs: + engine_cleaner: + cron: "*/5 * * * *" + history: + success: 3 + failed: 1 + conf: paste: pipeline:senlin-api: @@ -123,8 +131,11 @@ conf: senlin: DEFAULT: transport_url: null + host: senlin database: max_retries: -1 + authentication: + auth_url: null keystone_authtoken: auth_type: password auth_version: v3 @@ -155,6 +166,16 @@ bootstrap: dependencies: static: + engine_cleaner: + jobs: + - senlin-db-sync + services: + - endpoint: internal + service: oslo_db + - endpoint: internal + service: oslo_messaging + - endpoint: internal + service: identity api: jobs: - senlin-db-sync @@ -349,6 +370,9 @@ pod: senlin_bootstrap: init_container: null senlin_bootstrap: + senlin_engine_cleaner: + init_container: null + senlin_engine_cleaner: replicas: api: 1 engine: 1 @@ -446,11 +470,20 @@ pod: limits: memory: "1024Mi" cpu: "2000m" + engine_cleaner: + requests: + memory: "124Mi" + cpu: "100m" + limits: + memory: "1024Mi" + cpu: "2000m" manifests: configmap_bin: true configmap_etc: true + cron_job_engine_cleaner: true deployment_api: true + deployment_engine: true ingress_api: true job_bootstrap: true job_db_init: true @@ -466,4 +499,3 @@ manifests: secret_rabbitmq: true service_ingress_api: true service_api: true - statefulset_engine: true