Reindentation and change labels
This commit is contained in:
@@ -55,15 +55,15 @@ See this compose file:
|
|||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
webapp:
|
webapp:
|
||||||
image: php:8-apache
|
image: php:8-apache
|
||||||
depends_on:
|
depends_on:
|
||||||
- database
|
- database
|
||||||
|
|
||||||
database:
|
database:
|
||||||
image: mariadb
|
image: mariadb
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: foobar
|
MYSQL_ROOT_PASSWORD: foobar
|
||||||
```
|
```
|
||||||
|
|
||||||
In this case, `webapp` needs to know the `database` port because the `depends_on` points on it and Kubernetes has not (yet) solution to check the database startup. Katenary wants to create a `initContainer` to hit on the related service. So, instead of exposing the port in the compose definition, let's declare this to katenary with labels:
|
In this case, `webapp` needs to know the `database` port because the `depends_on` points on it and Kubernetes has not (yet) solution to check the database startup. Katenary wants to create a `initContainer` to hit on the related service. So, instead of exposing the port in the compose definition, let's declare this to katenary with labels:
|
||||||
@@ -73,17 +73,18 @@ In this case, `webapp` needs to know the `database` port because the `depends_on
|
|||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
webapp:
|
webapp:
|
||||||
image: php:8-apache
|
image: php:8-apache
|
||||||
depends_on:
|
depends_on:
|
||||||
- database
|
- database
|
||||||
|
|
||||||
database:
|
database:
|
||||||
image: mariadb
|
image: mariadb
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: foobar
|
MYSQL_ROOT_PASSWORD: foobar
|
||||||
labels:
|
labels:
|
||||||
katenary.io/ports: 3306
|
katenary.v3/ports: |-
|
||||||
|
- 3306
|
||||||
```
|
```
|
||||||
|
|
||||||
### Declare ingresses
|
### Declare ingresses
|
||||||
@@ -93,11 +94,13 @@ It's very common to have an `Ingress` on web application to deploy on Kuberenete
|
|||||||
```yaml
|
```yaml
|
||||||
# ...
|
# ...
|
||||||
services:
|
services:
|
||||||
webapp:
|
webapp:
|
||||||
image: ...
|
image: ...
|
||||||
ports: 8080:5050
|
ports: 8080:5050
|
||||||
labels:
|
labels:
|
||||||
katenary.io/ingress: 5050
|
katenary.v3/ingress: |-
|
||||||
|
port: 5050
|
||||||
|
hostname: myapp.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that the port to bind is the one used by the container, not the used locally. This is because Katenary create a service to bind the container itself.
|
Note that the port to bind is the one used by the container, not the used locally. This is because Katenary create a service to bind the container itself.
|
||||||
@@ -111,13 +114,13 @@ With a compose file, there is no problem as Docker/Podman allows to resolve the
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
services:
|
services:
|
||||||
webapp:
|
webapp:
|
||||||
image: php:7-apache
|
image: php:7-apache
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: database
|
DB_HOST: database
|
||||||
|
|
||||||
database:
|
database:
|
||||||
image: mariadb
|
image: mariadb
|
||||||
```
|
```
|
||||||
|
|
||||||
Katenary prefixes the services with `{{ .Release.Name }}` (to make it possible to install the application several times in a namespace), so you need to "remap" the environment variable to the right one.
|
Katenary prefixes the services with `{{ .Release.Name }}` (to make it possible to install the application several times in a namespace), so you need to "remap" the environment variable to the right one.
|
||||||
@@ -125,33 +128,33 @@ Katenary prefixes the services with `{{ .Release.Name }}` (to make it possible t
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
services:
|
services:
|
||||||
webapp:
|
webapp:
|
||||||
image: php:7-apache
|
image: php:7-apache
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: database
|
DB_HOST: database
|
||||||
labels:
|
labels:
|
||||||
katenary.io/mapenv: |
|
katenary.v3/mapenv: |-
|
||||||
DB_HOST: "{{ .Release.Name }}-database"
|
DB_HOST: "{{ .Release.Name }}-database"
|
||||||
|
|
||||||
database:
|
database:
|
||||||
image: mariadb
|
image: mariadb
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! Warning
|
!!! Warning
|
||||||
This is a "multiline" label that accepts YAML or JSON content, don't forget to add a pipe char (`|`) and to indent your content
|
This is a "multiline" label that accepts YAML or JSON content, don't forget to add a pipe char (`|` or `|-`) and to **indent** your content
|
||||||
|
|
||||||
This label can be used to map others environment for any others reason. E.g. to change an informational environment variable.
|
This label can be used to map others environment for any others reason. E.g. to change an informational environment variable.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|
||||||
services:
|
services:
|
||||||
webapp:
|
webapp:
|
||||||
#...
|
#...
|
||||||
environment:
|
environment:
|
||||||
RUNNING: docker
|
RUNNING: docker
|
||||||
labels:
|
labels:
|
||||||
katenary.io/mapenv: |
|
katenary.v3/mapenv: |-
|
||||||
RUNNING: kubernetes
|
RUNNING: kubernetes
|
||||||
```
|
```
|
||||||
|
|
||||||
In the above example, `RUNNING` will be set to `kubernetes` when you'll deploy the application with helm, and it's `docker` for "podman" and "docker" executions.
|
In the above example, `RUNNING` will be set to `kubernetes` when you'll deploy the application with helm, and it's `docker` for "podman" and "docker" executions.
|
||||||
|
Reference in New Issue
Block a user