diff --git a/doc/docs/coding.md b/doc/docs/coding.md
index a1e00de..d039527 100644
--- a/doc/docs/coding.md
+++ b/doc/docs/coding.md
@@ -35,14 +35,6 @@ The `generator` package is where object struct are defined, and where the `Gener
The generation is made by using a `HelmChart` object:
```golang
-chart := NewChart(appName string)
-```
-
-Then, some processes are made to detect the "main app verion" (tag for the main service image), bootstrapping declared
-ports in labels, managing links to bind containers in one pods...
-
-Then, a loop basically makes this:
-
```golang
for _, service := range project.Services {
dep := NewDeployment(service)
@@ -52,7 +44,6 @@ for _, service := range project.Services {
Servicename: service.Name,
}
}
-```
**A lot** of string manipulations are made by each `Yaml()` methods. This is where you find the complex and impacting
operations. The `Yaml` methods **don't return a valid YAML content**. This is a Helm Chart Yaml content with template
diff --git a/doc/docs/index.md b/doc/docs/index.md
index 70acac9..4d02118 100644
--- a/doc/docs/index.md
+++ b/doc/docs/index.md
@@ -42,9 +42,7 @@ 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
`$HOME/.local/bin` directory if it exists.
-```bash
sh <(curl -sSL https://raw.githubusercontent.com/metal3d/katenary/master/install.sh)
-```
!!! Info "Upgrading is integrated to the `katenary` command"
Katenary propose a `upgrade` subcommand to update the current binary to the latest stable release.
@@ -61,21 +59,17 @@ sh <(curl -sSL https://raw.githubusercontent.com/metal3d/katenary/master/install
But, note that the "master" branch is not the "stable" version. It's preferable to switch to a tag, or to use the
releases.
-```bash
git clone https://github.com/metal3d/katenary.git
cd katenary
make build
make install
-```
`make install` copies `./katenary` binary to your user binary path (`~/.local/bin`)
You can install it in other directory by changing the `PREFIX` variable. E.g.:
-```bash
make build
sudo make install PREFIX=/usr/local
-```
Check if everything is OK using `katenary version` and / or `katenary help`
@@ -84,10 +78,8 @@ Check if everything is OK using `katenary version` and / or `katenary help`
Katenary uses the very nice project named `cobra` to manage flags, argument and auto-completion.
You can activate it with:
-```bash
# replace "bash" by "zsh" if needed
source <(katenary completion bash)
-```
Add this line in you `~/.profile` or `~/.bashrc` file to have completion at startup.
diff --git a/doc/docs/packages/generator.md b/doc/docs/packages/generator.md
index 82f9db8..fb824ec 100644
--- a/doc/docs/packages/generator.md
+++ b/doc/docs/packages/generator.md
@@ -6,7 +6,7 @@
import "katenary/generator"
```
-The generator package generates kubernetes objects from a compose file and transforms them into a helm chart.
+The generator package generates kubernetes objects from a "compose" file and transforms them into a helm chart.
The generator package is the core of katenary. It is responsible for generating kubernetes objects from a compose file and transforming them into a helm chart. Convertion manipulates Yaml representation of kubernetes object to add conditions, labels, annotations, etc. to the objects. It also create the values to be set to the values.yaml file.
@@ -14,8 +14,6 @@ The generate.Convert\(\) create an HelmChart object and call "Generate\(\)" meth
If you want to change or override the write behavior, you can use the HelmChart.Generate\(\) function and implement your own write function. This function returns the helm chart object containing all kubernetes objects and helm chart ingormation. It does not write the helm chart to the disk.
-TODO: Manage cronjob \+ rbac TODO: create note.txt TODO: manage emptyDirs
-
## Constants
diff --git a/doc/docs/statics/icon.svg b/doc/docs/statics/icon.svg
new file mode 100644
index 0000000..ca35f25
--- /dev/null
+++ b/doc/docs/statics/icon.svg
@@ -0,0 +1,121 @@
+
+
diff --git a/doc/docs/statics/logo-bright.svg b/doc/docs/statics/logo-bright.svg
index f1ef1ff..eb6da22 100644
--- a/doc/docs/statics/logo-bright.svg
+++ b/doc/docs/statics/logo-bright.svg
@@ -1,35 +1,121 @@
-
-
diff --git a/doc/docs/statics/logo-dark.svg b/doc/docs/statics/logo-dark.svg
index 7f3ffa0..eb6da22 100644
--- a/doc/docs/statics/logo-dark.svg
+++ b/doc/docs/statics/logo-dark.svg
@@ -1,35 +1,121 @@
-
-
diff --git a/doc/docs/usage.md b/doc/docs/usage.md
index 715d5f5..1808bdb 100644
--- a/doc/docs/usage.md
+++ b/doc/docs/usage.md
@@ -58,9 +58,7 @@ For more complete label usage, see [the labels page](labels.md).
After having installed `katenary`, the standard usage is to call:
-```bash
katenary convert
-```
It will search standard compose files in the current directory and try to create a helm chart in "chart" directory.
@@ -71,9 +69,7 @@ It will search standard compose files in the current directory and try to create
Of course, you can provide others files than the default with (cummulative) `-c` options:
-```bash
katenary convert -c file1.yaml -c file2.yaml
-```
## Some common labels to use
@@ -90,7 +86,6 @@ to make you able to wait for a service to respond. But you'll probably need to a
See this compose file:
-```yaml
version: "3"
services:
@@ -103,14 +98,12 @@ services:
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
(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:
-```yaml
version: "3"
services:
@@ -126,14 +119,12 @@ services:
labels:
katenary.v3/ports: |-
- 3306
-```
### Declare ingresses
It's very common to have an `Ingress` on web application to deploy on Kuberenetes. The `katenary.io/ingress` declare the
port to bind.
-```yaml
# ...
services:
webapp:
@@ -143,7 +134,6 @@ services:
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.
@@ -156,7 +146,6 @@ example, to connect a PHP application to a database.
With a compose file, there is no problem as Docker/Podman allows to resolve the name by container name:
-```yaml
services:
webapp:
image: php:7-apache
@@ -165,13 +154,11 @@ services:
database:
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.
-```yaml
services:
webapp:
image: php:7-apache
@@ -183,13 +170,11 @@ services:
database:
image: mariadb
-```
This label can be used to map others environment for any others reason. E.g. to change an informational environment
variable.
-```yaml
services:
webapp:
@@ -199,7 +184,6 @@ services:
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
`docker` for "podman" and "docker" executions.
diff --git a/doc/fix.py b/doc/fix.py
new file mode 100644
index 0000000..d9f6b84
--- /dev/null
+++ b/doc/fix.py
@@ -0,0 +1,48 @@
+""" Fix the markdown files to replace code blocs by lists when the code blocs are lists."""
+
+import re
+import sys
+from typing import Tuple
+
+# get markdown bloc code
+re_code = re.compile(r"```(.*?)```", re.DOTALL)
+
+
+def fix(text: str) -> Tuple[str, bool]:
+ """Fix the markdown text to replace code blocs by lists when the code blocs are lists."""
+ # in the text, get the code blocs
+ code_blocs = re_code.findall(text)
+ # for each code bloc, if lines begin by a "-", this is a list. So,
+ # make it a mkdocs list and remove the block code
+ fixed = False
+ for code in code_blocs:
+ lines = code.split("\n")
+ lines = [line.strip() for line in lines if line.strip()]
+ if all(line.startswith("-") for line in lines):
+ fixed = True
+ # make a mkdocs list
+ lines = [f"- {line[1:]}" for line in lines]
+ # replace the code bloc by the list
+ text = text.replace(f"```{code}```", "\n".join(lines))
+ return text, fixed
+
+
+def main(filename: str):
+ """Fix and rewrite the markdown file."""
+ with open(filename, "r", encoding="utf-8") as f:
+ text = f.read()
+ content, fixed = fix(text)
+
+ if not fixed:
+ return
+
+ with open(sys.argv[1], "w", encoding="utf-8") as f:
+ f.write(content)
+
+
+if __name__ == "__main__":
+ if len(sys.argv) != 2:
+ print("Usage: python fix.py ")
+ sys.exit(1)
+
+ main(sys.argv[1])
diff --git a/doc/mkdocs.yml b/doc/mkdocs.yml
index 3c7a813..475c4a5 100644
--- a/doc/mkdocs.yml
+++ b/doc/mkdocs.yml
@@ -3,7 +3,8 @@ docs_dir: ./docs
theme:
name: material
custom_dir: overrides
- logo: statics/logo-dark.svg
+ logo: statics/logo-bright.svg
+ favicon: statics/icon.svg
palette:
- scheme: slate
toggle:
@@ -28,7 +29,7 @@ extra_css:
- statics/main.css
extra_javascript:
- statics/addons.js
-copyright: Copyright © 2021 - 2023 - Katenary authors
+copyright: Copyright © 2021 - 2024 - Katenary authors
extra:
generator: false
social:
diff --git a/generator/doc.go b/generator/doc.go
index 095c2e7..333ac56 100644
--- a/generator/doc.go
+++ b/generator/doc.go
@@ -1,5 +1,5 @@
/*
-The generator package generates kubernetes objects from a compose file and transforms them into a helm chart.
+The generator package generates kubernetes objects from a "compose" file and transforms them into a helm chart.
The generator package is the core of katenary. It is responsible for generating kubernetes objects from a compose file and transforming them into a helm chart.
Convertion manipulates Yaml representation of kubernetes object to add conditions, labels, annotations, etc. to the objects. It also create the values to be set to
@@ -10,9 +10,5 @@ It saves the helm chart in the given directory.
If you want to change or override the write behavior, you can use the HelmChart.Generate() function and implement your own write function. This function returns
the helm chart object containing all kubernetes objects and helm chart ingormation. It does not write the helm chart to the disk.
-
-TODO: Manage cronjob + rbac
-TODO: create note.txt
-TODO: manage emptyDirs
*/
package generator