|
| 1 | +local dex = (import 'github.com/observatorium/observatorium/configuration/components/dex.libsonnet')({ |
| 2 | + name:: 'dex', |
| 3 | + namespace:: '${NAMESPACE}', |
| 4 | + image:: '${IMAGE}:${IMAGE_TAG}', |
| 5 | + version:: '${IMAGE_TAG}', |
| 6 | + config:: { |
| 7 | + oauth2: { |
| 8 | + passwordConnector: 'local', |
| 9 | + }, |
| 10 | + staticClients: [ |
| 11 | + { |
| 12 | + id: 'test', |
| 13 | + name: 'test', |
| 14 | + secret: 'ZXhhbXBsZS1hcHAtc2VjcmV0', |
| 15 | + }, |
| 16 | + ], |
| 17 | + enablePasswordDB: true, |
| 18 | + staticPasswords: [ |
| 19 | + { |
| 20 | + |
| 21 | + // bcrypt hash of the string "password" |
| 22 | + hash: '$2a$10$2b2cU8CPhOTaGrs1HRQuAueS7JTT5ZHsHSzYiFPm1leZck7Mc8T4W', |
| 23 | + username: 'admin', |
| 24 | + userID: '08a8684b-db88-4b73-90a9-3cd1661f5466', |
| 25 | + }, |
| 26 | + ], |
| 27 | + issuer: 'http://${NAMESPACE}.${NAMESPACE}.svc.cluster.local:5556/dex', |
| 28 | + storage: { |
| 29 | + type: 'sqlite3', |
| 30 | + config: { file: '/storage/dex.db' }, |
| 31 | + }, |
| 32 | + web: { |
| 33 | + http: '0.0.0.0:5556', |
| 34 | + }, |
| 35 | + logger: { level: 'debug' }, |
| 36 | + }, |
| 37 | + replicas: 1, |
| 38 | +}) + { |
| 39 | + deployment+: { |
| 40 | + spec+: { |
| 41 | + replicas: '${{REPLICAS}}', // additional parenthesis does matter, they convert argument to an int. |
| 42 | + template+: { |
| 43 | + spec+: { |
| 44 | + containers: [ |
| 45 | + super.containers[0] { |
| 46 | + resources: { |
| 47 | + requests: { |
| 48 | + cpu: '${DEX_CPU_REQUEST}', |
| 49 | + memory: '${DEX_MEMORY_REQUEST}', |
| 50 | + }, |
| 51 | + limits: { |
| 52 | + cpu: '${DEX_CPU_LIMITS}', |
| 53 | + memory: '${DEX_MEMORY_LIMITS}', |
| 54 | + }, |
| 55 | + }, |
| 56 | + volumeMounts: [ |
| 57 | + { name: 'config', mountPath: '/etc/dex/cfg' }, |
| 58 | + { name: 'storage', mountPath: '/storage', readOnly: false }, |
| 59 | + ], |
| 60 | + }, |
| 61 | + ], |
| 62 | + volumes: [ |
| 63 | + { |
| 64 | + name: 'config', |
| 65 | + secret: { |
| 66 | + secretName: dex.config.name, |
| 67 | + items: [ |
| 68 | + { key: 'config.yaml', path: 'config.yaml' }, |
| 69 | + ], |
| 70 | + }, |
| 71 | + }, |
| 72 | + { |
| 73 | + name: 'storage', |
| 74 | + persistentVolumeClaim: { claimName: dex.config.name }, |
| 75 | + }, |
| 76 | + ], |
| 77 | + }, |
| 78 | + }, |
| 79 | + }, |
| 80 | + }, |
| 81 | +}; |
| 82 | + |
| 83 | +{ |
| 84 | + apiVersion: 'v1', |
| 85 | + kind: 'Template', |
| 86 | + metadata: { |
| 87 | + name: 'dex', |
| 88 | + }, |
| 89 | + objects: [ |
| 90 | + dex[name] { |
| 91 | + metadata+: { |
| 92 | + namespace:: 'hidden', |
| 93 | + }, |
| 94 | + } |
| 95 | + for name in std.objectFields(dex) |
| 96 | + ], |
| 97 | + parameters: [ |
| 98 | + { name: 'NAMESPACE', value: 'dex' }, |
| 99 | + { name: 'IMAGE', value: 'dexidp/dex' }, |
| 100 | + { name: 'IMAGE_TAG', value: 'v2.30.0' }, |
| 101 | + { name: 'REPLICAS', value: '1' }, |
| 102 | + { name: 'DEX_CPU_REQUEST', value: '100m' }, |
| 103 | + { name: 'DEX_MEMORY_REQUEST', value: '200Mi' }, |
| 104 | + { name: 'DEX_CPU_LIMITS', value: '100m' }, |
| 105 | + { name: 'DEX_MEMORY_LIMITS', value: '200Mi' }, |
| 106 | + ], |
| 107 | +} |
0 commit comments