rancher-partner-charts/charts/kubecost/cost-analyzer/1.106.3/templates/cost-analyzer-network-costs...

144 lines
5.0 KiB
YAML

{{- if .Values.networkCosts -}}
{{- if .Values.networkCosts.enabled -}}
apiVersion: {{ include "cost-analyzer.daemonset.apiVersion" . }}
kind: DaemonSet
metadata:
name: {{ template "cost-analyzer.networkCostsName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if .Values.networkCosts.additionalLabels }}
{{ toYaml .Values.networkCosts.additionalLabels | indent 4 }}
{{- end }}
spec:
{{- if .Values.networkCosts.updateStrategy }}
updateStrategy:
{{- toYaml .Values.networkCosts.updateStrategy | nindent 4 }}
{{- end }}
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.extraArgs }}
args:
{{- toYaml .Values.networkCosts.extraArgs | nindent 8 }}
{{- end }}
{{- if .Values.networkCosts.imagePullPolicy }}
imagePullPolicy: {{ .Values.networkCosts.imagePullPolicy }}
{{- else }}
imagePullPolicy: Always
{{- end }}
{{- if .Values.networkCosts.resources }}
resources: {{- toYaml .Values.networkCosts.resources | nindent 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) }}
{{- if .Values.networkCosts.softMemoryLimit }}
- name: GOMEMLIMIT
value: {{ .Values.networkCosts.softMemoryLimit }}
{{- end }}
{{- if .Values.networkCosts.heapMonitor }}
{{- if .Values.networkCosts.heapMonitor.enabled }}
- name: HEAP_MONITOR_ENABLED
value: "true"
- name: HEAP_MONITOR_THRESHOLD
value: {{ .Values.networkCosts.heapMonitor.threshold }}
{{- if .Values.networkCosts.heapMonitor.outFile }}
- name: HEAP_MONITOR_OUTPUT
value: {{ .Values.networkCosts.heapMonitor.outFile }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.networkCosts.healthCheckProbes }}
{{- toYaml .Values.networkCosts.healthCheckProbes | nindent 8 }}
{{- end }}
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
{{- if .Values.networkCosts.additionalSecurityContext }}
{{- toYaml .Values.networkCosts.additionalSecurityContext | nindent 10 }}
{{- end }}
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 }}