diff --git a/.k8s/components/pg.ts b/.k8s/components/pg.ts index 20cdeca7..90ce3581 100644 --- a/.k8s/components/pg.ts +++ b/.k8s/components/pg.ts @@ -7,23 +7,25 @@ import gitlab from "@socialgouv/kosko-charts/environments/gitlab"; import { create } from "@socialgouv/kosko-charts/components/azure-pg"; -let manifests = create({ - env, -}); +export default () => { + if (env.env === "dev") { + return create({ + env, + }); + } -if (env.env !== "dev") { // in prod/preprod, we try to add a fixed sealed-secret const secret = loadYaml(env, `pg-user.sealed-secret.yaml`); - if (secret) { - const envParams = gitlab(process.env); - // add gitlab annotations - updateMetadata(secret, { - annotations: envParams.annotations || {}, - labels: envParams.labels || {}, - namespace: envParams.namespace, - }); - manifests = [secret]; + if (!secret) { + return []; } -} -export default manifests; + const envParams = gitlab(process.env); + // add gitlab annotations + updateMetadata(secret, { + annotations: envParams.annotations || {}, + labels: envParams.labels || {}, + namespace: envParams.namespace, + }); + return [secret]; +}; diff --git a/.k8s/environments/preprod/pg.sealed-secret.yaml b/.k8s/environments/preprod/pg-user.sealed-secret.yaml similarity index 100% rename from .k8s/environments/preprod/pg.sealed-secret.yaml rename to .k8s/environments/preprod/pg-user.sealed-secret.yaml