deckhand/charts/deckhand/templates/deployment.yaml

110 lines
4.8 KiB
YAML

{{/*
# 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.deployment }}
{{- $envAll := . }}
{{- $mounts_deckhand := .Values.pod.mounts.deckhand.deckhand }}
{{- $mounts_deckhand_init := .Values.pod.mounts.deckhand.init_container }}
{{- $serviceAccountName := "deckhand" }}
{{ tuple $envAll "deckhand" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: deckhand-api
spec:
replicas: {{ .Values.pod.replicas.deckhand }}
{{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }}
template:
metadata:
labels:
{{ tuple $envAll "deckhand" "api" | 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 }}
nodeSelector:
{{ .Values.labels.api.node_selector_key }}: {{ .Values.labels.api.node_selector_value }}
terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.deckhand.timeout | default "30" }}
restartPolicy: Always
initContainers:
{{ tuple $envAll "deckhand" $mounts_deckhand_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers:
- name: deckhand-api
env:
- name: 'DECKHAND_API_TIMEOUT'
value: {{ .Values.conf.uwsgi.timeout | default 600 | quote }}
# NOTE(fmontei): Deckhand's database is not configured to work with
# multiprocessing. Currently there is a data race on acquiring shared
# SQLAlchemy engine pooled connection strings when workers > 1. As a
# workaround, we use multiple threads but only 1 worker. For more
# information, see: https://github.com/att-comdev/deckhand/issues/20
- name: 'DECKHAND_API_WORKERS'
value: {{ .Values.conf.uwsgi.workers | default 1 | quote }}
- name: 'DECKHAND_API_THREADS'
value: {{ .Values.conf.uwsgi.threads | default 4 | quote }}
image: {{ .Values.images.tags.deckhand }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.pod.resources.api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
ports:
- containerPort: {{ tuple "deckhand" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
readinessProbe:
httpGet:
scheme: HTTP
path: /api/v1.0/health
port: {{ tuple "deckhand" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
initialDelaySeconds: 15
periodSeconds: 20
timeoutSeconds: 10
volumeMounts:
- name: etc-deckhand
mountPath: /etc/deckhand
- name: deckhand-etc
mountPath: /etc/deckhand/deckhand.conf
subPath: deckhand.conf
readOnly: true
- name: deckhand-etc
mountPath: /etc/deckhand/logging.conf
subPath: logging.conf
readOnly: true
- name: deckhand-etc
mountPath: /etc/deckhand/deckhand-paste.ini
subPath: deckhand-paste.ini
readOnly: true
- name: deckhand-etc
mountPath: /etc/deckhand/policy.yaml
subPath: policy.yaml
readOnly: true
{{ if .Values.conf.deckhand.DEFAULT.profiler }}
- name: tmp-profiles
mountPath: /tmp/profiles
{{ end }}
{{ if $mounts_deckhand.volumeMounts }}{{ toYaml $mounts_deckhand.volumeMounts | indent 12 }}{{ end }}
volumes:
{{ if .Values.conf.deckhand.DEFAULT.profiler }}
- name: tmp-profiles
emptyDir: {}
{{ end }}
- name: etc-deckhand
emptyDir: {}
- name: deckhand-etc
configMap:
name: deckhand-etc
defaultMode: 0444
{{ if $mounts_deckhand.volumes }}{{ toYaml $mounts_deckhand.volumes | indent 8 }}{{ end }}
{{- end }}