Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add addWaitForPostgres and use in hasura component
- Loading branch information
Julien Bouquillon
committed
Jul 28, 2020
1 parent
4481bfe
commit f8181ff
Showing
5 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Deployment } from "kubernetes-models/apps/v1/Deployment"; | ||
|
||
import { getDefaultPgParams } from "../components/azure-pg"; | ||
import { waitForPostgres } from "./waitForPostgres"; | ||
|
||
export const addWaitForPostgres = (deployment: Deployment): Deployment => { | ||
const defaultParams = getDefaultPgParams(); | ||
|
||
const initContainer = waitForPostgres({ | ||
secretRefName: defaultParams.name, | ||
}); | ||
|
||
if (deployment.spec && deployment.spec.template.spec) { | ||
deployment.spec.template.spec.initContainers = [initContainer]; | ||
} | ||
|
||
return deployment; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* eslint-disable sort-keys */ | ||
/* eslint-disable sort-keys-fix/sort-keys-fix */ | ||
import { IIoK8sApiCoreV1Container } from "kubernetes-models/_definitions/IoK8sApiCoreV1Container"; | ||
|
||
interface WaitForPostgresParams { | ||
secretRefName: string; | ||
} | ||
|
||
export const waitForPostgres = ({ | ||
secretRefName = "azure-pg-user", | ||
}: WaitForPostgresParams): IIoK8sApiCoreV1Container => { | ||
return { | ||
name: "wait-for-postgres", | ||
image: `registry.gitlab.factory.social.gouv.fr/socialgouv/docker/wait_for_postgres:1.49.0`, | ||
imagePullPolicy: "Always", | ||
resources: { | ||
requests: { | ||
cpu: "5m", | ||
memory: "16Mi", | ||
}, | ||
limits: { | ||
cpu: "20m", | ||
memory: "32Mi", | ||
}, | ||
}, | ||
envFrom: [ | ||
{ | ||
secretRef: { | ||
name: secretRefName, | ||
}, | ||
}, | ||
], | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* eslint-disable sort-keys */ | ||
/* eslint-disable sort-keys-fix/sort-keys-fix */ | ||
import env from "@kosko/env"; | ||
import { create } from "@socialgouv/kosko-charts/components/hasura"; | ||
|
||
const manifests = create({ | ||
env, | ||
config: {}, | ||
}); | ||
|
||
export default manifests; |