summaryrefslogtreecommitdiff
path: root/charts/deckhand/templates/deployment.yaml
blob: ae2b84bfcf14ac580f62d0faace01501775dc914 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
{{/*
# 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 }}