Skip to content

Commit e8eba7c

Browse files
committed
Enhance documentation
- upgraded mkdocs and dependencise (+ add mermaid) - linted markdown - add more details
1 parent 7f0597e commit e8eba7c

12 files changed

+227
-183
lines changed

doc/docs/coding.md

+31-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Katenary is developed in Go. The version currently supported is 1.20. For reason
99
preferred to `interface{}`.
1010

1111
Since version v3, Katenary uses, in addition to `go-compose`, the `k8s` library to generate objects that are guaranteed
12-
to work before transformation. Katenary adds Helm syntax entries to add loops, transformations and conditions.
12+
to work before transformation. Katenary adds Helm syntax entries to add loops, transformations, and conditions.
1313

1414
We really try to follow best practices and code principles. But, Katenary needs a lot of workarounds and string
1515
manipulation during the process. There are, also, some drawbacks using standard k8s packages that makes a lot of type
@@ -25,6 +25,35 @@ During conversion, the `generator` package is primarily responsible for creating
2525
one `Deployment` per `compose` service. If the container coming from "compose" exposes ports (explicitly), then a
2626
service is created.
2727

28+
```mermaid
29+
flowchart TD
30+
31+
D[Deployment]:::outputs@{shape: curv-trap}
32+
C[Container List]@{shape: docs}
33+
ConfigMap:::outputs@{shape: curv-trap}
34+
Secrets:::outputs@{shape: curv-trap}
35+
H[Helm Chart.yaml file]:::outputs@{shape: curv-trap}
36+
Val[Values files]:::outputs@{shape: curv-trap}
37+
PVC:::outputs@{shape: curv-trap}
38+
S[Service]:::outputs@{shape: curv-trap}
39+
40+
A[Compose file]:::inputs --> B[Compose parser]
41+
B --> G[Generator]
42+
G --> P[Ports exposed to services] ---> S
43+
G ------> H
44+
G --> C --> D
45+
G ------> Val
46+
G ....-> M[Merge Continainers if same-pod]
47+
M ..-> C
48+
G --> E[Environment variables] ----> Secrets & ConfigMap
49+
G--> V[Bind volumes] -------> PVC
50+
V -----> CF[ Create ConfigMap\nfor static files as\nconfigmap-files] --> ConfigMap
51+
52+
Secrets & ConfigMap -- create envFrom --> D
53+
V -- bind volumes --> D
54+
55+
```
56+
2857
If the declaration of a container is to be integrated into another pod (via the `same-pod` label), this `Deployment` and
2958
its associated service are still created. They are deleted last, once the merge has been completed.
3059

@@ -34,7 +63,6 @@ The `generator` package is where object struct are defined, and where the `Gener
3463

3564
The generation is made by using a `HelmChart` object:
3665

37-
```golang
3866
```golang
3967
for _, service := range project.Services {
4068
dep := NewDeployment(service)
@@ -44,6 +72,7 @@ for _, service := range project.Services {
4472
Servicename: service.Name,
4573
}
4674
}
75+
```
4776

4877
**A lot** of string manipulations are made by each `Yaml()` methods. This is where you find the complex and impacting
4978
operations. The `Yaml` methods **don't return a valid YAML content**. This is a Helm Chart Yaml content with template

doc/docs/dependencies.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22

33
Katenary uses `compose-go` and several kubernetes official packages.
44

5-
- `github.com/compose-spec/compose-go`: to parse compose files. It ensures that:
6-
- the project respects the "compose" specification
7-
- katenary uses the "compose" struct exactly the same way that podman-compose or docker does
5+
- `github.com/compose-spec/compose-go`: to parse compose files. It ensures :
6+
- that the project respects the "compose" specification
7+
- that Katenary uses the "compose" struct exactly the same way `podman compose` or `docker copose` does
88
- `github.com/spf13/cobra`: to parse command line arguments, subcommands and flags. It also generates completion for
9-
bash, zsh, fish and powershell.
9+
bash, zsh, fish and PowerShell.
1010
- `github.com/thediveo/netdb`: to get the standard names of a service from its port number
1111
- `gopkg.in/yaml.v3`:
1212
- to generate `Chart.yaml` and `values.yaml` files (only)
1313
- to parse Katenary labels in the compose file
1414
- `k8s.io/api` and `k8s.io/apimachinery` to create Kubernetes objects
15-
- `sigs.k8s.io/yaml`: to generate Katenary yaml files
15+
- `sigs.k8s.io/yaml`: to generate Katenary YAML files in the format of Kubernetes objects
1616

