Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

SocialGouv/kosko-charts

Repository files navigation

Kosko Charts

🧹The Social Gouv Kosko Charts✨

Github Master Main Status License: Apache-2.0 Npm version codecov




Kosko charts for the SocialGouv needs

See also : the API Documentation

Problem

Providing a common Kubernetes (k8s) configuration to SocialGouv apps is a tricky task. We want to provide





Solution

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




Installation

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 -



Usage

Components

The SocialGouv default components

Environments

The SocialGouv default components

Templates

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

Testing

@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.





Inspiration

This package was inspired by the kosko itself and the year of experimentation with Helm and our SocialGouv/helm-charts.