Ajay Lotan Thakur | 491ed5a | 2022-05-31 17:33:00 -0600 | [diff] [blame] | 1 | {{/* |
| 2 | # Copyright 2022-present Open Networking Foundation |
| 3 | |
| 4 | # SPDX-License-Identifier: Apache-2.0 |
| 5 | */}} |
| 6 | {{- if .Values.config.metrics.deploy }} |
| 7 | {{ tuple "metrics" . | include "5g-control-plane.service_account" }} |
| 8 | --- |
| 9 | apiVersion: apps/v1 |
| 10 | kind: Deployment |
| 11 | metadata: |
| 12 | name: metrics |
| 13 | labels: |
| 14 | {{ tuple "metrics" . | include "5g-control-plane.metadata_labels" | indent 4 }} |
| 15 | spec: |
| 16 | replicas: 1 |
| 17 | #serviceName: metrics-headless |
| 18 | selector: |
| 19 | matchLabels: |
| 20 | {{ tuple "metrics" . | include "5g-control-plane.metadata_labels" | indent 6 }} |
| 21 | template: |
| 22 | metadata: |
| 23 | labels: |
| 24 | {{ tuple "metrics" . | include "5g-control-plane.metadata_labels" | indent 8 }} |
| 25 | {{- with .Values.config.metrics.podAnnotations }} |
| 26 | annotations: |
| 27 | {{- toYaml . | nindent 8 }} |
| 28 | {{- end }} |
| 29 | spec: |
| 30 | serviceAccountName: metrics |
| 31 | {{- if hasKey .Values.images "pullSecrets" }} |
| 32 | imagePullSecrets: |
| 33 | {{ toYaml .Values.images.pullSecrets | indent 8 }} |
| 34 | {{- end }} |
| 35 | containers: |
| 36 | - name: metrics |
| 37 | image: {{ .Values.images.tags.metrics }} |
| 38 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 39 | {{- if .Values.config.coreDump.enabled }} |
| 40 | securityContext: |
| 41 | runAsUser: 0 |
| 42 | {{- end }} |
| 43 | stdin: true |
| 44 | tty: true |
| 45 | command: [ "/metricfunc/script/metrics-run.sh" ] |
| 46 | env: |
| 47 | - name: POD_IP |
| 48 | valueFrom: |
| 49 | fieldRef: |
| 50 | fieldPath: status.podIP |
| 51 | {{- if .Values.resources.enabled }} |
| 52 | resources: |
| 53 | {{ toYaml .Values.resources.metrics | indent 10 }} |
| 54 | {{- end }} |
| 55 | volumeMounts: |
| 56 | - name: run-script |
| 57 | mountPath: /metricfunc/script/metrics-run.sh |
| 58 | subPath: metrics-run.sh |
| 59 | - name: metrics-config |
| 60 | mountPath: /metricfunc/config |
| 61 | {{- if .Values.config.coreDump.enabled }} |
| 62 | - name: coredump |
| 63 | mountPath: /tmp/coredump |
| 64 | {{- end }} |
| 65 | volumes: |
| 66 | - name: run-script |
| 67 | configMap: |
| 68 | name: metrics |
| 69 | defaultMode: 493 |
| 70 | - name: metrics-config |
| 71 | configMap: |
| 72 | name: metrics |
| 73 | defaultMode: 493 |
| 74 | {{- if .Values.config.coreDump.enabled }} |
| 75 | - name: host-rootfs |
| 76 | hostPath: |
| 77 | path: / |
| 78 | - name: coredump |
| 79 | hostPath: |
| 80 | path: {{ .Values.config.coreDump.path }} |
| 81 | {{- end }} |
| 82 | {{- end }} |