# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you 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. ################################ ## Airflow StatsD Deployment ################################# {{- if .Values.statsd.enabled }} {{- $nodeSelector := or .Values.statsd.nodeSelector .Values.nodeSelector }} {{- $affinity := or .Values.statsd.affinity .Values.affinity }} {{- $tolerations := or .Values.statsd.tolerations .Values.tolerations }} {{- $topologySpreadConstraints := or .Values.statsd.topologySpreadConstraints .Values.topologySpreadConstraints }} {{- $securityContext := include "localSecurityContext" .Values.statsd }} kind: Deployment apiVersion: apps/v1 metadata: name: {{ .Release.Name }}-statsd labels: tier: airflow component: statsd release: {{ .Release.Name }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service }} {{- with .Values.labels }} {{ toYaml . | indent 4 }} {{- end }} spec: replicas: 1 selector: matchLabels: tier: airflow component: statsd release: {{ .Release.Name }} template: metadata: labels: tier: airflow component: statsd release: {{ .Release.Name }} {{- with .Values.labels }} {{ toYaml . | indent 8 }} {{- end }} {{- if .Values.statsd.extraMappings }} annotations: checksum/statsd-config: {{ include (print $.Template.BasePath "/configmaps/statsd-configmap.yaml") . | sha256sum }} {{- end }} spec: {{- if .Values.statsd.priorityClassName }} priorityClassName: {{ .Values.statsd.priorityClassName }} {{- end }} nodeSelector: {{ toYaml $nodeSelector | indent 8 }} affinity: {{ toYaml $affinity | indent 8 }} tolerations: {{ toYaml $tolerations | indent 8 }} topologySpreadConstraints: {{ toYaml $topologySpreadConstraints | indent 8 }} serviceAccountName: {{ include "statsd.serviceAccountName" . }} securityContext: {{ $securityContext | nindent 8 }} restartPolicy: Always {{- if or .Values.registry.secretName .Values.registry.connection }} imagePullSecrets: - name: {{ template "registry_secret" . }} {{- end }} containers: - name: statsd image: {{ template "statsd_image" . }} imagePullPolicy: {{ .Values.images.statsd.pullPolicy }} args: - "--statsd.mapping-config=/etc/statsd-exporter/mappings.yml" resources: {{ toYaml .Values.statsd.resources | indent 12 }} ports: - name: statsd-ingest protocol: UDP containerPort: {{ .Values.ports.statsdIngest }} - name: statsd-scrape containerPort: {{ .Values.ports.statsdScrape }} livenessProbe: httpGet: path: /metrics port: {{ .Values.ports.statsdScrape }} initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 5 readinessProbe: httpGet: path: /metrics port: {{ .Values.ports.statsdScrape }} initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 5 {{- if .Values.statsd.extraMappings }} volumeMounts: - name: config mountPath: /etc/statsd-exporter/mappings.yml subPath: mappings.yml volumes: - name: config configMap: name: {{ .Release.Name }}-statsd {{- end }} {{- end }}