shipyard/charts/shipyard/templates/deployment-shipyard.yaml
Mahmoudi, Ahmad (am495p) a5e57879ab Override uwsgi default config
- Overrode uwsgi default configs to improve stability and performance.
- Increased mas number of worker processes to increase capacity and
  performance.
- Enabled uwsgi cheaper subsystem to scale worker processes dynamically.
- Uplifted uwsgi to the latest release to bring bug fixes and
  improvements since 2018.

Upgraded uwsgi to bring in bug fixes since 2018.

For background information for this change please see:
https://uwsgi-docs.readthedocs.io/en/latest/ThingsToKnow.html

Change-Id: If067e9786e9dbbd39ef832dea6f51aa5523af4d7
2020-08-06 02:14:07 +00:00

170 lines
8.1 KiB
YAML

# 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" }}
{{ dict "envAll" $envAll "podName" "shipyard-api" "containerNames" (list "init" "shipyard-api" "airflow-web") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
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 }}
- name: 'SHIPYARD_API_CHEAPER_ALGO'
value: {{ .Values.conf.uwsgi.cheaper_algo | quote }}
- name: 'SHIPYARD_API_CHEAPER'
value: {{ .Values.conf.uwsgi.cheaper | quote }}
- name: 'SHIPYARD_API_CHEAPER_INITIAL'
value: {{ .Values.conf.uwsgi.cheaper_initial | quote }}
- name: 'SHIPYARD_API_CHEAPER_STEP'
value: {{ .Values.conf.uwsgi.cheaper_step | quote }}
- name: 'SHIPYARD_API_CHEAPER_OVERLOAD'
value: {{ .Values.conf.uwsgi.cheaper_overload | quote }}
- name: 'SHIPYARD_API_CHEAPER_BUSYNESS_MULTIPLIER'
value: {{ .Values.conf.uwsgi.cheaper_busyness_multiplier | quote }}
- name: 'SHIPYARD_API_CHEAPER_BUSYNESS_MIN'
value: {{ .Values.conf.uwsgi.cheaper_busyness_min | quote }}
- name: 'SHIPYARD_API_CHEAPER_BUSYNESS_MAX'
value: {{ .Values.conf.uwsgi.cheaper_busyness_max | quote }}
- name: 'SHIPYARD_API_CHEAPER_BUSYNESS_BACKLOG_ALERT'
value: {{ .Values.conf.uwsgi.cheaper_busyness_backlog_alert | quote }}
- name: 'SHIPYARD_API_CHEAPER_BUSYNESS_BACKLOG_STEP'
value: {{ .Values.conf.uwsgi.cheaper_busyness_backlog_step | 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 }}