Skip to content

Commit

Permalink
fix(hasura): use azure fix pg user on tags
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil committed Jul 30, 2020
1 parent 8108e13 commit fda47d0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
Expand Up @@ -90,7 +90,7 @@ spec:
periodSeconds: 5
envFrom:
- secretRef:
name: azure-pg-user-undefined
name: azure-pg-user
initContainers:
- name: wait-for-postgres
image: 'postgres:10'
Expand Down
33 changes: 17 additions & 16 deletions src/utils/addPostgresUserSecret.ts
@@ -1,21 +1,22 @@
import { addToEnvFrom } from "@socialgouv/kosko-charts/utils/addToEnvFrom";
import { Deployment } from "kubernetes-models/apps/v1/Deployment";
import { EnvFromSource } from "kubernetes-models/v1/EnvFromSource";

// DEV: add secret to access DB
//@ts-expect-error
export const addPostgresUserSecret = (deployment) => {
if (deployment) {
const name = process.env.PRODUCTION
? `azure-pg-user`
: `azure-pg-user-${process.env.CI_COMMIT_SHORT_SHA}`;
const azureSecretSource = new EnvFromSource({
secretRef: {
name,
},
});
addToEnvFrom({
data: [azureSecretSource],
deployment,
});
export const addPostgresUserSecret = (deployment?: Deployment): void => {
if (!deployment) {
return;
}

const name = process.env.CI_COMMIT_TAG
? `azure-pg-user`
: `azure-pg-user-${process.env.CI_COMMIT_SHORT_SHA}`;
const azureSecretSource = new EnvFromSource({
secretRef: {
name,
},
});
addToEnvFrom({
data: [azureSecretSource],
deployment,
});
};

0 comments on commit fda47d0

Please sign in to comment.