statsd-deployment.yaml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. # Licensed to the Apache Software Foundation (ASF) under one
  2. # or more contributor license agreements. See the NOTICE file
  3. # distributed with this work for additional information
  4. # regarding copyright ownership. The ASF licenses this file
  5. # to you under the Apache License, Version 2.0 (the
  6. # "License"); you may not use this file except in compliance
  7. # with the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing,
  12. # software distributed under the License is distributed on an
  13. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. # KIND, either express or implied. See the License for the
  15. # specific language governing permissions and limitations
  16. # under the License.
  17. ################################
  18. ## Airflow StatsD Deployment
  19. #################################
  20. {{- if .Values.statsd.enabled }}
  21. {{- $nodeSelector := or .Values.statsd.nodeSelector .Values.nodeSelector }}
  22. {{- $affinity := or .Values.statsd.affinity .Values.affinity }}
  23. {{- $tolerations := or .Values.statsd.tolerations .Values.tolerations }}
  24. {{- $topologySpreadConstraints := or .Values.statsd.topologySpreadConstraints .Values.topologySpreadConstraints }}
  25. {{- $securityContext := include "localSecurityContext" .Values.statsd }}
  26. kind: Deployment
  27. apiVersion: apps/v1
  28. metadata:
  29. name: {{ .Release.Name }}-statsd
  30. labels:
  31. tier: airflow
  32. component: statsd
  33. release: {{ .Release.Name }}
  34. chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
  35. heritage: {{ .Release.Service }}
  36. {{- with .Values.labels }}
  37. {{ toYaml . | indent 4 }}
  38. {{- end }}
  39. spec:
  40. replicas: 1
  41. selector:
  42. matchLabels:
  43. tier: airflow
  44. component: statsd
  45. release: {{ .Release.Name }}
  46. template:
  47. metadata:
  48. labels:
  49. tier: airflow
  50. component: statsd
  51. release: {{ .Release.Name }}
  52. {{- with .Values.labels }}
  53. {{ toYaml . | indent 8 }}
  54. {{- end }}
  55. {{- if .Values.statsd.extraMappings }}
  56. annotations:
  57. checksum/statsd-config: {{ include (print $.Template.BasePath "/configmaps/statsd-configmap.yaml") . | sha256sum }}
  58. {{- end }}
  59. spec:
  60. {{- if .Values.statsd.priorityClassName }}
  61. priorityClassName: {{ .Values.statsd.priorityClassName }}
  62. {{- end }}
  63. nodeSelector:
  64. {{ toYaml $nodeSelector | indent 8 }}
  65. affinity:
  66. {{ toYaml $affinity | indent 8 }}
  67. tolerations:
  68. {{ toYaml $tolerations | indent 8 }}
  69. topologySpreadConstraints:
  70. {{ toYaml $topologySpreadConstraints | indent 8 }}
  71. serviceAccountName: {{ include "statsd.serviceAccountName" . }}
  72. securityContext: {{ $securityContext | nindent 8 }}
  73. restartPolicy: Always
  74. {{- if or .Values.registry.secretName .Values.registry.connection }}
  75. imagePullSecrets:
  76. - name: {{ template "registry_secret" . }}
  77. {{- end }}
  78. containers:
  79. - name: statsd
  80. image: {{ template "statsd_image" . }}
  81. imagePullPolicy: {{ .Values.images.statsd.pullPolicy }}
  82. args:
  83. - "--statsd.mapping-config=/etc/statsd-exporter/mappings.yml"
  84. resources:
  85. {{ toYaml .Values.statsd.resources | indent 12 }}
  86. ports:
  87. - name: statsd-ingest
  88. protocol: UDP
  89. containerPort: {{ .Values.ports.statsdIngest }}
  90. - name: statsd-scrape
  91. containerPort: {{ .Values.ports.statsdScrape }}
  92. livenessProbe:
  93. httpGet:
  94. path: /metrics
  95. port: {{ .Values.ports.statsdScrape }}
  96. initialDelaySeconds: 10
  97. periodSeconds: 10
  98. timeoutSeconds: 5
  99. readinessProbe:
  100. httpGet:
  101. path: /metrics
  102. port: {{ .Values.ports.statsdScrape }}
  103. initialDelaySeconds: 10
  104. periodSeconds: 10
  105. timeoutSeconds: 5
  106. {{- if .Values.statsd.extraMappings }}
  107. volumeMounts:
  108. - name: config
  109. mountPath: /etc/statsd-exporter/mappings.yml
  110. subPath: mappings.yml
  111. volumes:
  112. - name: config
  113. configMap:
  114. name: {{ .Release.Name }}-statsd
  115. {{- end }}
  116. {{- end }}