-
Notifications
You must be signed in to change notification settings - Fork 42
/
auth-proxy-server.yaml
239 lines (239 loc) · 6.3 KB
/
auth-proxy-server.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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
---
apiVersion: v1
kind: ConfigMap
metadata:
name: aps-s3-filebeat-config
namespace: auth
labels:
k8s-app: filebeat
data:
filebeat.yml: |-
filebeat.inputs:
- type: log
enabled: true
paths:
- /data/srv/logs/frontend/*${MY_POD_NAME}*
ignore_older: 1h
scan_frequency: 10s
backoff: 5s
max_backoff: 10s
tags: ["aps"]
output.logstash:
hosts: ["logstash.monitoring:5044"]
compression_level: 3
worker: 4
bulk_max_size: 4096
pipelining: 2
queue.mem:
events: 65536
logging.metrics.enabled: false
---
kind: DaemonSet
apiVersion: apps/v1
metadata:
labels:
app: auth-proxy-server
name: auth-proxy-server
namespace: auth
spec:
selector:
matchLabels:
app: auth-proxy-server
template:
metadata:
labels:
app: auth-proxy-server
env: k8s #k8s#
annotations:
prometheus.io/scrape: 'true'
prometheus.io/port: "9091"
spec:
serviceAccountName: auth-proxy-server-sa
terminationGracePeriodSeconds: 60
hostNetwork: true
# this daemonset will be applied to all nodes which will have role=autha label
# kubectl label node <node-name> role=auth --overwrite
nodeSelector:
role: auth
dnsPolicy: ClusterFirstWithHostNet
containers:
- image: registry.cern.ch/cmsweb/auth-proxy-server #imagetag
name: auth-proxy-server
# imagePullPolicy: Always
# NOTE: to migrate CMSWEB frontend to Go APS using x509 auth on port 443
# we explicitly specify this port and -useX509 flag below
# when we'll transition to tokens we should remove these two options
# NOTE: we explicitly use port, metricsPort and logFile options
# to re-use single config.json between APS and XPS
args:
- /data/auth-proxy-server
- -config=/etc/secrets/config.json
- -port=443
- -useX509
- -metricsPort=9091
#PROD# - -logFile=/data/srv/logs/frontend/auth-proxy-server.log
- -testRule
- ""
resources:
requests:
memory: "50Mi"
cpu: "30m"
limits:
memory: "10Gi"
cpu: "4000m" # we can add higher limit here
env:
- name: X509_USER_PROXY
value: /etc/proxy/proxy
- name: MY_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
ports:
- containerPort: 443
name: https
- containerPort: 9091
name: metrics
volumeMounts:
- name: auth-proxy-server-secrets
mountPath: /etc/secrets
#defaultMode: 256
readOnly: true
- name: proxy-secrets
mountPath: /etc/proxy
readOnly: true
- name: www-htdocs
mountPath: /www
- name: token-secrets
mountPath: /etc/token
readOnly: true
- mountPath: /etc/grid-security
name: etc-grid-security
readOnly: true
- name: hostcert
mountPath: /etc/grid-security/hostcert.pem
- name: hostkey
mountPath: /etc/grid-security/hostkey.pem
#PROD# - mountPath: /etc/cric
#PROD# name: cric-volume
#PROD# - name: logs
#PROD# mountPath: /data/srv/logs/frontend
#PROD# - name: filebeat-cephfs
#PROD# mountPath: /data/filebeat
#PROD#- name: aps-s3-filebeat
#PROD# image: docker.elastic.co/beats/filebeat:7.12.0
#PROD# args: [
#PROD# "-c", "/etc/filebeat.yml",
#PROD# "-e",
#PROD# ]
#PROD# env:
#PROD# - name: MY_POD_NAME
#PROD# valueFrom:
#PROD# fieldRef:
#PROD# apiVersion: v1
#PROD# fieldPath: metadata.name
#PROD# resources:
#PROD# requests:
#PROD# memory: "50Mi"
#PROD# cpu: "50m"
#PROD# volumeMounts:
#PROD# - name: logs
#PROD# mountPath: /data/srv/logs/frontend
#PROD# - name: config
#PROD# mountPath: /etc/filebeat.yml
#PROD# readOnly: true
#PROD# subPath: filebeat.yml
#PROD# - name: data
#PROD# mountPath: /usr/share/filebeat/data
#PROD# - name: varlog
#PROD# mountPath: /var/log
#PROD# - name: varlibdockercontainers
#PROD# mountPath: /var/lib/docker/containers
#PROD# readOnly: true
initContainers:
- name: htdocs
image: registry.cern.ch/cmsweb/htdocs:0.0.2
command: ['sh', '-c', 'cp -r /www/* /tmp/htdocs']
volumeMounts:
- name: www-htdocs
mountPath: /tmp/htdocs
volumes:
- name: auth-proxy-server-secrets
secret:
secretName: auth-proxy-server-secrets
- name: proxy-secrets
secret:
secretName: proxy-secrets
- name: www-htdocs
emptyDir: {}
- name: token-secrets
secret:
secretName: token-secrets
- name: etc-grid-security
hostPath:
path: /etc/grid-security
- name: hostcert
hostPath:
path: /etc/grid-security/hostcert.pem
- name: hostkey
hostPath:
path: /etc/grid-security/hostkey.pem
#PROD#- name: cric-volume
#PROD# persistentVolumeClaim:
#PROD# claimName: cric-pvc
#PROD#- name: varlog
#PROD# hostPath:
#PROD# path: /var/log
#PROD#- name: varlibdockercontainers
#PROD# hostPath:
#PROD# path: /var/lib/docker/containers
#PROD#- name: config
#PROD# configMap:
#PROD# defaultMode: 0640
#PROD# name: aps-s3-filebeat-config
#PROD#- name: data
#PROD# emptyDir: {}
#PROD#- name: filebeat-cephfs
#PROD# persistentVolumeClaim:
#PROD# claimName: filebeat-cephfs-claim-default
#PROD#- name: logs
#PROD# persistentVolumeClaim:
#PROD# claimName: logs-cephfs-claim-aps
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: auth-proxy-server
subjects:
- kind: ServiceAccount
name: auth-proxy-server-sa
namespace: auth
roleRef:
kind: ClusterRole
name: auth-proxy-server
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: auth-proxy-server
labels:
k8s-app: auth-proxy-server
rules:
- apiGroups: [""] # "" indicates the core API group
resources:
- namespaces
- pods
verbs:
- get
- watch
- list
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: auth-proxy-server-sa
namespace: auth
labels:
k8s-app: auth-proxy-server
---