Kosko charts for the SocialGouv needs
See also : the API Documentation
Providing a common Kubernetes (k8s) configuration to SocialGouv apps is a tricky task. We want to provide
- a "zero configuration" build, where most application will start from
- a Continuous delivery (CD) approach where each Git branches and tags should be deployed
- a k8s namespace should be created per branches and tags. It should be GitLab friendly
- a basic k8s triad : Deployment, Service, Ingress
- a GitLab environments and deployments and clusters ready configuration
- a Kubernetes Resource Report friendly labelling
- a kubed wildcard sync
Powered by Kosko, in this lib we provide default SocialGouv components and environments. We expect project to use and extend them at will.
$ npx degit "SocialGouv/kosko-charts/templates/sample#v9.19.2" .k8s
$ yarn --cwd .k8s
# on GitLab
$ yarn --cwd .k8s kosko generate --env dev
# locally
$ DOTENV_CONFIG_PATH=environments/.gitlab-ci.env yarn --cwd .k8s dev --require dotenv/config
We use degit to scaffold the deployment config.
$ npx degit "SocialGouv/kosko-charts/templates/sample#v9.19.2" .k8s
.k8s
is the target deployment config package folder.
You can install it with :
$ yarn --cwd .k8s
You can add a shortcut to it in your package.json
{
// [...]
"scripts": {
// [...]
"k8s": "yarn --silent --cwd .k8s",
// [...]
}
// [...]
}
The shortcut using --silent
to be pipable to kubectl apply
like :
$ yarn k8s generate | kubectl apply -f -
The SocialGouv default components
The SocialGouv default components
In addition to the sample
template inspired by the SocialGouv/sample-next-app, you will find addtional templates you can use to bootstrap your .k8s
folder.
# For [hasura](https://hasura.io/)
$ npx degit "SocialGouv/kosko-charts/templates/hasura#v9.19.2" .k8s
# For [nginx](https://nginx.org/)
$ npx degit "SocialGouv/kosko-charts/templates/nginx#v9.19.2" .k8s
# For [pgweb](https://sosedoff.github.io/pgweb/)
$ npx degit "SocialGouv/kosko-charts/templates/pgweb#v9.19.2" .k8s
# For [redis](https://redislabs.com/)
$ npx degit "SocialGouv/kosko-charts/templates/redis#v9.19.2" .k8s
@socialgouv/kosko-charts
provides a snapshot testing strategy through Jest.
# At the root of your project
$ npx degit "SocialGouv/kosko-charts/templates/testing#v9.19.2" .k8s
Then update the .k8s/__tests__
file to match your project.
Our e2e/testing/__fixtures__/__tests__
will run default testing cases.
Using the global environments/.gitlab-ci.env
(if exists in your kosko context).
In addition, it will try to load and merge it with environments/<env>/.gitlab-ci.env
.
This package was inspired by the kosko itself and the year of experimentation with Helm and our SocialGouv/helm-charts.