17+
There are also some other packages used in the project, like `gopkg.in/yaml` to parse labels. I'm sorry to not list the
18+
entire dependencies. You can check the `go.mod` file to see all the dependencies.

doc/docs/faq.md

+50-28
Original file line numberDiff line numberDiff line change
@@ -2,86 +2,108 @@
22

33
## Why Katenary?
44

5-
The main author[^1] of Katenary is a big fan of Podman, Docker and makes a huge use of Compose. He uses it a lot in his 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.
5+
The main author[^1] of Katenary is a big fan of Podman, Docker and makes a huge use of Compose. He uses it a lot in his
6+
daily work. When he started to work with Kubernetes, he wanted to have the same experience as with Docker Compose.
7+
He wanted to have a tool that could convert his `docker-compose` files to Kubernetes manifests, but also to Helm charts.
68

7-
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.
9+
Kompose was a good option. But the lacks of some options and configuration for the output Helm chart made him think
10+
about creating a new tool. He wanted to have a tool that could generate a complete Helm chart, with a lot of options
11+
and flexibility.
812

9-
[^1]: I'm talking about myself :sunglasses: - Patrice FERLET, aka metal3d, Tech Lead and DevOps Engineer at Klee Group.
13+
[^1]: I'm talking about myself :sunglasses: - Patrice FERLET, aka Metal3d, Tech Lead and DevOps Engineer at Klee Group.
1014

1115
## What's the difference between Katenary and Kompose?
1216

