forked from hswaw/hscloud
kube: standardize convention for passing postgres options
Declare options when creating postgres {}, then pass env by taking from postgres's cfg and svc. This is both to reduce chance of making a mistake, and to improve copy-pasteability of jsonnets Change-Id: Ief16a6825af64795f3b10e1e617b96c3d1c2a578 Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1807 Reviewed-by: q3k <q3k@hackerspace.pl>master
parent
1439fde1ba
commit
37991744d8
|
@ -11,10 +11,6 @@ local postgres = import '../../kube/postgres_v.libsonnet';
|
||||||
domain: 'inventory.hackerspace.pl',
|
domain: 'inventory.hackerspace.pl',
|
||||||
|
|
||||||
image: 'registry.k0.hswaw.net/palid/spejstore:1694280421',
|
image: 'registry.k0.hswaw.net/palid/spejstore:1694280421',
|
||||||
db: {
|
|
||||||
name: 'inventory',
|
|
||||||
username: 'inventory',
|
|
||||||
},
|
|
||||||
oauthClientId: '82fffb65-0bbd-4d18-becd-0ce0b31373cf',
|
oauthClientId: '82fffb65-0bbd-4d18-becd-0ce0b31373cf',
|
||||||
storageClassName: 'waw-hdd-redundant-3',
|
storageClassName: 'waw-hdd-redundant-3',
|
||||||
|
|
||||||
|
@ -43,11 +39,11 @@ local postgres = import '../../kube/postgres_v.libsonnet';
|
||||||
},
|
},
|
||||||
env_: {
|
env_: {
|
||||||
SPEJSTORE_ENV: 'prod',
|
SPEJSTORE_ENV: 'prod',
|
||||||
SPEJSTORE_DB_NAME: cfg.db.name,
|
SPEJSTORE_DB_NAME: top.postgres.cfg.database,
|
||||||
SPEJSTORE_DB_USER: cfg.db.username,
|
SPEJSTORE_DB_USER: top.postgres.cfg.username,
|
||||||
SPEJSTORE_DB_PASSWORD: top.secretRefs.postgres,
|
SPEJSTORE_DB_PASSWORD: top.postgres.cfg.password,
|
||||||
SPEJSTORE_DB_HOST: top.psql.svc.host,
|
SPEJSTORE_DB_HOST: top.postgres.svc.host,
|
||||||
SPEJSTORE_DB_PORT: top.psql.svc.port,
|
SPEJSTORE_DB_PORT: top.postgres.svc.port,
|
||||||
SPEJSTORE_ALLOWED_HOSTS: cfg.domain,
|
SPEJSTORE_ALLOWED_HOSTS: cfg.domain,
|
||||||
SPEJSTORE_CLIENT_ID: cfg.oauthClientId,
|
SPEJSTORE_CLIENT_ID: cfg.oauthClientId,
|
||||||
SPEJSTORE_SECRET: top.secretRefs.oauth,
|
SPEJSTORE_SECRET: top.secretRefs.oauth,
|
||||||
|
@ -70,15 +66,15 @@ local postgres = import '../../kube/postgres_v.libsonnet';
|
||||||
storageClass:: cfg.storageClassName,
|
storageClass:: cfg.storageClassName,
|
||||||
},
|
},
|
||||||
|
|
||||||
psql: postgres {
|
postgres: postgres {
|
||||||
cfg+: {
|
cfg+: {
|
||||||
namespace: cfg.namespace,
|
namespace: cfg.namespace,
|
||||||
appName: cfg.name,
|
appName: cfg.name,
|
||||||
storageClassName: cfg.storageClassName,
|
storageClassName: cfg.storageClassName,
|
||||||
version: '15.4',
|
version: '15.4',
|
||||||
|
|
||||||
database: cfg.db.name,
|
database: 'inventory',
|
||||||
username: cfg.db.username,
|
username: 'inventory',
|
||||||
password: top.secretRefs.postgres,
|
password: top.secretRefs.postgres,
|
||||||
},
|
},
|
||||||
bouncer: {},
|
bouncer: {},
|
||||||
|
|
|
@ -68,10 +68,10 @@ local redis = import "../../../kube/redis.libsonnet";
|
||||||
REDIS_URL: "redis://:$(REDIS_PASS)@%s" % [top.redis.svc.host_colon_port],
|
REDIS_URL: "redis://:$(REDIS_PASS)@%s" % [top.redis.svc.host_colon_port],
|
||||||
|
|
||||||
DB_HOST: top.postgres.svc.host,
|
DB_HOST: top.postgres.svc.host,
|
||||||
DB_USER: "mastodon",
|
DB_PORT: top.postgres.svc.port,
|
||||||
DB_NAME: "mastodon",
|
DB_USER: top.postgres.cfg.username,
|
||||||
DB_PASS: kube.SecretKeyRef(top.config, "postgres-pass"),
|
DB_NAME: top.postgres.cfg.database,
|
||||||
DB_PORT: "5432",
|
DB_PASS: top.postgres.cfg.password,
|
||||||
|
|
||||||
ES_ENABLED: "false",
|
ES_ENABLED: "false",
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,7 @@ local postgres = import "../../kube/postgres.libsonnet";
|
||||||
domain: error "domain must be set",
|
domain: error "domain must be set",
|
||||||
storageClassName: "waw-hdd-redundant-3",
|
storageClassName: "waw-hdd-redundant-3",
|
||||||
database: {
|
database: {
|
||||||
host: "postgres",
|
|
||||||
name: "redmine",
|
|
||||||
username: "redmine",
|
|
||||||
password: { secretKeyRef: { name: "redmine", key: "postgres_password" } },
|
password: { secretKeyRef: { name: "redmine", key: "postgres_password" } },
|
||||||
port: 5432,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
b: {
|
b: {
|
||||||
|
@ -59,8 +55,8 @@ local postgres = import "../../kube/postgres.libsonnet";
|
||||||
cfg+: {
|
cfg+: {
|
||||||
namespace: cfg.namespace,
|
namespace: cfg.namespace,
|
||||||
appName: "redmine",
|
appName: "redmine",
|
||||||
database: cfg.database.name,
|
database: "redmine",
|
||||||
username: cfg.database.username,
|
username: "redmine",
|
||||||
password: cfg.database.password,
|
password: cfg.database.password,
|
||||||
storageClassName: cfg.storageClassName,
|
storageClassName: cfg.storageClassName,
|
||||||
},
|
},
|
||||||
|
@ -88,11 +84,11 @@ local postgres = import "../../kube/postgres.libsonnet";
|
||||||
http: { containerPort: 3000 },
|
http: { containerPort: 3000 },
|
||||||
},
|
},
|
||||||
env_: {
|
env_: {
|
||||||
REDMINE_DB_POSTGRES: cfg.database.host,
|
REDMINE_DB_POSTGRES: top.postgres.svc.host,
|
||||||
REDMINE_DB_PORT: cfg.database.port,
|
REDMINE_DB_PORT: top.postgres.svc.port,
|
||||||
REDMINE_DB_USERNAME: cfg.database.username,
|
REDMINE_DB_DATABASE: top.postgres.cfg.database,
|
||||||
REDMINE_DB_PASSWORD: cfg.database.password,
|
REDMINE_DB_USERNAME: top.postgres.cfg.username,
|
||||||
REDMINE_DB_DATABASE: cfg.database.name,
|
REDMINE_DB_PASSWORD: top.postgres.cfg.password,
|
||||||
|
|
||||||
REDMINE_SECRET_KEY_BASE: { secretKeyRef: { name: "redmine", key: "secret_key" } },
|
REDMINE_SECRET_KEY_BASE: { secretKeyRef: { name: "redmine", key: "secret_key" } },
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ local redis = import "../../kube/redis.libsonnet";
|
||||||
A_REDIS_PASSWORD: top.redis.cfg.password,
|
A_REDIS_PASSWORD: top.redis.cfg.password,
|
||||||
PAPERLESS_REDIS: "redis://:$(A_REDIS_PASSWORD)@redis:6379",
|
PAPERLESS_REDIS: "redis://:$(A_REDIS_PASSWORD)@redis:6379",
|
||||||
|
|
||||||
PAPERLESS_DBHOST: "postgres",
|
PAPERLESS_DBHOST: top.postgres.svc.host,
|
||||||
PAPERLESS_DBNAME: top.postgres.cfg.database,
|
PAPERLESS_DBNAME: top.postgres.cfg.database,
|
||||||
PAPERLESS_DBUSER: top.postgres.cfg.username,
|
PAPERLESS_DBUSER: top.postgres.cfg.username,
|
||||||
PAPERLESS_DBPASS: top.postgres.cfg.password,
|
PAPERLESS_DBPASS: top.postgres.cfg.password,
|
||||||
|
|
Loading…
Reference in New Issue