{{- if .Values.networkCosts -}} {{- if .Values.networkCosts.enabled -}} apiVersion: {{ include "cost-analyzer.daemonset.apiVersion" . }} kind: DaemonSet metadata: name: {{ template "cost-analyzer.networkCostsName" . }} labels: {{- include "cost-analyzer.commonLabels" . | nindent 4 }} spec: updateStrategy: type: RollingUpdate selector: matchLabels: app: {{ template "cost-analyzer.networkCostsName" . }} template: metadata: {{- with .Values.networkCosts.annotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: app: {{ template "cost-analyzer.networkCostsName" . }} {{- if .Values.networkCosts.additionalLabels }} {{ toYaml .Values.networkCosts.additionalLabels | nindent 8 }} {{- end }} spec: {{- if .Values.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.imagePullSecrets | indent 2 }} {{- end }} hostNetwork: true serviceAccountName: {{ template "cost-analyzer.serviceAccountName" . }} containers: - name: {{ template "cost-analyzer.networkCostsName" . }} image: {{ .Values.networkCosts.image }} {{- if .Values.networkCosts.imagePullPolicy }} imagePullPolicy: {{ .Values.networkCosts.imagePullPolicy }} {{- else }} imagePullPolicy: Always {{- end }} {{- if .Values.networkCosts.resources }} resources: {{ toYaml .Values.networkCosts.resources | indent 10 }} {{- end }} env: {{- if .Values.networkCosts.hostProc }} - name: HOST_PROC value: {{ .Values.networkCosts.hostProc.mountPath }} {{- end }} - name: NODE_NAME valueFrom: fieldRef: fieldPath: spec.nodeName - name: HOST_PORT value: {{ (quote .Values.networkCosts.port) | default (quote 3001) }} - name: TRAFFIC_LOGGING_ENABLED value: {{ (quote .Values.networkCosts.trafficLogging) | default (quote true) }} - name: GODEBUG value: "madvdontneed=1" volumeMounts: {{- if .Values.networkCosts.hostProc }} - mountPath: {{ .Values.networkCosts.hostProc.mountPath }} name: host-proc {{- else }} - mountPath: /net name: nf-conntrack - mountPath: /netfilter name: netfilter {{- end }} {{- if .Values.networkCosts.config }} - mountPath: /network-costs/config name: network-costs-config {{- end }} securityContext: privileged: true ports: - name: http-server containerPort: {{ .Values.networkCosts.port | default 3001 }} hostPort: {{ .Values.networkCosts.port | default 3001 }} {{- if .Values.networkCosts.priorityClassName }} priorityClassName: "{{ .Values.networkCosts.priorityClassName }}" {{- end }} {{- with .Values.networkCosts.nodeSelector }} nodeSelector: {{- toYaml . | nindent 10 }} {{- end }} {{- if .Values.networkCosts.tolerations }} tolerations: {{ toYaml .Values.networkCosts.tolerations | indent 8 }} {{- end }} {{- with .Values.networkCosts.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} volumes: {{- if .Values.networkCosts.config }} - name: network-costs-config configMap: name: network-costs-config {{- end }} {{- if .Values.networkCosts.hostProc }} - name: host-proc hostPath: path: {{ default "/proc" .Values.networkCosts.hostProc.hostPath }} {{- else }} - name: nf-conntrack hostPath: path: /proc/net - name: netfilter hostPath: path: /proc/sys/net/netfilter {{- end }} {{- end }} {{- end }}