# Copyright 2017 The Openstack-Helm Authors. # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. # # 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_shipyard }} {{- $envAll := . }} {{- $labels := tuple $envAll "shipyard" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" -}} {{- $serviceAccountName := "shipyard" }} {{- $mounts_shipyard := .Values.pod.mounts.shipyard.shipyard }} {{- $mounts_shipyard_init := .Values.pod.mounts.shipyard.init_container }} {{ tuple $envAll "shipyard" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} --- apiVersion: apps/v1 kind: Deployment metadata: name: shipyard-api annotations: {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} spec: replicas: {{ .Values.pod.replicas.shipyard.api }} selector: matchLabels: {{ $labels | indent 6 }} {{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} template: metadata: labels: {{ $labels | indent 8 }} annotations: {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} shipyard-configmap-bin-hash: {{ tuple "configmap-shipyard-bin.yaml" . | include "helm-toolkit.utils.hash" }} shipyard-configmap-etc-hash: {{ tuple "configmap-shipyard-etc.yaml" . | include "helm-toolkit.utils.hash" }} airflow-configmap-bin-hash: {{ tuple "configmap-airflow-bin.yaml" . | include "helm-toolkit.utils.hash" }} airflow-configmap-etc-hash: {{ tuple "configmap-airflow-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: {{ dict "envAll" $envAll "application" "shipyard" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} serviceAccountName: {{ $serviceAccountName }} affinity: {{ tuple $envAll "shipyard" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.shipyard.node_selector_key }}: {{ .Values.labels.shipyard.node_selector_value }} terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.shipyard.timeout | default "30" }} restartPolicy: Always initContainers: {{ tuple $envAll "shipyard" $mounts_shipyard_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: - name: shipyard-api env: - name: 'SHIPYARD_API_WORKERS' value: {{ .Values.conf.uwsgi.workers | quote }} - name: 'SHIPYARD_API_THREADS' value: {{ .Values.conf.uwsgi.threads | quote }} image: {{ .Values.images.tags.shipyard }} imagePullPolicy: {{ .Values.images.pull_policy }} {{ tuple $envAll $envAll.Values.pod.resources.shipyard_api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ dict "envAll" $envAll "application" "shipyard" "container" "shipyard_api" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} ports: - containerPort: {{ tuple "shipyard" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} livenessProbe: httpGet: path: /api/v1.0/health port: {{ tuple "shipyard" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} initialDelaySeconds: 15 periodSeconds: 10 readinessProbe: httpGet: scheme: HTTP path: /api/v1.0/health port: {{ tuple "shipyard" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} initialDelaySeconds: 15 periodSeconds: 10 volumeMounts: - name: etc-shipyard mountPath: /etc/shipyard - name: shipyard-etc mountPath: /etc/shipyard/shipyard.conf subPath: shipyard.conf readOnly: true - name: shipyard-etc subPath: api-paste.ini mountPath: /etc/shipyard/api-paste.ini readOnly: true - name: shipyard-etc subPath: policy.yaml mountPath: /etc/shipyard/policy.yaml readOnly: true {{ if .Values.conf.shipyard.base.profiler }} - name: tmp-profiles mountPath: /tmp/profiles {{ end }} - name: airflow-web image: {{ .Values.images.tags.airflow }} imagePullPolicy: {{ .Values.images.pull_policy }} {{ tuple $envAll $envAll.Values.pod.resources.airflow.web | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ dict "envAll" $envAll "application" "shipyard" "container" "airflow_web" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} env: - name: AIRFLOW_CONN_AIRFLOWS_OWN_DB valueFrom: secretKeyRef: name: {{ .Values.secrets.postgresql_airflow_db.user }} key: AIRFLOW_DATABASE_URI args: ["webserver"] volumeMounts: - name: airflow-etc mountPath: {{ .Values.conf.airflow_config_file.path }} subPath: airflow.cfg readOnly: true - name: shipyard-etc mountPath: /usr/local/airflow/plugins/shipyard.conf subPath: shipyard.conf readOnly: true - name: airflow-logs mountPath: {{ .Values.conf.airflow.core.base_log_folder }} {{ if $mounts_shipyard.volumeMounts }}{{ toYaml $mounts_shipyard.volumeMounts | indent 12 }}{{ end }} volumes: {{ if .Values.conf.shipyard.base.profiler }} - name: tmp-profiles emptyDir: {} {{ end }} - name: etc-shipyard emptyDir: {} - name: shipyard-etc configMap: name: shipyard-etc defaultMode: 0444 - name: airflow-etc configMap: name: airflow-etc defaultMode: 0444 - name: airflow-bin configMap: name: airflow-bin defaultMode: 0555 - name: airflow-logs emptyDir: {} {{ if $mounts_shipyard.volumes }}{{ toYaml $mounts_shipyard.volumes | indent 8 }}{{ end }} {{- end }}