From d94bb8ac32c3bd79a417dfaef36c84e60ecc3bab Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Wed, 4 Jun 2025 15:18:11 +0200 Subject: [PATCH] feat(doc): regenerate documentation --- doc/docs/.markdownlint.yaml | 5 ++ doc/docs/labels.md | 72 +++++++++------------ doc/docs/packages/generator.md | 51 ++++++++------- doc/docs/packages/generator/extrafiles.md | 2 +- doc/docs/packages/generator/katenaryfile.md | 2 +- doc/docs/packages/generator/labels.md | 14 ++-- doc/docs/packages/update.md | 60 ----------------- doc/docs/packages/utils.md | 8 +-- doc/mkdocs.yml | 1 - 9 files changed, 73 insertions(+), 142 deletions(-) create mode 100644 doc/docs/.markdownlint.yaml delete mode 100644 doc/docs/packages/update.md diff --git a/doc/docs/.markdownlint.yaml b/doc/docs/.markdownlint.yaml new file mode 100644 index 0000000..f6df9d2 --- /dev/null +++ b/doc/docs/.markdownlint.yaml @@ -0,0 +1,5 @@ +MD012: false +MD013: false +MD022: false +MD033: false +MD046: false diff --git a/doc/docs/labels.md b/doc/docs/labels.md index 637db16..e70fefb 100644 --- a/doc/docs/labels.md +++ b/doc/docs/labels.md @@ -37,8 +37,8 @@ Add files to the configmap. **Type**: `[]string` -It makes a file or directory to be converted to one or more ConfigMaps -and mounted in the pod. The file or directory is relative to the +It makes a file or directory to be converted to one or more ConfigMaps +and mounted in the pod. The file or directory is relative to the service directory. If it is a directory, all files inside it are added to the ConfigMap. @@ -47,7 +47,7 @@ If the directory as subdirectories, so one configmap per subpath are created. !!! Warning 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 + 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. @@ -61,7 +61,6 @@ labels: - ./conf.d ``` - ### katenary.v3/cronjob Create a cronjob from the service. @@ -71,8 +70,9 @@ 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 + +- command: the command to be executed +- schedule: the cron schedule (cron format or @every where "every" is a duration like 1h30m, daily, hourly...) - rbac: false (optionnal), if true, it will create a role, a rolebinding and a serviceaccount to make your cronjob able to connect the Kubernetes API @@ -86,15 +86,14 @@ labels: schedule: "* */1 * * *" # or @hourly for example ``` - ### katenary.v3/dependencies Add Helm dependencies to the service. **Type**: `[]object` -Set the service to be, actually, a Helm dependency. This means that the -service will not be exported as template. The dependencies are added to +Set the service to be, actually, a Helm dependency. This means that the +service will not be exported as template. The dependencies are added to the Chart.yaml file and the values are added to the values.yaml file. It's a list of objects with the following attributes: @@ -106,12 +105,12 @@ It's a list of objects with the following attributes: !!! Info Katenary doesn't update the helm depenedencies by default. - + Use `--helm-update` (or `-u`) flag to update the dependencies. example: katenary convert -u -By setting an alias, it is possible to change the name of the dependency +By setting an alias, it is possible to change the name of the dependency in values.yaml. **Example:** @@ -133,14 +132,13 @@ labels: password: the secret password ``` - ### katenary.v3/description Description of the service **Type**: `string` -This replaces the default comment in values.yaml file to the given description. +This replaces the default comment in values.yaml file to the given description. It is useful to document the service and configuration. The value can be set with a documentation in multiline format. @@ -154,7 +152,6 @@ labels: It can be multiline. ``` - ### katenary.v3/env-from Add environment variables from antoher service. @@ -180,14 +177,13 @@ service2: - myservice1 ``` - ### katenary.v3/exchange-volumes Add exchange volumes (empty directory on the node) to share data **Type**: `[]object` -This label allows sharing data between containres. The volume is created in +This label allows sharing data between containres. The volume is created in the node and mounted in the pod. It is useful to share data between containers in a "same pod" logic. For example to let PHP-FPM and Nginx share the same direcotory. @@ -198,9 +194,10 @@ 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) + +- 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) !!! Warning This is highly experimental. This is mainly useful when using the "same-pod" label. @@ -223,7 +220,6 @@ php: init: cp -ra /var/www/html/* /opt ``` - ### katenary.v3/health-check Health check to be added to the deployment. @@ -243,7 +239,6 @@ labels: port: 8080 ``` - ### katenary.v3/ignore Ignore the service @@ -259,14 +254,13 @@ labels: katenary.v3/ignore: "true" ``` - ### katenary.v3/ingress Ingress rules to be added to the service. **Type**: `object` -Declare an ingress rule for the service. The port should be exposed or +Declare an ingress rule for the service. The port should be exposed or declared with `katenary.v3/ports`. **Example:** @@ -278,14 +272,13 @@ labels: hostname: mywebsite.com (optional) ``` - ### katenary.v3/main-app Mark the service as the main app. **Type**: `bool` -This makes the service to be the main application. Its image tag is +This makes the service to be the main application. Its image tag is considered to be the Chart appVersion and to be the defaultvalue in Pod container image attribute. @@ -305,7 +298,6 @@ ghost: katenary.v3/main-app: true ``` - ### katenary.v3/map-env Map env vars from the service to the deployment. @@ -313,8 +305,8 @@ Map env vars from the service to the deployment. **Type**: `map[string]string` Because you may need to change the variable for Kubernetes, this label -forces the value to another. It is also particullary helpful to use a template -value instead. For example, you could bind the value to a service name +forces the value to another. It is also particullary helpful to use a template +value instead. For example, you could bind the value to a service name with Helm attributes: `{{ tpl .Release.Name . }}`. @@ -333,14 +325,13 @@ labels: DB_HOST: '{{ include "__APP__.fullname" . }}-database' ``` - ### katenary.v3/ports Ports to be added to the service. **Type**: `[]uint32` -Only useful for services without exposed port. It is mandatory if the +Only useful for services without exposed port. It is mandatory if the service is a dependency of another service. **Example:** @@ -352,17 +343,16 @@ labels: - 8081 ``` - ### katenary.v3/same-pod Move the same-pod deployment to the target deployment. **Type**: `string` -This will make the service to be included in another service pod. Some services +This will make the service to be included in another service pod. Some services must work together in the same pod, like a sidecar or a proxy or nginx + php-fpm. -Note that volume and VolumeMount are copied from the source to the target +Note that volume and VolumeMount are copied from the source to the target deployment. **Example:** @@ -377,14 +367,13 @@ php: katenary.v3/same-pod: web ``` - ### katenary.v3/secrets Env vars to be set as secrets. **Type**: `[]string` -This label allows setting the environment variables as secrets. The variable +This label allows setting the environment variables as secrets. The variable is removed from the environment and added to a secret object. The variable can be set to the `katenary.v3/values` too, @@ -401,7 +390,6 @@ labels: - PASSWORD ``` - ### katenary.v3/values Environment variables to be added to the values.yaml @@ -412,11 +400,11 @@ By default, all environment variables in the "env" and environment 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 -you can set the value to a template that will be rendered with the +Note that the value inside the configmap is `{{ tpl vaname . }}`, so +you can set the value to a template that will be rendered with the values.yaml file. -The value can be set with a documentation. This may help to understand +The value can be set with a documentation. This may help to understand the purpose of the variable. **Example:** @@ -438,7 +426,6 @@ labels: It can be, of course, a multiline text. ``` - ### katenary.v3/values-from Add values from another service. @@ -460,9 +447,9 @@ database: MARIADB_USER: myuser MARIADB_PASSWORD: mypassword labels: - # it can be a secret + # we can declare secrets katenary.v3/secrets: |- - - DB_PASSWORD + - MARIADB_PASSWORD php: image: php:7.4-fpm environment: @@ -476,5 +463,4 @@ php: DB_PASSWORD: database.MARIADB_PASSWORD ``` - diff --git a/doc/docs/packages/generator.md b/doc/docs/packages/generator.md index 1e681b2..0283f52 100644 --- a/doc/docs/packages/generator.md +++ b/doc/docs/packages/generator.md @@ -35,7 +35,7 @@ var Version = "master" // changed at compile time ``` -## func [Convert]() +## func [Convert]() ```go func Convert(config ConvertOptions, dockerComposeFile ...string) error @@ -92,7 +92,7 @@ NewCronJob creates a new CronJob from a compose service. The appName is the name ## func [ToK8SYaml]() ```go -func ToK8SYaml(obj interface{}) ([]byte, error) +func ToK8SYaml(obj any) ([]byte, error) ``` @@ -149,7 +149,7 @@ func NewConfigMapFromDirectory(service types.ServiceConfig, appName, path string NewConfigMapFromDirectory creates a new ConfigMap from a compose service. This path is the path to the file or directory. If the path is a directory, all files in the directory are added to the ConfigMap. Each subdirectory are ignored. Note that the Generate\(\) function will create the subdirectories ConfigMaps. -### func \(\*ConfigMap\) [AddBinaryData]() +### func \(\*ConfigMap\) [AddBinaryData]() ```go func (c *ConfigMap) AddBinaryData(key string, value []byte) @@ -158,7 +158,7 @@ func (c *ConfigMap) AddBinaryData(key string, value []byte) AddBinaryData adds binary data to the configmap. Append or overwrite the value if the key already exists. -### func \(\*ConfigMap\) [AddData]() +### func \(\*ConfigMap\) [AddData]() ```go func (c *ConfigMap) AddData(key, value string) @@ -167,7 +167,7 @@ func (c *ConfigMap) AddData(key, value string) AddData adds a key value pair to the configmap. Append or overwrite the value if the key already exists. -### func \(\*ConfigMap\) [AppendDir]() +### func \(\*ConfigMap\) [AppendDir]() ```go func (c *ConfigMap) AppendDir(path string) error @@ -176,7 +176,7 @@ func (c *ConfigMap) AppendDir(path string) error AddFile adds files from given path to the configmap. It is not recursive, to add all files in a directory, you need to call this function for each subdirectory. -### func \(\*ConfigMap\) [AppendFile]() +### func \(\*ConfigMap\) [AppendFile]() ```go func (c *ConfigMap) AppendFile(path string) error @@ -185,7 +185,7 @@ func (c *ConfigMap) AppendFile(path string) error -### func \(\*ConfigMap\) [Filename]() +### func \(\*ConfigMap\) [Filename]() ```go func (c *ConfigMap) Filename() string @@ -194,7 +194,7 @@ func (c *ConfigMap) Filename() string Filename returns the filename of the configmap. If the configmap is used for files, the filename contains the path. -### func \(\*ConfigMap\) [SetData]() +### func \(\*ConfigMap\) [SetData]() ```go func (c *ConfigMap) SetData(data map[string]string) @@ -203,7 +203,7 @@ func (c *ConfigMap) SetData(data map[string]string) SetData sets the data of the configmap. It replaces the entire data. -### func \(\*ConfigMap\) [Yaml]() +### func \(\*ConfigMap\) [Yaml]() ```go func (c *ConfigMap) Yaml() ([]byte, error) @@ -275,7 +275,7 @@ Yaml returns the yaml representation of the cronjob. Implements the Yaml interface. -## type [CronJobValue]() +## type [CronJobValue]() CronJobValue is a cronjob configuration that will be saved in values.yaml. @@ -376,7 +376,7 @@ func (d *Deployment) BindFrom(service types.ServiceConfig, binded *Deployment) -### func \(\*Deployment\) [BindMapFilesToContainer]() +### func \(\*Deployment\) [BindMapFilesToContainer]() ```go func (d *Deployment) BindMapFilesToContainer(service types.ServiceConfig, secrets []string, appName string) (*corev1.Container, int) @@ -403,7 +403,7 @@ func (d *Deployment) Filename() string Filename returns the filename of the deployment. -### func \(\*Deployment\) [MountExchangeVolumes]() +### func \(\*Deployment\) [MountExchangeVolumes]() ```go func (d *Deployment) MountExchangeVolumes() @@ -421,7 +421,7 @@ func (d *Deployment) SetEnvFrom(service types.ServiceConfig, appName string, sam SetEnvFrom sets the environment variables to a configmap. The configmap is created. -### func \(\*Deployment\) [Yaml]() +### func \(\*Deployment\) [Yaml]() ```go func (d *Deployment) Yaml() ([]byte, error) @@ -471,7 +471,7 @@ type HelmChart struct { ``` -### func [Generate]() +### func [Generate]() ```go func Generate(project *types.Project) (*HelmChart, error) @@ -509,7 +509,7 @@ func (chart *HelmChart) SaveTemplates(templateDir string) SaveTemplates the templates of the chart to the given directory. -## type [Ingress]() +## type [Ingress]() @@ -521,7 +521,7 @@ type Ingress struct { ``` -### func [NewIngress]() +### func [NewIngress]() ```go func NewIngress(service types.ServiceConfig, Chart *HelmChart) *Ingress @@ -530,7 +530,7 @@ func NewIngress(service types.ServiceConfig, Chart *HelmChart) *Ingress NewIngress creates a new Ingress from a compose service. -### func \(\*Ingress\) [Filename]() +### func \(\*Ingress\) [Filename]() ```go func (ingress *Ingress) Filename() string @@ -539,7 +539,7 @@ func (ingress *Ingress) Filename() string -### func \(\*Ingress\) [Yaml]() +### func \(\*Ingress\) [Yaml]() ```go func (ingress *Ingress) Yaml() ([]byte, error) @@ -548,7 +548,7 @@ func (ingress *Ingress) Yaml() ([]byte, error) -## type [IngressValue]() +## type [IngressValue]() IngressValue is a ingress configuration that will be saved in values.yaml. @@ -809,18 +809,19 @@ func (r *ServiceAccount) Yaml() ([]byte, error) -## type [TLS]() +## type [TLS]() ```go type TLS struct { - Enabled bool `yaml:"enabled"` + Enabled bool `yaml:"enabled"` + SecretName string `yaml:"secretName"` } ``` -## type [Value]() +## type [Value]() Value will be saved in values.yaml. It contains configuration for all deployment and services. @@ -840,7 +841,7 @@ type Value struct { ``` -### func [NewValue]() +### func [NewValue]() ```go func NewValue(service types.ServiceConfig, main ...bool) *Value @@ -851,7 +852,7 @@ NewValue creates a new Value from a compose service. The value contains the nece If \`main\` is true, the tag will be empty because it will be set in the helm chart appVersion. -### func \(\*Value\) [AddIngress]() +### func \(\*Value\) [AddIngress]() ```go func (v *Value) AddIngress(host, path string) @@ -860,7 +861,7 @@ func (v *Value) AddIngress(host, path string) -### func \(\*Value\) [AddPersistence]() +### func \(\*Value\) [AddPersistence]() ```go func (v *Value) AddPersistence(volumeName string) diff --git a/doc/docs/packages/generator/extrafiles.md b/doc/docs/packages/generator/extrafiles.md index cb56223..5c59366 100644 --- a/doc/docs/packages/generator/extrafiles.md +++ b/doc/docs/packages/generator/extrafiles.md @@ -17,7 +17,7 @@ func NotesFile(services []string) string NotesFile returns the content of the note.txt file. -## func [ReadMeFile]() +## func [ReadMeFile]() ```go func ReadMeFile(charname, description string, values map[string]any) string diff --git a/doc/docs/packages/generator/katenaryfile.md b/doc/docs/packages/generator/katenaryfile.md index 02ade60..3e1d02e 100644 --- a/doc/docs/packages/generator/katenaryfile.md +++ b/doc/docs/packages/generator/katenaryfile.md @@ -12,7 +12,7 @@ A katenary file, named "katenary.yml" or "katenary.yaml", is a file where you ca Formely, the file describe the same structure as in labels, and so that can be validated and completed by LSP. It also ease the use of katenary. -## func [GenerateSchema]() +## func [GenerateSchema]() ```go func GenerateSchema() string diff --git a/doc/docs/packages/generator/labels.md b/doc/docs/packages/generator/labels.md index 7e9bfbc..c990ce8 100644 --- a/doc/docs/packages/generator/labels.md +++ b/doc/docs/packages/generator/labels.md @@ -15,7 +15,7 @@ const KatenaryLabelPrefix = "katenary.v3" ``` -## func [GetLabelHelp]() +## func [GetLabelHelp]() ```go func GetLabelHelp(asMarkdown bool) string @@ -24,7 +24,7 @@ func GetLabelHelp(asMarkdown bool) string Generate the help for the labels. -## func [GetLabelHelpFor]() +## func [GetLabelHelpFor]() ```go func GetLabelHelpFor(labelname string, asMarkdown bool) string @@ -33,7 +33,7 @@ func GetLabelHelpFor(labelname string, asMarkdown bool) string GetLabelHelpFor returns the help for a specific label. -## func [GetLabelNames]() +## func [GetLabelNames]() ```go func GetLabelNames() []string @@ -42,7 +42,7 @@ func GetLabelNames() []string GetLabelNames returns a sorted list of all katenary label names. -## func [Prefix]() +## func [Prefix]() ```go func Prefix() string @@ -51,7 +51,7 @@ func Prefix() string -## type [Help]() +## type [Help]() Help is the documentation of a label. @@ -65,7 +65,7 @@ type Help struct { ``` -## type [Label]() +## type [Label]() Label is a katenary label to find in compose files. @@ -97,7 +97,7 @@ const ( ``` -### func [LabelName]() +### func [LabelName]() ```go func LabelName(name string) Label diff --git a/doc/docs/packages/update.md b/doc/docs/packages/update.md deleted file mode 100644 index ff63677..0000000 --- a/doc/docs/packages/update.md +++ /dev/null @@ -1,60 +0,0 @@ - - -# update - -```go -import "katenary/update" -``` - -Update package is used to check if a new version of katenary is available. - -## Variables - - - -```go -var ( - Version = "master" // reset by cmd/main.go -) -``` - - -## func [DownloadFile]() - -```go -func DownloadFile(url, exe string) error -``` - -DownloadFile will download a url to a local file. It also ensure that the file is executable. - - -## func [DownloadLatestVersion]() - -```go -func DownloadLatestVersion(assets []Asset) error -``` - -DownloadLatestVersion will download the latest version of katenary. - - -## type [Asset]() - -Asset is a github asset from release url. - -```go -type Asset struct { - Name string `json:"name"` - URL string `json:"browser_download_url"` -} -``` - - -### func [CheckLatestVersion]() - -```go -func CheckLatestVersion() (string, []Asset, error) -``` - -CheckLatestVersion check katenary latest version from release and propose to download it - -Generated by [gomarkdoc]() diff --git a/doc/docs/packages/utils.md b/doc/docs/packages/utils.md index 35a62ba..fe5e325 100644 --- a/doc/docs/packages/utils.md +++ b/doc/docs/packages/utils.md @@ -8,7 +8,7 @@ import "katenary/utils" Utils package provides some utility functions used in katenary. It defines some constants and functions used in the whole project. -## func [AsResourceName]() +## func [AsResourceName]() ```go func AsResourceName(name string) string @@ -35,7 +35,7 @@ func CountStartingSpaces(line string) int CountStartingSpaces counts the number of spaces at the beginning of a string. -## func [EncodeBasicYaml]() +## func [EncodeBasicYaml]() ```go func EncodeBasicYaml(data any) ([]byte, error) @@ -44,7 +44,7 @@ func EncodeBasicYaml(data any) ([]byte, error) EncodeBasicYaml encodes a basic yaml from an interface. -## func [FixedResourceName]() +## func [FixedResourceName]() ```go func FixedResourceName(name string) string @@ -146,7 +146,7 @@ GetContainerByName returns a container by name and its index in the array. ## func [Warn]() ```go -func Warn(msg ...interface{}) +func Warn(msg ...any) ``` Warn prints a warning message diff --git a/doc/mkdocs.yml b/doc/mkdocs.yml index 09d446d..cb24c58 100644 --- a/doc/mkdocs.yml +++ b/doc/mkdocs.yml @@ -54,7 +54,6 @@ nav: - Go Packages: - packages/cmd/katenary.md - packages/parser.md - - packages/update.md - packages/utils.md - Generator: - Index: packages/generator.md