Use compose-go + improvements (#9)
Use compose-go https://github.com/compose-spec/compose-go to make Katenary parsing compose file the official way. Add labels: - `volume-from` (with `same-pod`) to avoid volume repetition - `ignore` to ignore a service - `mapenv` (replaces the `env-to-service`) to map environment to helm variable (as a template string) - `secret-vars` declares variables as secret values More: - Now, environment (as secret vars) are set in values.yaml - Ingress has got annotations in values.yaml - Probes (liveness probe) are improved - fixed code to optimize - many others fixes about path, bad volume check, refactorisation, tests...
This commit is contained in:
17
README.md
17
README.md
@@ -16,6 +16,7 @@ This project is partially made at [Smile](https://www.smile.eu)
|
||||
|
||||
You can download the binaries from the [Release](https://github.com/metal3d/katenary/releases) section. Copy the binary and rename it to `katenary`. Place the binary inside your `PATH`. You should now be able to call the `katenary` command.
|
||||
|
||||
You can of course get the binary with `go install -u github.com/metal3d/katenary/cmd/katenary/...` but the `main` branch is continuously updated. It's preferable to use releases.
|
||||
|
||||
You can use this commands on Linux:
|
||||
|
||||
@@ -125,7 +126,7 @@ What can be interpreted by Katenary:
|
||||
- `env_file` list will create a configMap object per environemnt file (⚠ todo: the "to-service" label doesn't work with configMap for now)
|
||||
- some labels can help to bind values, for example:
|
||||
- `katenary.io/ingress: 80` will expose the port 80 in a ingress
|
||||
- `katenary.io/env-to-service: VARNAME` will convert the value to a variable `{{ .Release.Name }}-VARNAME` - it's usefull when you want to pass the name of a service as a variable (think about the service name for mysql to pass to a container that wants to connect to this)
|
||||
- `katenary.io/mapenv: |`: allow to map environment to something else than the given value in the compose file
|
||||
|
||||
Exemple of a possible `docker-compose.yaml` file:
|
||||
|
||||
@@ -144,21 +145,27 @@ services:
|
||||
# because it's the "exposed" port
|
||||
- database
|
||||
labels:
|
||||
# explain to katenary that "DB_HOST" value is variable (using release name)
|
||||
katenary.io/env-to-service: DB_HOST
|
||||
# expose the port 80 as an ingress
|
||||
katenary.io/ingress: 80
|
||||
# make adaptations, DB_HOST environment is actually the service name
|
||||
# to hit (note the yaml style, start with "|")
|
||||
katenary.io/mapenv: |
|
||||
DB_HOST: {{ .Release.Name }}-database
|
||||
database:
|
||||
image: mariadb:10
|
||||
env_file:
|
||||
# this will create a configMap
|
||||
- my_env.env
|
||||
environment:
|
||||
MARIADB_USER: foo
|
||||
MARIADB_ROOT_PASSWORD: foobar
|
||||
MARIADB_PASSWORD: bar
|
||||
labels:
|
||||
# no need to declare this port in docker-compose
|
||||
# but katenary will need it
|
||||
katenary.io/ports: 3306
|
||||
# these variables are secrets
|
||||
katenary.io/secret-vars: MARIADB_ROOT_PASSWORD, MARIADB_PASSWORD
|
||||
```
|
||||
|
||||
# Labels
|
||||
@@ -166,10 +173,12 @@ services:
|
||||
These labels could be found by `katenary show-labels`, and can be placed as "labels" inside your docker-compose file:
|
||||
|
||||
```
|
||||
katenary.io/ignore : ignore the container, it will not yied any object in the helm chart
|
||||
katenary.io/secret-vars : secret variables to push on a secret file
|
||||
katenary.io/secret-envfiles : set the given file names as a secret instead of configmap
|
||||
katenary.io/mapenv : map environment variable to a template string (yaml style)
|
||||
katenary.io/ports : set the ports to expose as a service (coma separated)
|
||||
katenary.io/ingress : set the port to expose in an ingress (coma separated)
|
||||
katenary.io/env-to-service : specifies that the environment variable points on a service name (coma separated)
|
||||
katenary.io/configmap-volumes : specifies that the volumes points on a configmap (coma separated)
|
||||
katenary.io/same-pod : specifies that the pod should be deployed in the same pod than the given service name
|
||||
katenary.io/empty-dirs : specifies that the given volume names should be "emptyDir" instead of persistentVolumeClaim (coma separated)
|
||||
|
Reference in New Issue
Block a user