feat(doc): Enhancement, cleanup, add package instructions
All checks were successful
Go-Tests / tests (pull_request) Successful in 1m48s
Go-Tests / sonar (pull_request) Successful in 52s
Go-Tests / tests (push) Successful in 3m30s
Go-Tests / sonar (push) Successful in 50s

- remove trailing spaces
- add instruction for packages
- reindent YAML examples
- remove section telling that there is no config files, as
`katenary.yaml` file can now be used
This commit is contained in:
2025-08-29 13:24:32 +02:00
parent 6c2e8fa9b2
commit 6cd1c92997
9 changed files with 297 additions and 261 deletions

View File

@@ -37,6 +37,24 @@ The main developer is [Patrice FERLET](https://repo.katenary.io/metal3d).
## Install
### Package from repository and Windows installer
You can find Linux packages repository and Windows installer in the [packages page](https://repo.katenary.io/Katenary/katenary/packages).
> Note for Fedora >= 42, the repository instructions are not up-to-date. You should use:
>
> ```bash
> dnf config-manager addrepo \
> --from-repofile https://repo.katenary.io/Katenary/katenary/fedora/katenary.repo
> dnf install katenary
> ```
- Windows users, go to the "generic" packages page, and download the `setup.exe` file.
- macOS users, please use the "`darwin`" binary. An experimental package is in preparation.
- FreedBSD users, please use the "`freebsd`" package in "generic" packages page.
### Binary installation
You can download the binaries from the [Release](https://repo.katenary.io/Katenary/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.
@@ -54,7 +72,7 @@ go install -u katenary.io/cmd@latest
go install -u katenary.io/cmd@v3.0.0
```
## Or, build yourself
### Or, build yourself
If you've got `podman` or `docker`, you can build `katenary` by using:
@@ -69,7 +87,7 @@ make install
```
It will use the default PREFIX (`~/.local/`) to install the binary in the `bin` subdirectory. You can force the PREFIX
value at install time, but maybe you need to use "sudo":
value at install time, but maybe you need to use "`sudo`":
```bash
sudo make install PREFIX=/usr/local

2
doc/.editorconfig Normal file
View File

@@ -0,0 +1,2 @@
[*.md]
indent_size=2

View File

@@ -92,7 +92,7 @@ For each source container linked to the destination:
- we then copy the service port to the destination service
- we finally remove the source service and deployment
> The `Configmap`, secrets, variables... are kept.
> The `Configmap`, secrets, variables, and so on, are kept.
It finally computes the `helper` file.

View File

@@ -6,9 +6,9 @@ The main author[^1] of Katenary is a big fan of Podman, Docker and makes a huge
daily work. When he started to work with Kubernetes, he wanted to have the same experience as with Docker Compose.
He wanted to have a tool that could convert his `docker-compose` files to Kubernetes manifests, but also to Helm charts.
Kompose was a good option. But the lacks of some options and configuration for the output Helm chart made him think
about creating a new tool. He wanted to have a tool that could generate a complete Helm chart, with a lot of options
and flexibility.
[Kompose](https://kompose.io/) was a good option. But the lacks of some options and configuration for the output Helm
chart made him think about creating a new tool. He wanted to have a tool that could generate a complete Helm chart,
with a lot of options and flexibility.
[^1]: I'm talking about myself :sunglasses: - Patrice FERLET, aka Metal3d, Tech Lead and DevOps Engineer at Klee Group.
@@ -51,15 +51,6 @@ many indentation levels in the YAML file.
It is also more flexible. You can add or remove labels without changing the others.
## Why not using a configuration file?
The idea was to keep the configuration at a same place, and using the go-compose library to read the labels. It's
easier to have a single file to manage.
By the way, Katenary auto accepts a `compose.katenary.yaml` file in the same directory. It's a way to separate the
configuration from the compose file. It uses
the [overrides' mechanism](https://docs.docker.com/compose/multiple-compose-files/merge/) like "compose" does.
## Why not developing with Rust?
Seriously...
@@ -99,9 +90,6 @@ us by giving us some money, or by giving us some time of your developers, or lea
### If you're an individual
All donators will be listed on the website and in the documentation. You can give us some money by using
the [GitHub Sponsors]()
All main contributors[^3] will be listed on the website and in the documentation.
> If you want to be anonymous, please tell us.

View File

@@ -44,30 +44,52 @@ The main developer is [Patrice FERLET](https://repo.katenary.io/metal3d).
The project source
code is hosted on the [:fontawesome-brands-git: Katenary Repository](https://repo.katenary.io/Katenary/katenary).
## Install Katenary
# Install Katenary
Katenary is developed using the :fontawesome-brands-golang:{ .gopher } [Go](https://go.dev) language.
The binary is statically linked, so you can simply download it from the [release
page](https://github.com/Katenary/katenary/releases) of the project in GitHub.
## Linux / Windows package distribution or setup.exe
The simplest way to install Katenary is to install the package or use Windows installer from the page [packages page](https://repo.katenary.io/Katenary/katenary/packages).
You will find packages and instructions to install the repository for your distribution for :
- RPM (Fedora, Rocky, Alma, OpenSUSE...)
- DEB (Debian, Ubuntu, Mint...)
- Arch Linux (AUR)
- Windows (in the "generic" packages page, use the "setup" file)
!!! Note "Fedora >= 42"
The instruction is not updated for newest version of `dnf`. If the command to add the repository doesn't work, you can
try:
```bash
dnf config-manager addrepo \
--from-repofile https://repo.katenary.io/api/packages/Katenary/rpm.repo
```
As Katenary is developed using the :fontawesome-brands-golang:{ .gopher } [Go](https://go.dev) language the binary is statically
linked, so you can simply download it from the [generic package page](https://repo.katenary.io/Katenary/katenary/packages) and get the version
which is compatible with your operating system and architecture.
You need to select the right binary for your operating system and architecture, and copy the binary in a directory
that is in your `PATH`.
If you are a Linux user, you can use the "one line installation command" which will download the binary in your
## Linux - one line installation command
If you are a Linux user, you can use the "one line installation command" which will download the **binary** in your
`$HOME/.local/bin` directory if it exists.
```bash
sh <(curl -sSL https://repo.katenary.io/Katenary/katenary/raw/branch/master/install.sh)
```
!!! Info "Upgrading is integrated to the `katenary` command"
Katenary propose a `upgrade` sub-command to update the current binary to the latest stable release.
## Compile from sources
Of course, you need to install Katenary once :smile:
You can, of course, compile Katenary from sources.
!!! Note "You prefer to compile it, no need to install Go"
You can also build and install it yourself, the provided Makefile has got a `build` command that uses `podman` or
`docker` to build the binary.
You can also build and install it yourself, the provided Makefile has got a `build` command that uses `podman` or
`docker` to build the binary.
So, you don't need to install Go compiler :+1:.
@@ -107,7 +129,7 @@ source <(katenary completion bash)
Add this line in you `~/.profile`, `~/.bash_aliases` or `~/.bashrc` file to have completion at startup.
## What a name
# What a name
A catenary is the curve that a hanging chain or cable assumes under its own weight when supported only at its ends.
I, the maintainer, decided to name "Katenary" this project because it's like a chain that links a boat to a dock.
@@ -119,7 +141,7 @@ Anyway, it's too late to change the name now :smile:
I spent time to find it :wink:
## Special thanks to
# Special thanks to
I really want to thank all the contributors, testers, and of course, the authors of the packages and tools that are used
in this project. There is too many to list here. Katenary can work because of all these people. Open source is a great
@@ -157,6 +179,6 @@ thing! :heart:
<a href="https://www.mkdocs.org/" target="_blank">MkDocs</a> using <a
href="https://squidfunk.github.io/mkdocs-material/" target="_blank">Material for MkDocs</a> theme template.
## License
# License
Katenary is an open source project under the MIT license. You can use it, modify it, and distribute it as you want.

View File

@@ -6,9 +6,9 @@ While compose labels are string, we can use _here-doc_ syntax using `|` to use Y
```yaml
label-name: |-
# this is actually a multiline string here
key1: value1
key2: value2
# this is actually a multiline string here
key1: value1
key2: value2
```
Katenary will try to _Unmarshal_ these labels.
@@ -52,10 +52,10 @@ service directory.
If it is a directory, all files inside it are added to the ConfigMap.
If the directory as subdirectories, so one configmap per subpath are created.
If the directory as subdirectories, so one ConfigMap per sub-path are created.
!!! Warning
It is not intended to be used to store an entire project in configmaps.
It is not intended to be used to store an entire project in ConfigMaps.
It is intended to be used to store configuration files that are not managed
by the application, like nginx configuration files. Keep in mind that your
project sources should be stored in an application image or in a storage.
@@ -80,6 +80,7 @@ Create a cronjob from the service.
This adds a cronjob to the chart.
The label value is a YAML object with the following attributes:
- command: the command to be executed
- schedule: the cron schedule (cron format or @every where "every" is a
duration like 1h30m, daily, hourly...)
@@ -90,9 +91,9 @@ The label value is a YAML object with the following attributes:
```yaml
labels:
katenary.v3/cronjob: |-
command: echo "hello world"
schedule: "* */1 * * *" # or @hourly for example
katenary.v3/cronjob: |-
command: echo "hello world"
schedule: "* */1 * * *" # or @hourly for example
```
@@ -178,7 +179,7 @@ It adds environment variables from another service to the current service.
service1:
image: nginx:1.19
environment:
FOO: bar
FOO: bar
service2:
image: php:7.4-fpm
@@ -186,7 +187,7 @@ service2:
# get the congigMap from service1 where FOO is
# defined inside this service too
katenary.v3/env-from: |-
- myservice1
- myservice1
```
@@ -207,6 +208,7 @@ This will create:
- a `initContainer` for each definition
Fields:
- name: the name of the volume (manadatory)
- mountPath: the path where the volume is mounted in the pod (optional, default is `/opt`)
- init: a command to run to initialize the volume with data (optional)
@@ -418,7 +420,7 @@ Environment variables to be added to the values.yaml
**Type**: `[]string or map[string]string`
By default, all environment variables in the "env" and environment
files are added to configmaps with the static values set. This label
files are added to ConfigMaps with the static values set. This label
allows adding environment variables to the values.yaml file.
Note that the value inside the configmap is `{{ tpl vaname . }}`, so

View File

@@ -34,18 +34,18 @@ For example. With "labels", you should do:
```yaml
# in compose file
services:
webapp:
image: php:7-apache
ports:
- 8080:80
environment:
DB_HOST: database
labels:
katenary.v3/ingress: |-
hostname: myapp.example.com
port: 8080
katenary.v3/map-env: |-
DB_HOST: "{{ .Release.Name }}-database"
webapp:
image: php:7-apache
ports:
- 8080:80
environment:
DB_HOST: database
labels:
katenary.v3/ingress: |-
hostname: myapp.example.com
port: 8080
katenary.v3/map-env: |-
DB_HOST: "{{ .Release.Name }}-database"
```
Using a Katenary file, you can do:
@@ -53,21 +53,21 @@ Using a Katenary file, you can do:
```yaml
# in compose file, no need to add labels
services:
webapp:
image: php:7-apache
ports:
- 8080:80
environment:
DB_HOST: database
webapp:
image: php:7-apache
ports:
- 8080:80
environment:
DB_HOST: database
# in katenary.yaml
webapp:
ingress:
hostname: myapp.example.com
port: 8080
ingress:
hostname: myapp.example.com
port: 8080
map-env:
DB_HOST: "{{ .Release.Name }}-database"
map-env:
DB_HOST: "{{ .Release.Name }}-database"
```
!!! Warning "YAML in multiline label"
@@ -129,8 +129,9 @@ After having installed `katenary`, the standard usage is to call:
It will search standard compose files in the current directory and try to create a helm chart in "chart" directory.
!!! Info
Katenary uses the compose-go library which respects the Docker and Docker-Compose specification. Keep in mind that
it will find files exactly the same way as `docker-compose` and `podman-compose` do it.
Katenary uses the compose-go library which respects the Docker and Docker-Compose specification. Keep in mind that
it will find files exactly the same way as `docker-compose` and `podman-compose` do it.
Of course, you can provide others files than the default with (cumulative) `-c` options:
@@ -141,7 +142,8 @@ Of course, you can provide others files than the default with (cumulative) `-c`
Katenary proposes a lot of labels to configure the helm chart generation, but some are very important.
!!! Info
For more complete label usage, see [the labels page](labels.md).
For more complete label usage, see [the labels page](labels.md).
### Work with Depends On?
@@ -154,15 +156,15 @@ See this compose file:
version: "3"
services:
webapp:
image: php:8-apache
depends_on:
- database
webapp:
image: php:8-apache
depends_on:
- database
database:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: foobar
database:
image: mariadb
environment:
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
@@ -173,18 +175,18 @@ So, instead of exposing the port in the compose definition, let's declare this t
version: "3"
services:
webapp:
image: php:8-apache
depends_on:
- database
webapp:
image: php:8-apache
depends_on:
- database
database:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: foobar
labels:
katenary.v3/ports: |-
- 3306
database:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: foobar
labels:
katenary.v3/ports: |-
- 3306
```
### Declare ingresses
@@ -196,14 +198,14 @@ Katenary can create this resource for you. You just need to declare the hostname
```yaml
services:
webapp:
image: ...
ports: 8080:5050
labels:
katenary.v3/ingress: |-
# the target port is 5050 wich is the "service" port
port: 5050
hostname: myapp.example.com
webapp:
image: ...
ports: 8080:5050
labels:
katenary.v3/ingress: |-
# the target port is 5050 wich is the "service" port
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
@@ -218,13 +220,13 @@ With a compose file, there is no problem as Docker/Podman allows resolving the n
```yaml
services:
webapp:
image: php:7-apache
environment:
DB_HOST: database
webapp:
image: php:7-apache
environment:
DB_HOST: database
database:
image: mariadb
database:
image: mariadb
```
Katenary prefixes the services with `{{ .Release.Name }}` (to make it possible to install the application several times
@@ -232,16 +234,16 @@ in a namespace), so you need to "remap" the environment variable to the right on
```yaml
services:
webapp:
image: php:7-apache
environment:
DB_HOST: database
labels:
katenary.v3/mapenv: |-
DB_HOST: "{{ .Release.Name }}-database"
webapp:
image: php:7-apache
environment:
DB_HOST: database
labels:
katenary.v3/mapenv: |-
DB_HOST: "{{ .Release.Name }}-database"
database:
image: mariadb
database:
image: mariadb
```
This label can be used to map others environment for any others reason. E.g. to change an informational environment
@@ -249,13 +251,13 @@ variable.
```yaml
services:
webapp:
#...
environment:
RUNNING: docker
labels:
katenary.v3/mapenv: |-
RUNNING: kubernetes
webapp:
#...
environment:
RUNNING: docker
labels:
katenary.v3/mapenv: |-
RUNNING: kubernetes
```
In the above example, `RUNNING` will be set to `kubernetes` when you'll deploy the application with helm, and it's

View File

@@ -1,7 +1,7 @@
'\" t
.\" Automatically generated by Pandoc 3.1.11.1
.\"
.TH "Katenary" "1" "2025-08-21" "mkdocs-manpage v2.0.1" "Katenary helm chart generator"
.TH "Katenary" "1" "2025-08-29" "mkdocs-manpage v2.0.1" "Katenary helm chart generator"
.SH Basic Usage
Basically, you can use \f[CR]katenary\f[R] to transpose a docker\-compose file (or any compose file compatible with \f[CR]podman\-compose\f[R] and \f[CR]docker\-compose\f[R]) to a configurable Helm Chart.
This resulting helm chart can be installed with \f[CR]helm\f[R] command to your Kubernetes cluster.
@@ -38,18 +38,18 @@ With \[dq]labels\[dq], you should do:
.EX
# in compose file
services:
webapp:
image: php:7\-apache
ports:
\- 8080:80
environment:
DB_HOST: database
labels:
katenary.v3/ingress: |\-
hostname: myapp.example.com
port: 8080
katenary.v3/map\-env: |\-
DB_HOST: \[dq]{{ .Release.Name }}\-database\[dq]
webapp:
image: php:7\-apache
ports:
\- 8080:80
environment:
DB_HOST: database
labels:
katenary.v3/ingress: |\-
hostname: myapp.example.com
port: 8080
katenary.v3/map\-env: |\-
DB_HOST: \[dq]{{ .Release.Name }}\-database\[dq]
.EE
.PP
Using a Katenary file, you can do:
@@ -57,21 +57,21 @@ Using a Katenary file, you can do:
.EX
# in compose file, no need to add labels
services:
webapp:
image: php:7\-apache
ports:
\- 8080:80
environment:
DB_HOST: database
webapp:
image: php:7\-apache
ports:
\- 8080:80
environment:
DB_HOST: database
# in katenary.yaml
webapp:
ingress:
hostname: myapp.example.com
port: 8080
ingress:
hostname: myapp.example.com
port: 8080
map\-env:
DB_HOST: \[dq]{{ .Release.Name }}\-database\[dq]
map\-env:
DB_HOST: \[dq]{{ .Release.Name }}\-database\[dq]
.EE
.PP
YAML in multiline label
@@ -162,15 +162,15 @@ See this compose file:
version: \[dq]3\[dq]
services:
webapp:
image: php:8\-apache
depends_on:
\- database
webapp:
image: php:8\-apache
depends_on:
\- database
database:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: foobar
database:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: foobar
.EE
.PP
In this case, \f[CR]webapp\f[R] needs to know the \f[CR]database\f[R] port because the \f[CR]depends_on\f[R] points on it and Kubernetes has not (yet) solution to check the database startup.
@@ -181,18 +181,18 @@ So, instead of exposing the port in the compose definition, let\[aq]s declare th
version: \[dq]3\[dq]
services:
webapp:
image: php:8\-apache
depends_on:
\- database
webapp:
image: php:8\-apache
depends_on:
\- database
database:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: foobar
labels:
katenary.v3/ports: |\-
\- 3306
database:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: foobar
labels:
katenary.v3/ports: |\-
\- 3306
.EE
.SS Declare ingresses
It\[aq]s very common to have an Ingress resource on web application to deploy on Kubernetes.
@@ -203,14 +203,14 @@ You just need to declare the hostname and the port to bind.
.IP
.EX
services:
webapp:
image: ...
ports: 8080:5050
labels:
katenary.v3/ingress: |\-
# the target port is 5050 wich is the \[dq]service\[dq] port
port: 5050
hostname: myapp.example.com
webapp:
image: ...
ports: 8080:5050
labels:
katenary.v3/ingress: |\-
# the target port is 5050 wich is the \[dq]service\[dq] port
port: 5050
hostname: myapp.example.com
.EE
.PP
Note that the port to bind is the one used by the container, not the used locally.
@@ -223,29 +223,29 @@ With a compose file, there is no problem as Docker/Podman allows resolving the n
.IP
.EX
services:
webapp:
image: php:7\-apache
environment:
DB_HOST: database
webapp:
image: php:7\-apache
environment:
DB_HOST: database
database:
image: mariadb
database:
image: mariadb
.EE
.PP
Katenary prefixes the services with \f[CR]{{ .Release.Name }}\f[R] (to make it possible to install the application several times in a namespace), so you need to \[dq]remap\[dq] the environment variable to the right one.
.IP
.EX
services:
webapp:
image: php:7\-apache
environment:
DB_HOST: database
labels:
katenary.v3/mapenv: |\-
DB_HOST: \[dq]{{ .Release.Name }}\-database\[dq]
webapp:
image: php:7\-apache
environment:
DB_HOST: database
labels:
katenary.v3/mapenv: |\-
DB_HOST: \[dq]{{ .Release.Name }}\-database\[dq]
database:
image: mariadb
database:
image: mariadb
.EE
.PP
This label can be used to map others environment for any others reason.
@@ -254,13 +254,13 @@ to change an informational environment variable.
.IP
.EX
services:
webapp:
#...
environment:
RUNNING: docker
labels:
katenary.v3/mapenv: |\-
RUNNING: kubernetes
webapp:
#...
environment:
RUNNING: docker
labels:
katenary.v3/mapenv: |\-
RUNNING: kubernetes
.EE
.PP
In the above example, \f[CR]RUNNING\f[R] will be set to \f[CR]kubernetes\f[R] when you\[aq]ll deploy the application with helm, and it\[aq]s \f[CR]docker\f[R] for \[dq]Podman\[dq] and \[dq]Docker\[dq] executions.
@@ -271,9 +271,9 @@ While compose labels are string, we can use \f[I]here\-doc\f[R] syntax using \f[
.IP
.EX
label\-name: |\-
# this is actually a multiline string here
key1: value1
key2: value2
# this is actually a multiline string here
key1: value1
key2: value2
.EE
.PP
Katenary will try to \f[I]Unmarshal\f[R] these labels.
@@ -445,9 +445,9 @@ The label value is a YAML object with the following attributes: \- command: the
.IP
.EX
labels:
katenary.v3/cronjob: |\-
command: echo \[dq]hello world\[dq]
schedule: \[dq]* */1 * * *\[dq] # or \[at]hourly for example
katenary.v3/cronjob: |\-
command: echo \[dq]hello world\[dq]
schedule: \[dq]* */1 * * *\[dq] # or \[at]hourly for example
.EE
.SS katenary.v3/dependencies
Add Helm dependencies to the service.
@@ -527,7 +527,7 @@ It adds environment variables from another service to the current service.
service1:
image: nginx:1.19
environment:
FOO: bar
FOO: bar
service2:
image: php:7.4\-fpm
@@ -535,7 +535,7 @@ service2:
# get the congigMap from service1 where FOO is
# defined inside this service too
katenary.v3/env\-from: |\-
\- myservice1
\- myservice1
.EE
.SS katenary.v3/exchange\-volumes
Add exchange volumes (empty directory on the node) to share data

View File

@@ -45,7 +45,7 @@
short: "Environment variables to be added to the values.yaml"
long: |-
By default, all environment variables in the "env" and environment
files are added to configmaps with the static values set. This label
files are added to ConfigMaps with the static values set. This label
allows adding environment variables to the values.yaml file.
Note that the value inside the configmap is {{ "{{ tpl vaname . }}" }}, so
@@ -232,10 +232,10 @@
If it is a directory, all files inside it are added to the ConfigMap.
If the directory as subdirectories, so one configmap per subpath are created.
If the directory as subdirectories, so one ConfigMap per sub-path are created.
!!! Warning
It is not intended to be used to store an entire project in configmaps.
It is not intended to be used to store an entire project in ConfigMaps.
It is intended to be used to store configuration files that are not managed
by the application, like nginx configuration files. Keep in mind that your
project sources should be stored in an application image or in a storage.
@@ -253,6 +253,7 @@
This adds a cronjob to the chart.
The label value is a YAML object with the following attributes:
- command: the command to be executed
- schedule: the cron schedule (cron format or @every where "every" is a
duration like 1h30m, daily, hourly...)
@@ -260,9 +261,9 @@
a serviceaccount to make your cronjob able to connect the Kubernetes API
example: |-
labels:
{{ .KatenaryPrefix }}/cronjob: |-
command: echo "hello world"
schedule: "* */1 * * *" # or @hourly for example
{{ .KatenaryPrefix }}/cronjob: |-
command: echo "hello world"
schedule: "* */1 * * *" # or @hourly for example
type: "object"
"env-from":
@@ -274,7 +275,7 @@
service1:
image: nginx:1.19
environment:
FOO: bar
FOO: bar
service2:
image: php:7.4-fpm
@@ -282,7 +283,7 @@
# get the congigMap from service1 where FOO is
# defined inside this service too
{{ .KatenaryPrefix }}/env-from: |-
- myservice1
- myservice1
"exchange-volumes":
short: Add exchange volumes (empty directory on the node) to share data
@@ -299,6 +300,7 @@
- a `initContainer` for each definition
Fields:
- name: the name of the volume (manadatory)
- mountPath: the path where the volume is mounted in the pod (optional, default is `/opt`)
- init: a command to run to initialize the volume with data (optional)