13-
[Kompose](https://kompose.io/) is a very nice tool, made by the Kubernetes community. It's a tool to convert `docker-compose` files to Kubernetes manifests. It's a very good tool, and it's more mature than Katenary.
17+
[Kompose](https://kompose.io/) is a very nice tool, made by the Kubernetes community. It's a tool to convert
18+
`docker-compose` files to Kubernetes manifests. It's a very good tool, and it's more mature than Katenary.
1419

15-
Kompose is able to genererate Helm charts, but [it could be not the case in future releases](https://github.com/kubernetes/kompose/issues/1716) for several reasons[^2].
20+
Kompose is able to generate Helm charts, but [it could be not the case in future releases](https://github.com/kubernetes/kompose/issues/1716) for several reasons[^2].
1621

17-
[^2]: The author of Kompose explains that they have no bandwidth to maintain the Helm chart generation. It's a complex task, and we can confirm. Katenary takes a lot of time to be developed and maintained. This issue mentions Katenary as an alternative to Helm chart generation :smile:
22+
[^2]: The author of Kompose explains that they have no bandwidth to maintain the Helm chart generation. It's a complex
23+
task, and we can confirm. Katenary takes a lot of time to be developed and maintained. This issue mentions Katenary as
24+
an alternative to Helm chart generation :smile:
1825

19-
The project is focused on Kubernetes manifests and proposes to use "kusomize" to adapt the manifests. Helm seems to be not the priority.
26+
The project is focused on Kubernetes manifests and proposes to use "kusomize" to adapt the manifests. Helm seems to be
27+
not the priority.
2028

21-
Anyway, before this decision, the Helm chart generation was not what we expected. We wanted to have a more complete chart, with more options and more flexibility.
29+
Anyway, before this decision, the Helm chart generation was not what we expected. We wanted to have a more complete
30+
chart, with more options and more flexibility.
2231

2332
> That's why we decided to create Katenary.
2433
25-
Kompose didn't manage to generate a values file, complexe volume binding, and many other things. It was also not able to manage dependencies between services.
34+
Kompose didn't manage to generate a values file, complex volume binding, and many other things. It was also not able
35+
to manage dependencies between services.
2636

2737
> Be sure that we don't want to compete with Kompose. We just want to propose a different approach to the problem.
2838
29-
Kompose is an excellent tool, and we use it in some projects. It's a good choice if you want to convert your `docker-compose` files to Kubernetes manifests, but if you want to use Helm, Katenary is the tool you need.
39+
Kompose is an excellent tool, and we use it in some projects. It's a good choice if you want to convert
40+
your `docker-compose` files to Kubernetes manifests, but if you want to use Helm, Katenary is the tool you need.
3041

3142
## Why not using "one label" for all the configuration?
3243

33-
That was a dicsussion I had with my colleagues. The idea was to use a single label to store all the configuration. But, it's not a good idea.
44+
That was a dicsussion I had with my colleagues. The idea was to use a single label to store all the configuration.
45+
But, it's not a good idea.
3446

35-
Sometimes, you will have a long list of things to configure, like ports, ingress, dependecies, etc. It's better to have a clear and readable configuration. Segmented labels are easier to read and to maintain. It also avoids to have too many indentation levels in the YAML file.
47+
Sometimes, you will have a long list of things to configure, like ports, ingress, dependencies, etc. It's better to have
48+
a clear and readable configuration. Segmented labels are easier to read and to maintain. It also avoids having too
49+
many indentation levels in the YAML file.
3650

3751
It is also more flexible. You can add or remove labels without changing the others.
3852

3953
## Why not using a configuration file?
4054

41-
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.
55+
The idea was to keep the configuration at a same place, and using the go-compose library to read the labels. It's
56+
easier to have a single file to manage.
4257

43-
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 mecanism](https://docs.docker.com/compose/multiple-compose-files/merge/) like "compose" does.
58+
By the way, Katenary auto accepts a `compose.katenary.yaml` file in the same directory. It's a way to separate the
59+
configuration from the compose file. It uses
60+
the [overrides' mechanism](https://docs.docker.com/compose/multiple-compose-files/merge/) like "compose" does.
4461

45-
46-
## Why not developping with Rust?
62+
## Why not developing with Rust?
4763

4864
Seriously...
4965

5066
OK, I will answer.
5167

52-
Rust is a good language. But, Podman, Docker, Kubernetes, Helm, and mostly all technologies around Kubernetes are written in Go. We have a large ecosystem in Go to manipulate, read, and write Kubernetes manifests as parsing Compose files.
68+
Rust is a good language. But, Podman, Docker, Kubernetes, Helm, and mostly all technologies around Kubernetes are
69+
written in Go. We have a large ecosystem in Go to manipulate, read, and write Kubernetes manifests as parsing
70+
Compose files.
5371

54-
Go is better for this task.
72+
> Go is better for this task.
5573
5674
There is no reason to use Rust for this project.
5775

5876
## Any chance to have a GUI?
5977

60-
Yes, it's a possibility. But, it's not a priority. We have a lot of things to do before. We need to stabilize the project, to have a good documentation, to have a good test coverage, and to have a good community.
78+
Yes, it's a possibility. But, it's not a priority. We have a lot of things to do before. We need to stabilize the
79+
project, to have a good documentation, to have a good test coverage, and to have a good community.
6180

6281
But, in a not so far future, we could have a GUI. The choice of [Fyne.io](https://fyne.io) is already made and we tested some concepts.
6382

64-
6583
## I'm rich (or not), I want to help you. How can I do?
6684

6785
You can help us in many ways.
6886

69-
- The first things we really need, more than money, more than anything else, is to have feedback. If you use Katenary, if you have some issues, if you have some ideas, please open an issue on the [GitHub repository](https://github.com/metal3d/katenary).
70-
- The second things is to help us to fix issues. If you're a Go developper, or if you want to fix the documentation, your help is greatly appreciated.
87+
- The first things we really need, more than money, more than anything else, is to have feedback. If you use Katenary,
88+
if you have some issues, if you have some ideas, please open an issue on the [GitHub repository](https://github.com/metal3d/katenary).
89+
- The second things is to help us to fix issues. If you're a Go developper, or if you want to fix the documentation,
90+
your help is greatly appreciated.
7191
- And then, of course, we need money, or sponsors.
7292

7393
### If you're a company
7494

75-
We will be happy to communicate your help by putting your logo on the website and in the documentaiton. You can sponsor us by giving us some money, or by giving us some time of your developers, or leaving us some time to work on the project.
95+
We will be happy to communicate your help by putting your logo on the website and in the documentaiton. You can sponsor
96+
us by giving us some money, or by giving us some time of your developers, or leaving us some time to work on the project.
7697

7798
### If you're an individual
7899

79-
All donators will be listed on the website and in the documentation. You can give us some money by using the [GitHub Sponsors]()
100+
All donators will be listed on the website and in the documentation. You can give us some money by using
101+
the [GitHub Sponsors]()
80102

81-
All main contributors[^3] will be listed on the website and in the documentation.
103+
All main contributors[^3] will be listed on the website and in the documentation.
82104

83105
> If you want to be anonymous, please tell us.
84106
85-
86-
[^3]: Main contributors are the people who have made a significant contribution to the project. It could be code, documentation, or any other help. There is no defined rules, at this time, to evaluate the contribution. It's a subjective decision.
87-
107+
[^3]: Main contributors are the people who have made a significant contribution to the project. It could be code,
108+
documentation, or any other help. There is no defined rules, at this time, to evaluate the contribution.
109+
It's a subjective decision.

doc/docs/index.md

+13-17
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
🚀 Unleash Productivity with Katenary! 🚀
88

9-
Tired of manual conversions? Katenary harnesses the labels from your "compose" file to craft complete Helm Charts
9+
Tired of manual conversions? Katenary harnesses the labels from your "compose" file to craft complete Helm Charts
1010
effortlessly, saving you time and energy.
1111

12-
🛠️ Simple autmated CLI: Katenary handles the grunt work, generating everything needed for seamless service binding
12+
🛠️ Simple autmated CLI: Katenary handles the grunt work, generating everything needed for seamless service binding
1313
and Helm Chart creation.
1414

1515
💡 Effortless Efficiency: You only need to add labels when it's necessary to precise things. Then call `katenary convert`
@@ -19,13 +19,12 @@ and let the magic happen.
1919
![](statics/workflow.svg)
2020
</div>
2121

22-
2322
# What is it?
2423

2524
Katenary is a tool made to help you to transform "compose" files (`compose.yaml`, `docker-compose.yml`, `podman-compose.yml`...) to
2625
complete and production ready [Helm Chart](https://helm.sh).
2726

28-
You'll be able to deploy your project in [:material-kubernetes: Kubernetes](https://kubernetes.io) in a few seconds
27+
You'll be able to deploy your project in [:material-kubernetes: Kubernetes](https://kubernetes.io) in a few seconds
2928
(of course, more if you need to tweak with labels).
3029

3130
It uses your current file and optionnaly labels to configure the result.
@@ -42,19 +41,19 @@ share it with the community.
4241

4342
The main developer is [Patrice FERLET](https://github.com/metal3d).
4443

45-
The project source
44+
The project source
4645
code is hosted on the [:fontawesome-brands-github: Katenary GitHub Repository](https://github.com/metal3d/katenary).
4746

4847
## Install Katenary
4948

50-
Katenary is developped using the :fontawesome-brands-golang:{ .gopher } [Go](https://go.dev) language.
49+
Katenary is developped using the :fontawesome-brands-golang:{ .gopher } [Go](https://go.dev) language.
5150
The binary is statically linked, so you can simply download it from the [release
5251
page](https://github.com/metal3d/katenary/releases) of the project in GutHub.
5352

54-
You need to select the right binary for your operating system and architecture, and copy the binary in a directory
53+
You need to select the right binary for your operating system and architecture, and copy the binary in a directory
5554
that is in your `PATH`.
5655

57-
If you are a Linux user, you can use the "one line installation command" which will download the binary in your
56+
If you are a Linux user, you can use the "one line installation command" which will download the binary in your
5857
`$HOME/.local/bin` directory if it exists.
5958

6059
```bash
@@ -66,10 +65,9 @@ sh <(curl -sSL https://raw.githubusercontent.com/metal3d/katenary/master/install
6665

6766
Of course, you need to install Katenary once :smile:
6867

69-
7068
!!! Note "You prefer to compile it, no need to install Go"
71-
You can also build and install it yourself, the provided Makefile has got a `build` command that uses `podman` or
72-
`docker` to build the binary.
69+
You can also build and install it yourself, the provided Makefile has got a `build` command that uses `podman` or
70+
`docker` to build the binary.
7371

7472
So, you don't need to install Go compiler :+1:.
7573

@@ -85,7 +83,7 @@ make build
8583
make install
8684
```
8785

88-
`make install` copies `./katenary` binary to your user binary path (`~/.local/bin`)
86+
`make install` copies `./katenary` binary to your user binary path (`~/.local/bin`)
8987

9088
You can install it in other directory by changing the `PREFIX` variable. E.g.:
9189

@@ -109,8 +107,7 @@ source <(katenary completion bash)
109107

110108
Add this line in you `~/.profile`, `~/.bash_aliases` or `~/.bashrc` file to have completion at startup.
111109

112-
113-
## What a name...
110+
## What a name
114111

115112
A catenary is the curve that a hanging chain or cable assumes under its own weight when supported only at its ends.
116113
I, the maintainer, decided to name "Katenary" this project because it's like a chain that links a boat to a dock.
@@ -122,14 +119,13 @@ Anyway, it's too late to change the name now :smile:
122119

123120
I spent time to find it :wink:
124121

125-
## Special thanks to...
122+
## Special thanks to
126123

127124
I really want to thank all the contributors, testers, and of course, the authors of the packages and tools that are used
128125
in this project. There is too many to list here. Katenary can works because of all these people. Open source is a great
129126
thing! :heart:
130127

131-
132-
!!! Edit "Special thanks"
128+
!!! Edit "Special thanks"
133129

134130
**Katenary is built with:** <br />
135131

0 commit comments

Comments
 (0)