This function will add a bunch of [[EnvVar]] to the first container of a given [[Deployment]] EnvVars are given as an object
import { addEnvs } from "@socialgouv/kosko-charts/utils"
addEnvs({
deployment,
data: {
NODE_ENV: "production",
TEST: "42"
}
})
This function will add an initContainer to a given [[Deployment]]
import { addInitContainer } from "@socialgouv/kosko-charts/utils"
import { Container } from "kubernetes-models/v1/Container";
const initContainer = new Container({
args: ["http://www.free.fr"],
image: `registry.pouet.org/wait-for-http:2.4.0`,
imagePullPolicy: "Always",
name: `wait-for-free`,
});
addInitContainer(deployment, initContainer);
This function will add an initContainer with the given params to a given [[Deployment]]
By default the initContainer will use the [[Deployment]] first [[Container]] image as image
import { addInitContainerCommand } from "@socialgouv/kosko-charts/utils"
const initContainerCommand = {
command: ["yarn"],
args: ["init-db"],
name: `yarn-init-db`,
};
addInitContainerCommand(deployment, initContainerCommand);
This function will add a reference to the default postgres user secret to a given [[Deployment]]
This secret is named azure-pg-user
or azure-pg-user-SHA1
on feature-branches.
import { addPostgresUserSecret } from "@socialgouv/kosko-charts/utils"
addPostgresUserSecret(deployment);
This function will add an [[EnvFromSource]] to the first container of a given [[Deployment]]
Useful to get all variables from a [[ConfigMap]] or a [[Secret]]
import { addToEnvFrom } from "@socialgouv/kosko-charts/utils"
addToEnvFrom(deployment, new EnvFromSource({
secretRef: {
name: "some-secret"
}
}))
This function will add a wait-for-http initContainer to the first container of a given [[Deployment]]
import { addWaitForHttp } from "@socialgouv/kosko-charts/utils"
addWaitForHttp(deployment, "http://www.free.fr");
This function will add a wait-for-postgres initContainer to the first container of a given [[Deployment]]
import { addWaitForPostgres } from "@socialgouv/kosko-charts/utils"
addWaitForPostgres(deployment);
This function will add a wait-for-service initContainer to the first container of a given [[Deployment]]
import { addWaitForService } from "@socialgouv/kosko-charts/utils"
addWaitForService(deployment, "hasura");
This function will return a [[Deployment]] with some defaults
import { createDeployment } from "@socialgouv/kosko-charts/utils"
const deployment = createDeployment({
name: "app";
image: "containous/whoami:latest"
});
This function will return an [[Ingress]] with some defaults
The ingress will listen on given hosts
and redirect to given service
If the ingress has the nginx.ingress.kubernetes.io/permanent-redirect
annotation then the hosts
will be used only for SSL certificate
import { createIngress } from "@socialgouv/kosko-charts/utils"
const ingress = createIngress({
name: "app-ingress",
hosts: ["host1.pouet.fr", "host2.pouet.fr"],
serviceName: "www",
servicePortName: "http"
});
This function will return a [[Service]] with some defaults
import { createService } from "@socialgouv/kosko-charts/utils"
const service = createService({
name: "app",
servicePort: 80,
containerPort: 3000,
selector: 80,
selector: {
app: "my-target-app"
}
});
This function will return the first [[Deployment]] of a given set of manifests
import { getDeployment } from "@socialgouv/kosko-charts/utils"
const deployment = getDeployment(manifests);
This function will return the full path for a given docker image based on CI_COMMIT_TAG
or CI_COMMIT_SHA
import { getHarborImagePath } from "@socialgouv/kosko-charts/utils"
const imagePath = getHarborImagePath({
name: "docker-mario",
project: "sre", // defaults to process.env.HARBOR_PROJECT
registry: "chips.registry.com", // defaults to process.env.HARBOR_REGISTRY
})
This function will return the first hostname found in a given list of manifests
import { getIngressHost } from "@socialgouv/kosko-charts/utils"
const host = getIngressHost(manifests);
This function will return the first Manifest in a given set of manifests
import { getManifestByKind } from "@socialgouv/kosko-charts/utils"
import type { Ingress } from "kubernetes-models/api/networking/v1beta1/Ingress";
const deployment = getManifestByKind(manifests, Ingress);
This function will return the default postgres server hostname for a given app name and environnement
import { getPgServerHostname } from "@socialgouv/kosko-charts/utils"
const hostname = getPgServerHostname("app-admin", "prod");
This creates a [[Container]] using the wait-for-http docker image
import { waitForHttp } from "@socialgouv/kosko-charts/utils"
const container = waitForHttp({
name: "wait-for-free",
url: "http://www.free.fr"
});
This creates a [[Container]] using the wait-for-postgres docker image
import { waitForPostgres } from "@socialgouv/kosko-charts/utils"
const container = waitForPostgres({
secretRefName: "some-secret"
});
This creates a [[Container]] that runs until nslookup
resolve for the given service in the current kube namespace
import { waitForService } from "@socialgouv/kosko-charts/utils"
const container = waitForService({
name: "hasura"
});
Generated using TypeDoc
This function will add an [[EnvVar]] to the first container of a given [[Deployment]]