-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathdeployment.yaml
More file actions
161 lines (161 loc) · 5.11 KB
/
deployment.yaml
File metadata and controls
161 lines (161 loc) · 5.11 KB
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
{{- /*
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: rule-evaluator
labels:
{{- include "rule-evaluator.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "rule-evaluator.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "rule-evaluator.templateLabels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "rule-evaluator.serviceAccountName" . }}
automountServiceAccountToken: true
initContainers:
- name: config-init
image: {{.Values.images.bash.image}}:{{.Values.images.bash.tag}}
command: ['/bin/bash', '-c', 'touch /prometheus/config_out/config.yaml']
volumeMounts:
- name: config-out
mountPath: /prometheus/config_out
containers:
- name: evaluator
image: {{.Values.images.ruleEvaluator.image}}:{{.Values.images.ruleEvaluator.tag}}
args:
- "--config.file=/prometheus/config_out/config.yaml"
- "--web.listen-address=:9092"
ports:
- name: r-eval-metrics
containerPort: 9092
resources: {{- toYaml $.Values.resources.ruleEvaluator | nindent 10}}
volumeMounts:
- name: config-out
readOnly: true
mountPath: /prometheus/config_out
- name: rules-out
readOnly: true
mountPath: /etc/rules
livenessProbe:
httpGet:
port: r-eval-metrics
path: /-/healthy
readinessProbe:
httpGet:
port: r-eval-metrics
path: /-/ready
# Readiness attempts a query round-trip so we need a more generous timeout.
timeoutSeconds: 5
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- all
privileged: false
readOnlyRootFilesystem: true
- name: config-reloader
image: {{.Values.images.configReloader.image}}:{{.Values.images.configReloader.tag}}
args:
- --config-file=/prometheus/config/config.yaml
- --config-file-output=/prometheus/config_out/config.yaml
- --config-dir=/etc/rules
- --config-dir-output=/prometheus/rules_out
- --reload-url=http://127.0.0.1:9092/-/reload
- --ready-url=http://127.0.0.1:9092/-/ready
- --listen-address=:9093
ports:
- name: cfg-rel-metrics
protocol: TCP
containerPort: 9093
resources: {{- toYaml $.Values.resources.configReloader | nindent 10}}
volumeMounts:
- name: config
readOnly: true
mountPath: /prometheus/config
- name: config-out
mountPath: /prometheus/config_out
- name: rules
readOnly: true
mountPath: /etc/rules
- name: rules-out
mountPath: /prometheus/rules_out
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- all
privileged: false
readOnlyRootFilesystem: true
volumes:
- name: config
configMap:
name: rule-evaluator
- name: config-out
emptyDir: {}
- name: rules
# Mount exactly one ConfigMap per rule type (3 total)
# - rules: namespace-scoped Rules
# - clusterrules: cluster-scoped ClusterRules
# - globalrules: GlobalRules
projected:
sources:
- configMap:
name: rules
optional: true
- configMap:
name: clusterrules
optional: true
- configMap:
name: globalrules
optional: true
- name: rules-out
emptyDir: {}
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- arm64
- amd64
- key: kubernetes.io/os
operator: In
values:
- linux
tolerations:
- key: "components.gke.io/gke-managed-components"
operator: "Exists"
- value: "amd64"
effect: "NoSchedule"
key: "kubernetes.io/arch"
operator: "Equal"
- value: "arm64"
effect: "NoSchedule"
key: "kubernetes.io/arch"
operator: "Equal"
securityContext:
runAsGroup: 1000
runAsNonRoot: true
runAsUser: 1000
seccompProfile:
type: RuntimeDefault