-
Notifications
You must be signed in to change notification settings - Fork 10
/
agent-deploy.yaml
521 lines (512 loc) · 18.2 KB
/
agent-deploy.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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
---
kind: Template
apiVersion: template.openshift.io/v1
metadata:
name: ${PREFIX}${NAME}
objects:
- kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: ${PREFIX}${NAME}-allow-ingress
labels:
name: ${PREFIX}${NAME}-allow-ingress
app: ${APP_NAME}
app-group: ${APP_GROUP}
role: ${ROLE}
env: ${TAG_NAME}
spec:
description: |
Allow traffic from routes into the vc-authn-agent container(s).
ingress:
- from:
- namespaceSelector:
matchLabels:
network.openshift.io/policy-group: ingress
podSelector:
matchLabels:
role: ${PREFIX}${ROLE}
app: ${APP_NAME}
env: ${TAG_NAME}
policyTypes:
- Ingress
- kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: ${PREFIX}${NAME}
labels:
name: ${PREFIX}${NAME}
app: ${APP_NAME}
app-group: ${APP_GROUP}
role: ${PREFIX}${ROLE}
env: ${TAG_NAME}
spec:
description: |
Allow the vc-authn controller to access the agent admin interface.
ingress:
- from:
- podSelector:
matchLabels:
role: ${PREFIX}${CONTROLLER_ROLE}
app: ${APP_NAME}
env: ${TAG_NAME}
namespaceSelector:
matchLabels:
name: ${NAMESPACE_NAME}
environment: ${TAG_NAME}
ports:
- protocol: TCP
port: ${{AGENT_ADMIN_PORT}}
podSelector:
matchLabels:
role: ${PREFIX}${ROLE}
app: ${APP_NAME}
env: ${TAG_NAME}
- kind: Service
apiVersion: v1
metadata:
name: ${PREFIX}${NAME}
labels:
name: ${PREFIX}${NAME}
app: ${APP_NAME}
app.kubernetes.io/part-of: ${APP_NAME}
app-group: ${APP_GROUP}
role: ${PREFIX}${ROLE}
env: ${TAG_NAME}
spec:
ports:
- name: ${NAME}-admin
port: ${{AGENT_ADMIN_PORT}}
protocol: TCP
targetPort: ${{AGENT_ADMIN_PORT}}
- name: ${NAME}-http
port: ${{AGENT_HTTP_PORT}}
protocol: TCP
targetPort: ${{AGENT_HTTP_PORT}}
selector:
name: ${PREFIX}${NAME}
- kind: Route
apiVersion: v1
metadata:
name: ${PREFIX}${NAME}
labels:
name: ${PREFIX}${NAME}
app: ${APP_NAME}
app.kubernetes.io/part-of: ${APP_NAME}
app-group: ${APP_GROUP}
role: ${PREFIX}${ROLE}
env: ${TAG_NAME}
annotations:
haproxy.router.openshift.io/timeout: ${ROUTE_TIMEOUT}
spec:
host: ${APPLICATION_DOMAIN}
port:
targetPort: ${NAME}-http
tls:
insecureEdgeTerminationPolicy: Redirect
termination: edge
to:
kind: Service
name: ${PREFIX}${NAME}
weight: 100
- kind: Secret
apiVersion: v1
metadata:
name: ${PREFIX}${WALLET_CREDENTIAL_STORE_NAME}
labels:
name: ${PREFIX}${NAME}
app: ${APP_NAME}
app.kubernetes.io/part-of: ${APP_NAME}
app-group: ${APP_GROUP}
role: ${PREFIX}${ROLE}
env: ${TAG_NAME}
stringData:
key: ${WALLET_KEY}
seed: ${WALLET_SEED}
did: ${WALLET_DID}
type: Opaque
- kind: Secret
apiVersion: v1
metadata:
name: ${PREFIX}${NAME}
labels:
name: ${PREFIX}${NAME}
app: ${APP_NAME}
app.kubernetes.io/part-of: ${APP_NAME}
app-group: ${APP_GROUP}
role: ${PREFIX}${ROLE}
env: ${TAG_NAME}
stringData:
admin-api-key: ${ADMIN_API_KEY}
type: Opaque
- kind: DeploymentConfig
apiVersion: v1
metadata:
name: ${PREFIX}${NAME}
labels:
name: ${PREFIX}${NAME}
app: ${APP_NAME}
app.kubernetes.io/part-of: ${APP_NAME}
app-group: ${APP_GROUP}
role: ${PREFIX}${ROLE}
env: ${TAG_NAME}
spec:
replicas: 1
selector:
name: ${PREFIX}${NAME}
strategy:
type: Rolling
template:
metadata:
name: ${PREFIX}${NAME}
labels:
name: ${PREFIX}${NAME}
app: ${APP_NAME}
app.kubernetes.io/part-of: ${APP_NAME}
app-group: ${APP_GROUP}
role: ${PREFIX}${ROLE}
env: ${TAG_NAME}
spec:
volumes:
- name: ${PREFIX}${NAME}-app-config-volume
configMap:
name: ${PREFIX}${APP_CONFIG_MAP_NAME}
items:
- key: ${GENESIS_TRANSACTIONS_LIST_FILE}
path: ${GENESIS_TRANSACTIONS_LIST_FILE}
containers:
- name: ${PREFIX}${NAME}
command:
# Note:
# - The wallet-name cannot contain '-'s.
- bash
- -c
- $(echo aca-py start
--inbound-transport http '0.0.0.0' ${HTTP_INTERFACE_PORT}
--outbound-transport http
$(echo "${CONTROLLER_WEBHOOK_URL:+--webhook-url ${CONTROLLER_WEBHOOK_URL%/}${CONTROLLER_API_KEY:+/${CONTROLLER_API_KEY}}}")
--auto-accept-invites
--auto-accept-requests
--auto-ping-connection
--auto-respond-messages
--auto-respond-credential-offer
--auto-verify-presentation
--auto-provision
--wallet-type 'indy'
--wallet-name "$(echo ${AGENT_WALLET_NAME} | tr '[:upper:]' '[:lower:]' | sed "s~-~_~g")"
--wallet-storage-type "${WALLET_TYPE}"
--wallet-storage-config "$(eval echo \"${WALLET_STORAGE_CONFIGURATION}\")"
--wallet-storage-creds "$(eval echo \"${WALLET_STORAGE_CREDENTIALS}\")"
--admin '0.0.0.0' ${ADMIN_INTERFACE_PORT}
$([ ! -z "${AGENT_ADMIN_API_KEY}" ] && echo "--admin-api-key ${AGENT_ADMIN_API_KEY}" || echo "--admin-insecure-mode"));
env:
- name: ACAPY_GENESIS_TRANSACTIONS_LIST
value: ${APP_CONFIG_MOUNT_PATH}${GENESIS_TRANSACTIONS_LIST_FILE}
- name: AGENT_WALLET_NAME
value: ${PREFIX}${NAME}-wallet
- name: WALLET_TYPE
value: ${WALLET_STORAGE_TYPE}
- name: POSTGRESQL_WALLET_HOST
value: ${PREFIX}${WALLET_HOST}
- name: POSTGRESQL_WALLET_PORT
value: ${WALLET_HOST_PORT}
- name: WALLET_STORAGE_CONFIGURATION
value: ${WALLET_STORAGE_CONFIG}
- name: WALLET_STORAGE_CREDENTIALS
value: ${WALLET_STORAGE_CREDS}
- name: POSTGRESQL_WALLET_USER
valueFrom:
secretKeyRef:
name: ${PREFIX}${WALLET_HOST}
key: database-user
- name: POSTGRESQL_WALLET_PASSWORD
valueFrom:
secretKeyRef:
name: ${PREFIX}${WALLET_HOST}
key: database-password
- name: POSTGRESQL_WALLET_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: ${PREFIX}${WALLET_HOST}
key: admin-password
- name: ACAPY_WALLET_KEY
valueFrom:
secretKeyRef:
name: ${PREFIX}${WALLET_CREDENTIAL_STORE_NAME}
key: key
- name: ACAPY_WALLET_SEED
valueFrom:
secretKeyRef:
name: ${PREFIX}${WALLET_CREDENTIAL_STORE_NAME}
key: seed
- name: WALLET_DID
valueFrom:
secretKeyRef:
name: ${PREFIX}${WALLET_CREDENTIAL_STORE_NAME}
key: did
- name: CONTROLLER_WEBHOOK_URL
value: ${WEBHOOK_URL}
- name: CONTROLLER_API_KEY
valueFrom:
secretKeyRef:
name: ${PREFIX}controller
key: controller-api-key
- name: HTTP_INTERFACE_PORT
value: ${AGENT_HTTP_PORT}
- name: ADMIN_INTERFACE_PORT
value: ${AGENT_ADMIN_PORT}
- name: AGENT_ADMIN_API_KEY
valueFrom:
secretKeyRef:
name: ${PREFIX}${NAME}
key: admin-api-key
- name: ACAPY_LABEL
value: ${AGENT_LABEL_NAME}
- name: ACAPY_ENDPOINT
value: https://${APPLICATION_DOMAIN}
- name: ACAPY_LOG_LEVEL
value: ${LOG_LEVEL}
- name: ACAPY_TIMING
value: ${AGENT_TIMING}
- name: ACAPY_READ_ONLY_LEDGER
value: ${AGENT_READ_ONLY_LEDGER}
image:
ports:
- containerPort: ${{AGENT_ADMIN_PORT}}
protocol: TCP
- containerPort: ${{AGENT_HTTP_PORT}}
protocol: TCP
readinessProbe:
timeoutSeconds: 30
initialDelaySeconds: 3
exec:
command:
- bash
- "-c"
- 'curl --fail "http://localhost:${ADMIN_INTERFACE_PORT}/status/ready" -H "X-API-KEY: ${AGENT_ADMIN_API_KEY}"'
livenessProbe:
timeoutSeconds: 30
initialDelaySeconds: 300
exec:
command:
- bash
- "-c"
- 'curl --fail "http://localhost:${ADMIN_INTERFACE_PORT}/status/live" -H "X-API-KEY: ${AGENT_ADMIN_API_KEY}"'
imagePullPolicy: IfNotPresent
resources:
limits:
cpu: ${CPU_LIMIT}
memory: ${MEMORY_LIMIT}
requests:
cpu: ${CPU_REQUEST}
memory: ${MEMORY_REQUEST}
volumeMounts:
- name: ${PREFIX}${NAME}-app-config-volume
mountPath: ${APP_CONFIG_MOUNT_PATH}${GENESIS_TRANSACTIONS_LIST_FILE}
subPath: ${GENESIS_TRANSACTIONS_LIST_FILE}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- ${PREFIX}${NAME}
from:
kind: ImageStreamTag
name: ${PREFIX}${NAME}:${TAG_NAME}
namespace: ${IMAGE_NAMESPACE}
parameters:
- name: NAME
displayName: Name
description: The name assigned to all the objects defined in this template.
required: true
value: agent
- name: NAMESPACE_NAME
displayName: Namespace Name
description: The name of the namespace being deployed to.
required: true
value: e79518
- name: PREFIX
displayName: Prefix
description: A name prefix used for all objects.
required: false
value: vc-authn-
- name: APP_NAME
displayName: App Name
description: Used to group components together in the OpenShift console.
required: true
value: vc-authn-oidc
- name: APP_GROUP
displayName: App Group
description: Used to group components together.
required: true
value: vc-authn-oidc
- name: ROLE
displayName: Role
description: The role of this service within the application - used for Network Policies.
required: true
value: agent
- name: CONTROLLER_ROLE
displayName: Controller Role
description: The role of the vc-authn controller service within the application - used for Network Policies.
required: true
value: controller
- name: APPLICATION_DOMAIN
displayName: Application Hostname
description: The exposed hostname that will route to the service, if left blank a value will be defaulted.
required: false
value:
- name: ROUTE_TIMEOUT
displayName: Route Timeout
description: The timeout for the application route. When this timeout is exceeded the application's route will respond with a 504 Gateway Timeout error.
required: true
value: 120s
- name: IMAGE_NAMESPACE
displayName: Namespace containing application images.
required: true
value:
- name: TAG_NAME
displayName: Environment TAG name
description: The TAG name for this environment, e.g., dev, test, prod.
required: true
value: dev
- name: APP_CONFIG_MAP_NAME
displayName: Application Config Map Name
description:
The name of the configuration map holding the data to configure the
application.
required: true
value: agent-config
- name: APP_CONFIG_MOUNT_PATH
displayName: Application Config Map Mount Path
description: The mount path for the application Config Map.
required: true
value: /home/indy/
- name: AGENT_LABEL_NAME
displayName: Agent Label/Name
description: The label/name of the agent
required: true
value: ToIP VC-AuthN
- name: WEBHOOK_URL
displayName: Controller Webhook URL
description: The webhook endpoint for the controller.
required: true
value: http://vc-authn-controller:5000
- name: AGENT_ADMIN_PORT
displayName: Agent Admin Port
description: The admin port on which the service will listen.
required: true
value: "8024"
- name: ADMIN_API_KEY
displayName: Agent Admin API Key
description: The key used to authenticate client requests to the admin api.
required: true
generate: expression
from: "[a-zA-Z0-9_~!@#$%^&*()-=<>,.?;:|]{16}"
- name: AGENT_HTTP_PORT
displayName: Agent Http Port
description: The http port on which the service will listen.
required: true
value: "8021"
- name: GENESIS_TRANSACTIONS_LIST_FILE
displayName: Genesis Transactions List File
description: The filename containing the list of genesis transactions (ledgers) that this verifier can access.
required: true
value: ledgers.yaml
- name: LOG_LEVEL
displayName: Log Level
description: The logging level for the agent.
required: true
value: WARNING
- name: AGENT_TIMING
displayName: Collect agent timing information.
description: Enable/Disable collection of agent timing information. Controls the inclusion/exclusion of the agent '--timing' startup parameter. Defaults to disabled.
required: true
value: "false"
- name: AGENT_READ_ONLY_LEDGER
displayName: Set read only ledger flag.
description: Enable/Disable the read only ledger flag. Controls the inclusion/exclusion of the agent '--read-only-ledger' startup parameter. Defaults to disabled.
required: true
value: "true"
# ===============================================================================
# Wallet Configuration
#--------------------------------------------------------------------------------
- name: WALLET_STORAGE_TYPE
displayName: Wallet Storage Type
description:
The wallet storage type. Your choice of 'postgres' or 'sqlite' at
the moment. If not defined, defaults to 'sqlite' for compatibility
required: false
value: postgres_storage
- name: WALLET_HOST
displayName: PostgreSql Wallet Hostname
required: true
description: Hostname of the deployed database hosting the wallet. Only used when WALLET_STORAGE_TYPE = postgres_storage.
value: wallet
- name: WALLET_HOST_PORT
displayName: PostgreSql Wallet Port
required: true
description: The port number of the deployed database hosting the wallet. Only used when WALLET_STORAGE_TYPE = postgres_storage.
value: "5432"
- name: WALLET_STORAGE_CONFIG
displayName: Wallet Storage Configuration
required: true
description: Wallet storage configuration
value: '{\"url\":\"${POSTGRESQL_WALLET_HOST}:${POSTGRESQL_WALLET_PORT}\",\"max_connections\":5}'
- name: WALLET_STORAGE_CREDS
displayName: Wallet Storage Credential Configuration
required: true
description: Wallet storage credential configuration
value: '{\"account\":\"${POSTGRESQL_WALLET_USER}\",\"password\":\"${POSTGRESQL_WALLET_PASSWORD}\",\"admin_account\":\"postgres\",\"admin_password\":\"${POSTGRESQL_WALLET_ADMIN_PASSWORD}\"}'
- name: WALLET_CREDENTIAL_STORE_NAME
displayName: Wallet Credential Store Name
description:
The name of the wallet credential store (aka The name of the secret
that contains the wallet credentials).
required: true
value: agent-wallet-credentials
- name: WALLET_KEY
displayName: Wallet Encryption Key
description: The encryption key to be used for the wallets. Needs to be basee64 encoded.
required: true
generate: expression
from: "[a-zA-Z0-9_~!@#$%^&*()-=<>,.?;:|]{16}"
- name: WALLET_SEED
displayName: Indy Wallet Seed
description: The Seed used for the indy wallet. Needs to be basee64 encoded.
required: true
generate: expression
from: "[a-zA-Z0-9_~!@#$%^&*()-=<>,.?;:|]{16}"
- name: WALLET_DID
displayName: Indy Wallet DID
description: The DID associated to the indy wallet. Needs to be basee64 encoded.
required: false
generate: expression
from: "[a-zA-Z0-9_~!@#$%^&*()-=<>,.?;:|]{16}"
# ===============================================================================
- name: CPU_REQUEST
displayName: Resources CPU Request
description: The resources CPU request (in cores) for this build.
required: true
value: 10m
- name: CPU_LIMIT
displayName: Resources CPU Limit
description: The resources CPU limit (in cores) for this build.
required: true
value: 300m
- name: MEMORY_REQUEST
displayName: Resources Memory Request
description: The resources Memory request (in Mi, Gi, etc) for this build.
required: true
value: 10Mi
- name: MEMORY_LIMIT
displayName: Resources Memory Limit
description: The resources Memory limit (in Mi, Gi, etc) for this build.
required: true
value: 512Mi