-
Notifications
You must be signed in to change notification settings - Fork 217
/
Copy pathdaemonset.yaml
146 lines (146 loc) · 5.83 KB
/
daemonset.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
{{- if and (include "newrelic-logging.areValuesValid" .) .Values.enableLinux }}
apiVersion: apps/v1
kind: DaemonSet
metadata:
namespace: {{ .Release.Namespace }}
labels: {{ include "newrelic-logging.labels" . | indent 4 }}
name: {{ template "newrelic-logging.fullname" . }}
annotations:
{{- if .Values.daemonSet.annotations }}
{{ toYaml .Values.daemonSet.annotations | indent 4 }}
{{- end }}
spec:
updateStrategy:
type: {{ .Values.updateStrategy }}
selector:
matchLabels:
app: {{ template "newrelic-logging.name" . }}
release: {{.Release.Name }}
template:
metadata:
{{- if .Values.podAnnotations }}
annotations:
{{ toYaml .Values.podAnnotations | indent 8}}
{{- end }}
labels:
app: {{ template "newrelic-logging.name" . }}
release: {{.Release.Name }}
kubernetes.io/os: linux
app.kubernetes.io/name: {{ template "newrelic-logging.name" . }}
{{- if .Values.podLabels}}
{{ toYaml .Values.podLabels }}
{{- end }}
spec:
serviceAccountName: {{ template "newrelic-logging.serviceAccountName" . }}
hostNetwork: true # This option is a requirement for the Infrastructure Agent to report the proper hostname in New Relic.
dnsPolicy: ClusterFirstWithHostNet
terminationGracePeriodSeconds: 10
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{ toYaml .Values.image.pullSecrets | indent 8 }}
{{- end }}
containers:
- name: {{ template "newrelic-logging.name" . }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
env:
- name: ENDPOINT
{{- if (include "newrelic.nrStaging" .) }}
value: "https://staging-log-api.newrelic.com/log/v1"
{{- else if .Values.endpoint }}
value: {{ .Values.endpoint }}
{{- else if eq (substr 0 2 (include "newrelic-logging.licenseKey" .)) "eu" }}
value: "https://log-api.eu.newrelic.com/log/v1"
{{- else }}
value: "https://log-api.newrelic.com/log/v1"
{{- end }}
- name: SOURCE
value: {{ if (include "newrelic-logging.lowDataMode" .) }} "k8s" {{- else }} "kubernetes" {{- end }}
- name: LICENSE_KEY
valueFrom:
secretKeyRef:
{{- if (include "newrelic-logging.licenseKey" .) }}
name: {{ template "newrelic-logging.fullname" . }}-config
key: license
{{- else }}
name: {{ include "newrelic-logging.customSecretName" . }}
key: {{ include "newrelic-logging.customSecretKey" . }}
{{- end }}
- name: CLUSTER_NAME
value: {{ include "newrelic-logging.cluster" . }}
- name: LOG_LEVEL
value: {{ .Values.fluentBit.logLevel | quote }}
- name: LOG_PARSER
{{- if .Values.fluentBit.criEnabled }}
value: "cri"
{{- else }}
value: "docker"
{{- end }}
- name: FB_DB
value: {{ .Values.fluentBit.db | quote }}
- name: PATH
value: {{ .Values.fluentBit.path | quote }}
- name: K8S_BUFFER_SIZE
value: {{ .Values.fluentBit.k8sBufferSize | quote }}
- name: K8S_LOGGING_EXCLUDE
value: {{ .Values.fluentBit.k8sLoggingExclude | quote }}
- name: LOW_DATA_MODE
value: {{ include "newrelic-logging.lowDataMode" . | default "false" | quote }}
{{- range .Values.fluentBit.additionalEnvVariables }}
- name: {{ .name }}
value: {{ .value }}
{{- end }}
command:
- /fluent-bit/bin/fluent-bit
- -c
- /fluent-bit/etc/fluent-bit.conf
- -e
- /fluent-bit/bin/out_newrelic.so
volumeMounts:
- name: fluent-bit-config
mountPath: /fluent-bit/etc
- name: var
mountPath: /var
{{- if .Values.resources }}
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- end }}
volumes:
- name: fluent-bit-config
configMap:
name: {{ template "newrelic-logging.fluentBitConfig" . }}
- name: var
hostPath:
path: /var
{{- if $.Values.priorityClassName }}
priorityClassName: {{ $.Values.priorityClassName }}
{{- end }}
{{- if .Values.nodeAffinity }}
affinity:
nodeAffinity: {{ .Values.nodeAffinity | toYaml | nindent 10 }}
{{- else if include "newrelic.fargate" . }}
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: eks.amazonaws.com/compute-type
operator: NotIn
values:
- fargate
{{- end }}
nodeSelector:
{{- if .Values.nodeSelector }}
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- else if $.Values.enableWindows }}
# We add this only if Windows is enabled to keep backwards-compatibility. Prior to version 1.14, this label was
# named beta.kubernetes.io/os. In version 1.14, it was deprecated and replaced by this one. Version 1.14 also
# introduces Windows support. Therefore, anyone wishing to use Windows containers must bet at version >=1.14 and
# are going to need this label, in order to avoid placing a linux container on a windows node, and viceversa.
kubernetes.io/os: linux
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
{{- end }}