-
Notifications
You must be signed in to change notification settings - Fork 10
/
deployment.yaml
185 lines (183 loc) · 6.9 KB
/
deployment.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
{{ if eq .Values.controllerType "deployment" }}
{{- if (or (or (.Values.scalyr.k8s.enableMetrics) (.Values.scalyr.k8s.enableLogs)) (.Values.scalyr.k8s.enableExplorer)) }}
{{- $name := .Values.scalyr.k8s.clusterName | required ".Values.scalyr.k8s.clusterName is required." -}}
{{- end }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "scalyr-helm.fullname" . }}
labels:
{{- include "scalyr-helm.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.deployment.replicaCount }}
selector:
matchLabels:
{{- include "scalyr-helm.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "scalyr-helm.selectorLabels" . | nindent 8 }}
{{- include "scalyr-helm.podLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
volumes:
{{- if or (.Values.scalyr.k8s.enableMetrics) (.Values.scalyr.k8s.enableLogs) }}
- name: "varlibdockercontainers"
hostPath:
path: "/var/lib/docker/containers"
- name: "varlogpods"
hostPath:
path: "/var/log/pods"
- name: "varlogcontainers"
hostPath:
path: "/var/log/containers"
- name: "dockersock"
hostPath:
path: "/var/run/docker.sock"
{{- end }}
- name: "checkpoints"
hostPath:
path: "/tmp/scalyr-agent-{{ include "scalyr-helm.fullname" . }}"
type: "DirectoryOrCreate"
- name: "scalyr-config-agent-d"
configMap:
name: "{{ include "scalyr-helm.fullname" . }}-config-agent-d"
defaultMode: 0600
{{- if .Values.volumes }}
{{- toYaml .Values.volumes | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- if eq .Values.image.type "alpine" }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}-alpine"
{{- else if eq .Values.image.type "buster"}}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
{{- else }}
{{- fail "Valid values for .Values.image.type are: buster, alpine" }}
{{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
exec:
command:
- scalyr-agent-2
- status
- -H
{{- if .Values.livenessProbe.debug }}
- --debug
{{- end }}
initialDelaySeconds: 60
periodSeconds: 60
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
{{- end }}
env:
- name: "SCALYR_SERVER"
value: {{ .Values.scalyr.server }}
- name: "SCALYR_API_KEY"
{{- if .Values.useRawApiKeyEnvValue }}
value: {{ .Values.scalyr.apiKey }}
{{- else }}
valueFrom:
secretKeyRef:
{{- if .Values.existingSecretRef }}
name: {{ .Values.existingSecretRef }}
{{- else }}
name: "{{ include "scalyr-helm.fullname" . }}-scalyr-api-key"
{{- end }}
key: "scalyr-api-key"
{{- end }}
{{- if (or (or (.Values.scalyr.k8s.enableMetrics) (.Values.scalyr.k8s.enableLogs)) (.Values.scalyr.k8s.enableExplorer)) }}
- name: "SCALYR_K8S_CLUSTER_NAME"
value: "{{ .Values.scalyr.k8s.clusterName }}"
- name: "SCALYR_K8S_VERIFY_KUBELET_QUERIES"
value: "{{ .Values.scalyr.k8s.verifyKubeletQueries }}"
{{- if (.Values.scalyr.k8s.caCert) }}
- name: "SCALYR_K8S_KUBELET_CA_CERT"
value: "{{ .Values.scalyr.k8s.caCert }}"
{{- end }}
{{- if (not (eq (int .Values.scalyr.debugLevel) 0)) }}
- name: "SCALYR_DEBUG_LEVEL"
value: "{{ .Values.scalyr.debugLevel }}"
{{- end }}
- name: "SCALYR_K8S_NODE_NAME"
valueFrom:
fieldRef:
fieldPath: "spec.nodeName"
apiVersion: "v1"
- name: "SCALYR_K8S_POD_NAME"
valueFrom:
fieldRef:
fieldPath: "metadata.name"
apiVersion: "v1"
- name: "SCALYR_K8S_POD_NAMESPACE"
valueFrom:
fieldRef:
fieldPath: "metadata.namespace"
apiVersion: "v1"
- name: "SCALYR_K8S_POD_UID"
valueFrom:
fieldRef:
fieldPath: "metadata.uid"
apiVersion: "v1"
- name: "SCALYR_K8S_KUBELET_HOST_IP"
valueFrom:
fieldRef:
fieldPath: "status.hostIP"
apiVersion: "v1"
{{- end }}
{{- if .Values.extraEnvVars }}
{{- toYaml .Values.extraEnvVars | nindent 12 }}
{{- end }}
volumeMounts:
{{- if or (.Values.scalyr.k8s.enableMetrics) (.Values.scalyr.k8s.enableLogs) }}
- name: "varlibdockercontainers"
mountPath: "/var/lib/docker/containers"
readOnly: true
- name: "varlogpods"
mountPath: "/var/log/pods"
readOnly: true
- name: "varlogcontainers"
mountPath: "/var/log/containers"
readOnly: true
- name: "dockersock"
mountPath: "/var/scalyr/docker.sock"
{{- end }}
{{- if .Values.volumeMounts }}
{{- toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
- name: "checkpoints"
mountPath: "/var/lib/scalyr-agent-2"
- name: "scalyr-config-agent-d"
mountPath: "/etc/scalyr-agent-2/agent.d"
resources:
{{- toYaml .Values.resources | nindent 12 }}
terminationGracePeriodSeconds: 30
dnsPolicy: "ClusterFirst"
{{- if or (.Values.scalyr.k8s.enableMetrics) (.Values.scalyr.k8s.enableLogs) }}
automountServiceAccountToken: true
serviceAccountName: "{{ include "scalyr-helm.fullname" . }}-sa"
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}