-
Notifications
You must be signed in to change notification settings - Fork 499
Expand file tree
/
Copy pathhydra_deployment.yaml
More file actions
237 lines (237 loc) · 7.51 KB
/
Copy pathhydra_deployment.yaml
File metadata and controls
237 lines (237 loc) · 7.51 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
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
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: hydra
labels:
name: hydra
spec:
replicas: 1
selector:
matchLabels:
name: hydra
strategy:
type: Recreate
template:
metadata:
labels:
name: hydra
spec:
securityContext:
runAsNonRoot: true
runAsUser: 10100
seccompProfile:
type: RuntimeDefault
initContainers:
- name: migrate
args:
- migrate
- sql
- up
- -e
- -c
- /etc/config/hydra/hydra.yml
- --yes
envFrom:
- configMapRef:
name: pl-db-config
- configMapRef:
name: pl-ory-service-config
env:
- name: PL_POSTGRES_USERNAME
valueFrom:
secretKeyRef:
name: pl-db-secrets
key: PL_POSTGRES_USERNAME
- name: PL_POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: pl-db-secrets
key: PL_POSTGRES_PASSWORD
- name: OIDC_SUBJECT_IDENTIFIERS_PAIRWISE_SALT
valueFrom:
secretKeyRef:
name: pl-hydra-secrets
key: OIDC_SUBJECT_IDENTIFIERS_PAIRWISE_SALT
- name: SECRETS_SYSTEM
valueFrom:
secretKeyRef:
name: pl-hydra-secrets
key: SECRETS_SYSTEM
- name: DSN
# yamllint disable-line rule:line-length
value: postgres://$(PL_POSTGRES_USERNAME):$(PL_POSTGRES_PASSWORD)@$(PL_POSTGRES_HOSTNAME):$(PL_POSTGRES_PORT)/$(PL_HYDRA_DATABASE)?sslmode=disable&max_conns=20&max_idle_conns=4
imagePullPolicy: IfNotPresent
# yamllint disable-line rule:line-length
image: ghcr.io/pixie-io/hydra:2.3.0-pl1@sha256:9f0b31b1ca13d22bf14abf0c83251333b9a957a9ade39e3c723a963b84402572
volumeMounts:
- mountPath: /etc/config/hydra
name: config
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
runAsNonRoot: true
runAsUser: 10100
seccompProfile:
type: RuntimeDefault
containers:
- name: server
imagePullPolicy: IfNotPresent
# yamllint disable-line rule:line-length
image: ghcr.io/pixie-io/hydra:2.3.0-pl1@sha256:9f0b31b1ca13d22bf14abf0c83251333b9a957a9ade39e3c723a963b84402572
args:
- serve
- -c
- /etc/config/hydra/hydra.yml
- all
envFrom:
- configMapRef:
name: pl-db-config
- configMapRef:
name: pl-ory-service-config
- configMapRef:
name: pl-domain-config
env:
- name: PL_POSTGRES_USERNAME
valueFrom:
secretKeyRef:
name: pl-db-secrets
key: PL_POSTGRES_USERNAME
- name: PL_POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: pl-db-secrets
key: PL_POSTGRES_PASSWORD
- name: OIDC_SUBJECT_IDENTIFIERS_PAIRWISE_SALT
valueFrom:
secretKeyRef:
name: pl-hydra-secrets
key: OIDC_SUBJECT_IDENTIFIERS_PAIRWISE_SALT
- name: SECRETS_SYSTEM
valueFrom:
secretKeyRef:
name: pl-hydra-secrets
key: SECRETS_SYSTEM
- name: DSN
# yamllint disable-line rule:line-length
value: postgres://$(PL_POSTGRES_USERNAME):$(PL_POSTGRES_PASSWORD)@$(PL_POSTGRES_HOSTNAME):$(PL_POSTGRES_PORT)/$(PL_HYDRA_DATABASE)?sslmode=disable&max_conns=20&max_idle_conns=4
- name: SERVE_TLS_ENABLED
value: "true"
- name: SERVE_TLS_CERT_PATH
value: /certs/server.crt
- name: SERVE_TLS_KEY_PATH
value: /certs/server.key
- name: SERVE_PUBLIC_CORS_ALLOWED_ORIGINS_0
value: https://$(PL_DOMAIN_NAME)
- name: SERVE_PUBLIC_CORS_ALLOWED_ORIGINS_1
value: https://work.$(PL_DOMAIN_NAME)
- name: PL_WORK_DOMAIN
value: work.$(PL_DOMAIN_NAME)
- name: PL_OAUTH_DOMAIN
value: $(PL_WORK_DOMAIN)/oauth
- name: HYDRA_URL
value: https://$(PL_OAUTH_DOMAIN)/hydra
- name: URLS_CONSENT
value: https://$(PL_OAUTH_DOMAIN)/auth/hydra/consent
- name: URLS_LOGIN
value: https://$(PL_WORK_DOMAIN)/api/auth/oauth/login
- name: URLS_LOGOUT
value: https://$(PL_OAUTH_DOMAIN)/logout
- name: URLS_SELF_PUBLIC
value: $(HYDRA_URL)
- name: URLS_SELF_ISSUER
value: $(HYDRA_URL)
# admin is not exposed to Pixie clients. Requests to this endpoint originate
# from Pixie services.
- name: URLS_SELF_ADMIN
value: $(PL_HYDRA_ADMIN_HOST)
ports:
- containerPort: 4444
- containerPort: 4445
- containerPort: 5555
volumeMounts:
- name: config
mountPath: /etc/config/hydra
- name: certs
mountPath: /certs
resources: {}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
runAsNonRoot: true
runAsUser: 10100
seccompProfile:
type: RuntimeDefault
- name: client-create-or-update
imagePullPolicy: IfNotPresent
# yamllint disable-line rule:line-length
image: ghcr.io/pixie-io/hydra:2.3.0-alpine-pl1@sha256:8e09f1a6882d37387411dc8ee1647cc3c40ba42c7f74d9a711b0fa1f483a6dba
command: ['sh', '-c', 'set -x;
URL="https://localhost:4445/health/ready";
until [
$(wget --no-check-certificate --spider --quiet --server-response ${URL} 2>&1 |
awk ''NR==1{print $2}'') -eq 200
]; do
echo "waiting for ${URL}";
sleep 2;
done;
CMD="hydra update oauth2-client auth-code-client";
hydra get client auth-code-client
--endpoint=https://localhost:4445
--skip-tls-verify;
if [ $? -ne 0 ]; then
echo "Creating client";
CMD="hydra create oauth2-client --id auth-code-client";
fi;
${CMD}
--endpoint https://localhost:4445
--secret "${HYDRA_CLIENT_SECRET}"
--grant-type authorization_code
--grant-type refresh_token
--grant-type implicit
--response-type code
--response-type id_token
--response-type token
--scope openid
--scope offline
--scope notifications
--scope gist
--scope vizier
--redirect-uri "https://${PL_DOMAIN_NAME}/oauth/auth/callback"
--redirect-uri "https://work.${PL_DOMAIN_NAME}/auth/callback"
--skip-tls-verify;
sleep infinity;
']
envFrom:
- configMapRef:
name: pl-domain-config
env:
- name: HYDRA_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: pl-hydra-secrets
key: CLIENT_SECRET
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
runAsNonRoot: true
runAsUser: 10100
seccompProfile:
type: RuntimeDefault
restartPolicy: Always
volumes:
- name: config
configMap:
name: hydra-config
items:
- key: hydra.yml
path: hydra.yml
- name: certs
secret:
secretName: service-tls-certs