Compare commits
8 Commits
f3c1bf39fe
...
releases/3
Author | SHA1 | Date | |
---|---|---|---|
9bd1ebb59a
|
|||
614a1df5ba
|
|||
f0436ebce1
|
|||
b8333eacf2
|
|||
bd24e833cb
|
|||
a17d35df03
|
|||
8c443ba402
|
|||
a4647aa69a
|
@@ -18,12 +18,21 @@ jobs:
|
|||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
steps:
|
steps:
|
||||||
- name: Extract version
|
- name: Extract version and image name
|
||||||
run: |
|
run: |
|
||||||
|
# remove "releases/"
|
||||||
VERSION="${VERSION#releases/}"
|
VERSION="${VERSION#releases/}"
|
||||||
|
# set image name to lower case
|
||||||
|
IMAGE_NAME="${IMAGE_NAME,,}"
|
||||||
|
|
||||||
echo "Exporting variable VERSION=$VERSION"
|
echo "Exporting variable VERSION=$VERSION"
|
||||||
|
echo "Exporting variable IMAGE_NAME=$IMAGE_NAME"
|
||||||
|
|
||||||
echo "VERSION=$VERSION" >> $GITEA_OUTPUT
|
echo "VERSION=$VERSION" >> $GITEA_OUTPUT
|
||||||
|
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITEA_OUTPUT
|
||||||
|
|
||||||
echo "VERSION=$VERSION" >> $GITEA_ENV
|
echo "VERSION=$VERSION" >> $GITEA_ENV
|
||||||
|
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITEA_ENV
|
||||||
|
|
||||||
- name: Install Buildah
|
- name: Install Buildah
|
||||||
run: |-
|
run: |-
|
||||||
@@ -44,12 +53,12 @@ jobs:
|
|||||||
|
|
||||||
- name: Build and tag
|
- name: Build and tag
|
||||||
run: |-
|
run: |-
|
||||||
echo "Building image $REGISTRY/${IMAGE_NAME,,}:$VERSION / latest"
|
echo "Building image ${REGISTRY}/${IMAGE_NAME}:${VERSION} / latest"
|
||||||
buildah build --isolation=chroot --build-arg VERSION=$VERSION -t katenary -f ./oci/katenary/Containerfile .
|
buildah build --isolation=chroot --build-arg VERSION=${VERSION} -t katenary -f ./oci/katenary/Containerfile .
|
||||||
buildah tag katenary $REGISTRY/${IMAGE_NAME,,}:$VERSION
|
buildah tag katenary ${REGISTRY}/${IMAGE_NAME}:${VERSION}
|
||||||
buildah tag katenary $REGISTRY/${IMAGE_NAME,,}:latest
|
buildah tag katenary ${REGISTRY}/${IMAGE_NAME}:latest
|
||||||
|
|
||||||
- name: Push image
|
- name: Push image
|
||||||
run: |-
|
run: |-
|
||||||
buildah push $REGISTRY/${IMAGE_NAME,,}:$VERSION
|
buildah push ${REGISTRY}/${IMAGE_NAME}:${VERSION}
|
||||||
buildah push $REGISTRY/${IMAGE_NAME,,}:latest
|
buildah push ${REGISTRY}/${IMAGE_NAME}:latest
|
||||||
|
@@ -146,11 +146,11 @@ func generateConvertCommand() *cobra.Command {
|
|||||||
convertCmd := &cobra.Command{
|
convertCmd := &cobra.Command{
|
||||||
Use: "convert",
|
Use: "convert",
|
||||||
Short: "Converts a docker-compose file to a Helm Chart",
|
Short: "Converts a docker-compose file to a Helm Chart",
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
if len(strings.TrimSpace(givenAppVersion)) > 0 {
|
if len(strings.TrimSpace(givenAppVersion)) > 0 {
|
||||||
appVersion = &givenAppVersion
|
appVersion = &givenAppVersion
|
||||||
}
|
}
|
||||||
return generator.Convert(generator.ConvertOptions{
|
if err := generator.Convert(generator.ConvertOptions{
|
||||||
Force: force,
|
Force: force,
|
||||||
OutputDir: outputDir,
|
OutputDir: outputDir,
|
||||||
Profiles: profiles,
|
Profiles: profiles,
|
||||||
@@ -159,7 +159,9 @@ func generateConvertCommand() *cobra.Command {
|
|||||||
ChartVersion: chartVersion,
|
ChartVersion: chartVersion,
|
||||||
Icon: icon,
|
Icon: icon,
|
||||||
EnvFiles: envFiles,
|
EnvFiles: envFiles,
|
||||||
}, dockerComposeFile...)
|
}, dockerComposeFile...); err != nil {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -78,7 +78,7 @@ tested some concepts.
|
|||||||
You can help us in many ways.
|
You can help us in many ways.
|
||||||
|
|
||||||
- The first things we really need, more than money, more than anything else, is to have feedback. If you use Katenary,
|
- 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/Katenary/katenary).
|
if you have some issues, if you have some ideas, please open an issue on [our repository](https://repo.katenary.io/Katenary/katenary).
|
||||||
- The second thing is to help us to fix issues. If you're a Go developer, or if you want to fix the documentation,
|
- The second thing is to help us to fix issues. If you're a Go developer, or if you want to fix the documentation,
|
||||||
your help is greatly appreciated.
|
your help is greatly appreciated.
|
||||||
- And then, of course, we need money, or sponsors.
|
- And then, of course, we need money, or sponsors.
|
||||||
@@ -88,6 +88,8 @@ You can help us in many ways.
|
|||||||
We will be happy to communicate your help by putting your logo on the website and in the documentation. You can sponsor
|
We will be happy to communicate your help by putting your logo on the website and in the documentation. 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.
|
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.
|
||||||
|
|
||||||
|
Please, contact us by email at [contact at katenary dot io](mailto:contact@katenary.io).
|
||||||
|
|
||||||
### If you're an individual
|
### If you're an individual
|
||||||
|
|
||||||
All main contributors[^3] will be listed on the website and in the documentation.
|
All main contributors[^3] will be listed on the website and in the documentation.
|
||||||
|
@@ -349,7 +349,7 @@ func (d *Deployment) AddIngress(service types.ServiceConfig, appName string) *In
|
|||||||
AddIngress adds an ingress to the deployment. It creates the ingress object.
|
AddIngress adds an ingress to the deployment. It creates the ingress object.
|
||||||
|
|
||||||
<a name="Deployment.AddLegacyVolume"></a>
|
<a name="Deployment.AddLegacyVolume"></a>
|
||||||
### func \(\*Deployment\) [AddLegacyVolume](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L223>)
|
### func \(\*Deployment\) [AddLegacyVolume](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L216>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) AddLegacyVolume(name, kind string)
|
func (d *Deployment) AddLegacyVolume(name, kind string)
|
||||||
@@ -367,7 +367,7 @@ func (d *Deployment) AddVolumes(service types.ServiceConfig, appName string)
|
|||||||
AddVolumes adds a volume to the deployment. It does not create the PVC, it only adds the volumes to the deployment. If the volume is a bind volume it will warn the user that it is not supported yet.
|
AddVolumes adds a volume to the deployment. It does not create the PVC, it only adds the volumes to the deployment. If the volume is a bind volume it will warn the user that it is not supported yet.
|
||||||
|
|
||||||
<a name="Deployment.BindFrom"></a>
|
<a name="Deployment.BindFrom"></a>
|
||||||
### func \(\*Deployment\) [BindFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L244>)
|
### func \(\*Deployment\) [BindFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L237>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) BindFrom(service types.ServiceConfig, binded *Deployment)
|
func (d *Deployment) BindFrom(service types.ServiceConfig, binded *Deployment)
|
||||||
@@ -376,7 +376,7 @@ func (d *Deployment) BindFrom(service types.ServiceConfig, binded *Deployment)
|
|||||||
|
|
||||||
|
|
||||||
<a name="Deployment.BindMapFilesToContainer"></a>
|
<a name="Deployment.BindMapFilesToContainer"></a>
|
||||||
### func \(\*Deployment\) [BindMapFilesToContainer](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L378>)
|
### func \(\*Deployment\) [BindMapFilesToContainer](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L372>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) BindMapFilesToContainer(service types.ServiceConfig, secrets []string, appName string) (*corev1.Container, int)
|
func (d *Deployment) BindMapFilesToContainer(service types.ServiceConfig, secrets []string, appName string) (*corev1.Container, int)
|
||||||
@@ -385,7 +385,7 @@ func (d *Deployment) BindMapFilesToContainer(service types.ServiceConfig, secret
|
|||||||
|
|
||||||
|
|
||||||
<a name="Deployment.DependsOn"></a>
|
<a name="Deployment.DependsOn"></a>
|
||||||
### func \(\*Deployment\) [DependsOn](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L272>)
|
### func \(\*Deployment\) [DependsOn](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L265>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) DependsOn(to *Deployment, servicename string) error
|
func (d *Deployment) DependsOn(to *Deployment, servicename string) error
|
||||||
@@ -394,7 +394,7 @@ func (d *Deployment) DependsOn(to *Deployment, servicename string) error
|
|||||||
DependsOn adds a initContainer to the deployment that will wait for the service to be up.
|
DependsOn adds a initContainer to the deployment that will wait for the service to be up.
|
||||||
|
|
||||||
<a name="Deployment.Filename"></a>
|
<a name="Deployment.Filename"></a>
|
||||||
### func \(\*Deployment\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L303>)
|
### func \(\*Deployment\) [Filename](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L297>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) Filename() string
|
func (d *Deployment) Filename() string
|
||||||
@@ -403,7 +403,7 @@ func (d *Deployment) Filename() string
|
|||||||
Filename returns the filename of the deployment.
|
Filename returns the filename of the deployment.
|
||||||
|
|
||||||
<a name="Deployment.MountExchangeVolumes"></a>
|
<a name="Deployment.MountExchangeVolumes"></a>
|
||||||
### func \(\*Deployment\) [MountExchangeVolumes](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L429>)
|
### func \(\*Deployment\) [MountExchangeVolumes](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L423>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) MountExchangeVolumes()
|
func (d *Deployment) MountExchangeVolumes()
|
||||||
@@ -412,7 +412,7 @@ func (d *Deployment) MountExchangeVolumes()
|
|||||||
|
|
||||||
|
|
||||||
<a name="Deployment.SetEnvFrom"></a>
|
<a name="Deployment.SetEnvFrom"></a>
|
||||||
### func \(\*Deployment\) [SetEnvFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L308>)
|
### func \(\*Deployment\) [SetEnvFrom](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L302>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) SetEnvFrom(service types.ServiceConfig, appName string, samePod ...bool)
|
func (d *Deployment) SetEnvFrom(service types.ServiceConfig, appName string, samePod ...bool)
|
||||||
@@ -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.
|
SetEnvFrom sets the environment variables to a configmap. The configmap is created.
|
||||||
|
|
||||||
<a name="Deployment.Yaml"></a>
|
<a name="Deployment.Yaml"></a>
|
||||||
### func \(\*Deployment\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L453>)
|
### func \(\*Deployment\) [Yaml](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/deployment.go#L447>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func (d *Deployment) Yaml() ([]byte, error)
|
func (d *Deployment) Yaml() ([]byte, error)
|
||||||
@@ -471,7 +471,7 @@ type HelmChart struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="Generate"></a>
|
<a name="Generate"></a>
|
||||||
### func [Generate](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/generator.go#L32>)
|
### func [Generate](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/generator/generator.go#L33>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func Generate(project *types.Project) (*HelmChart, error)
|
func Generate(project *types.Project) (*HelmChart, error)
|
||||||
|
@@ -17,7 +17,7 @@ const DirectoryPermission = 0o755
|
|||||||
```
|
```
|
||||||
|
|
||||||
<a name="AsResourceName"></a>
|
<a name="AsResourceName"></a>
|
||||||
## func [AsResourceName](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L197>)
|
## func [AsResourceName](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L198>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func AsResourceName(name string) string
|
func AsResourceName(name string) string
|
||||||
@@ -26,7 +26,7 @@ func AsResourceName(name string) string
|
|||||||
AsResourceName returns a resource name with underscores to respect the kubernetes naming convention. It's the opposite of FixedResourceName.
|
AsResourceName returns a resource name with underscores to respect the kubernetes naming convention. It's the opposite of FixedResourceName.
|
||||||
|
|
||||||
<a name="Confirm"></a>
|
<a name="Confirm"></a>
|
||||||
## func [Confirm](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L165>)
|
## func [Confirm](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L166>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func Confirm(question string, icon ...logger.Icon) bool
|
func Confirm(question string, icon ...logger.Icon) bool
|
||||||
@@ -44,7 +44,7 @@ func CountStartingSpaces(line string) int
|
|||||||
CountStartingSpaces counts the number of spaces at the beginning of a string.
|
CountStartingSpaces counts the number of spaces at the beginning of a string.
|
||||||
|
|
||||||
<a name="EncodeBasicYaml"></a>
|
<a name="EncodeBasicYaml"></a>
|
||||||
## func [EncodeBasicYaml](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L179>)
|
## func [EncodeBasicYaml](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L180>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func EncodeBasicYaml(data any) ([]byte, error)
|
func EncodeBasicYaml(data any) ([]byte, error)
|
||||||
@@ -53,7 +53,7 @@ func EncodeBasicYaml(data any) ([]byte, error)
|
|||||||
EncodeBasicYaml encodes a basic yaml from an interface.
|
EncodeBasicYaml encodes a basic yaml from an interface.
|
||||||
|
|
||||||
<a name="FixedResourceName"></a>
|
<a name="FixedResourceName"></a>
|
||||||
## func [FixedResourceName](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L191>)
|
## func [FixedResourceName](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L192>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func FixedResourceName(name string) string
|
func FixedResourceName(name string) string
|
||||||
@@ -152,7 +152,7 @@ func TplValue(serviceName, variable string, pipes ...string) string
|
|||||||
TplValue returns a string that can be used in a template to access a value from the values file.
|
TplValue returns a string that can be used in a template to access a value from the values file.
|
||||||
|
|
||||||
<a name="WordWrap"></a>
|
<a name="WordWrap"></a>
|
||||||
## func [WordWrap](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L160>)
|
## func [WordWrap](<https://repo.katenary.io/Katenary/katenary/blob/master/internal/utils/utils.go#L161>)
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func WordWrap(text string, lineWidth int) string
|
func WordWrap(text string, lineWidth int) string
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
'\" t
|
'\" t
|
||||||
.\" Automatically generated by Pandoc 3.1.11.1
|
.\" Automatically generated by Pandoc 3.1.11.1
|
||||||
.\"
|
.\"
|
||||||
.TH "Katenary" "1" "2025-08-29" "mkdocs-manpage v2.0.1" "Katenary helm chart generator"
|
.TH "Katenary" "1" "2025-09-15" "mkdocs-manpage v2.0.1" "Katenary helm chart generator"
|
||||||
.SH Basic Usage
|
.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.
|
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.
|
This resulting helm chart can be installed with \f[CR]helm\f[R] command to your Kubernetes cluster.
|
||||||
@@ -414,11 +414,11 @@ The file or directory is relative to the service directory.
|
|||||||
.PP
|
.PP
|
||||||
If it is a directory, all files inside it are added to the ConfigMap.
|
If it is a directory, all files inside it are added to the ConfigMap.
|
||||||
.PP
|
.PP
|
||||||
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.
|
||||||
.PP
|
.PP
|
||||||
Warning
|
Warning
|
||||||
.PP
|
.PP
|
||||||
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.
|
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.
|
Keep in mind that your project sources should be stored in an application image or in a storage.
|
||||||
.PP
|
.PP
|
||||||
@@ -438,8 +438,13 @@ Create a cronjob from the service.
|
|||||||
.PP
|
.PP
|
||||||
This adds a cronjob to the chart.
|
This adds a cronjob to the chart.
|
||||||
.PP
|
.PP
|
||||||
The label value is a YAML object with the following attributes: \- command: the command to be executed \- schedule: the cron schedule (cron format or \[at]every where \[dq]every\[dq] is a duration like 1h30m, daily, hourly...)
|
The label value is a YAML object with the following attributes:
|
||||||
\- 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
|
.IP \[bu] 2
|
||||||
|
command: the command to be executed
|
||||||
|
.IP \[bu] 2
|
||||||
|
schedule: the cron schedule (cron format or \[at]every where \[dq]every\[dq] is a duration like 1h30m, daily, hourly...)
|
||||||
|
.IP \[bu] 2
|
||||||
|
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
|
||||||
.PP
|
.PP
|
||||||
\f[B]Example:\f[R]
|
\f[B]Example:\f[R]
|
||||||
.IP
|
.IP
|
||||||
@@ -532,7 +537,7 @@ service1:
|
|||||||
service2:
|
service2:
|
||||||
image: php:7.4\-fpm
|
image: php:7.4\-fpm
|
||||||
labels:
|
labels:
|
||||||
# get the congigMap from service1 where FOO is
|
# get the congigMap from service1 where FOO is
|
||||||
# defined inside this service too
|
# defined inside this service too
|
||||||
katenary.v3/env\-from: |\-
|
katenary.v3/env\-from: |\-
|
||||||
\- myservice1
|
\- myservice1
|
||||||
@@ -555,7 +560,13 @@ a \f[CR]voumeMount\f[R] in the pod for \f[B]each container\f[R]
|
|||||||
.IP \[bu] 2
|
.IP \[bu] 2
|
||||||
a \f[CR]initContainer\f[R] for each definition
|
a \f[CR]initContainer\f[R] for each definition
|
||||||
.PP
|
.PP
|
||||||
Fields: \- name: the name of the volume (manadatory) \- mountPath: the path where the volume is mounted in the pod (optional, default is \f[CR]/opt\f[R]) \- init: a command to run to initialize the volume with data (optional)
|
Fields:
|
||||||
|
.IP \[bu] 2
|
||||||
|
name: the name of the volume (manadatory)
|
||||||
|
.IP \[bu] 2
|
||||||
|
mountPath: the path where the volume is mounted in the pod (optional, default is \f[CR]/opt\f[R])
|
||||||
|
.IP \[bu] 2
|
||||||
|
init: a command to run to initialize the volume with data (optional)
|
||||||
.PP
|
.PP
|
||||||
Warning
|
Warning
|
||||||
.PP
|
.PP
|
||||||
@@ -645,7 +656,7 @@ ghost:
|
|||||||
image: ghost:1.25.5
|
image: ghost:1.25.5
|
||||||
labels:
|
labels:
|
||||||
# The chart is now named ghost, and the appVersion is 1.25.5.
|
# The chart is now named ghost, and the appVersion is 1.25.5.
|
||||||
# In Deployment, the image attribute is set to ghost:1.25.5 if
|
# In Deployment, the image attribute is set to ghost:1.25.5 if
|
||||||
# you don\[aq]t change the \[dq]tag\[dq] attribute in values.yaml
|
# you don\[aq]t change the \[dq]tag\[dq] attribute in values.yaml
|
||||||
katenary.v3/main\-app: true
|
katenary.v3/main\-app: true
|
||||||
.EE
|
.EE
|
||||||
@@ -734,7 +745,7 @@ Environment variables to be added to the values.yaml
|
|||||||
.PP
|
.PP
|
||||||
\f[B]Type\f[R]: \f[CR][]string or map[string]string\f[R]
|
\f[B]Type\f[R]: \f[CR][]string or map[string]string\f[R]
|
||||||
.PP
|
.PP
|
||||||
By default, all environment variables in the \[dq]env\[dq] and environment files are added to configmaps with the static values set.
|
By default, all environment variables in the \[dq]env\[dq] and environment files are added to ConfigMaps with the static values set.
|
||||||
This label allows adding environment variables to the values.yaml file.
|
This label allows adding environment variables to the values.yaml file.
|
||||||
.PP
|
.PP
|
||||||
Note that the value inside the configmap is \f[CR]{{ tpl vaname . }}\f[R], so you can set the value to a template that will be rendered with the values.yaml file.
|
Note that the value inside the configmap is \f[CR]{{ tpl vaname . }}\f[R], so you can set the value to a template that will be rendered with the values.yaml file.
|
||||||
@@ -756,7 +767,7 @@ labels:
|
|||||||
\- TO_CONFIGURE
|
\- TO_CONFIGURE
|
||||||
# complex values, set as a template in values.yaml with a documentation
|
# complex values, set as a template in values.yaml with a documentation
|
||||||
\- A_COMPLEX_VALUE: |\-
|
\- A_COMPLEX_VALUE: |\-
|
||||||
This is the documentation for the variable to
|
This is the documentation for the variable to
|
||||||
configure in values.yaml.
|
configure in values.yaml.
|
||||||
It can be, of course, a multiline text.
|
It can be, of course, a multiline text.
|
||||||
.EE
|
.EE
|
||||||
|
4
go.mod
4
go.mod
@@ -1,6 +1,8 @@
|
|||||||
module katenary.io
|
module katenary.io
|
||||||
|
|
||||||
go 1.25
|
go 1.24.0
|
||||||
|
|
||||||
|
toolchain go1.24.7
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/compose-spec/compose-go v1.20.2
|
github.com/compose-spec/compose-go v1.20.2
|
||||||
|
@@ -130,7 +130,7 @@ func Convert(config ConvertOptions, dockerComposeFile ...string) error {
|
|||||||
// parse the compose files
|
// parse the compose files
|
||||||
project, err := parser.Parse(config.Profiles, config.EnvFiles, dockerComposeFile...)
|
project, err := parser.Parse(config.Profiles, config.EnvFiles, dockerComposeFile...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
logger.Failure("Cannot parse compose files", err.Error())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -208,15 +208,8 @@ func (d *Deployment) AddVolumes(service types.ServiceConfig, appName string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isSamePod := false
|
|
||||||
if v, ok := service.Labels[labels.LabelSamePod]; !ok {
|
|
||||||
isSamePod = false
|
|
||||||
} else {
|
|
||||||
isSamePod = v != ""
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, volume := range service.Volumes {
|
for _, volume := range service.Volumes {
|
||||||
d.bindVolumes(volume, isSamePod, tobind, service, appName)
|
d.bindVolumes(volume, tobind, service, appName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,6 +265,7 @@ func (d *Deployment) BindFrom(service types.ServiceConfig, binded *Deployment) {
|
|||||||
func (d *Deployment) DependsOn(to *Deployment, servicename string) error {
|
func (d *Deployment) DependsOn(to *Deployment, servicename string) error {
|
||||||
// Add a initContainer with busybox:latest using netcat to check if the service is up
|
// Add a initContainer with busybox:latest using netcat to check if the service is up
|
||||||
// it will wait until the service responds to all ports
|
// it will wait until the service responds to all ports
|
||||||
|
logger.Info("Adding dependency from ", d.service.Name, " to ", to.service.Name)
|
||||||
for _, container := range to.Spec.Template.Spec.Containers {
|
for _, container := range to.Spec.Template.Spec.Containers {
|
||||||
commands := []string{}
|
commands := []string{}
|
||||||
if len(container.Ports) == 0 {
|
if len(container.Ports) == 0 {
|
||||||
@@ -670,14 +664,14 @@ func (d *Deployment) appendFileToConfigMap(service types.ServiceConfig, appName
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Deployment) bindVolumes(volume types.ServiceVolumeConfig, isSamePod bool, tobind map[string]bool, service types.ServiceConfig, appName string) {
|
func (d *Deployment) bindVolumes(volume types.ServiceVolumeConfig, tobind map[string]bool, service types.ServiceConfig, appName string) {
|
||||||
container, index := utils.GetContainerByName(service.ContainerName, d.Spec.Template.Spec.Containers)
|
container, index := utils.GetContainerByName(service.ContainerName, d.Spec.Template.Spec.Containers)
|
||||||
|
|
||||||
defer func(d *Deployment, container *corev1.Container, index int) {
|
defer func(d *Deployment, container *corev1.Container, index int) {
|
||||||
d.Spec.Template.Spec.Containers[index] = *container
|
d.Spec.Template.Spec.Containers[index] = *container
|
||||||
}(d, container, index)
|
}(d, container, index)
|
||||||
|
|
||||||
if _, found := tobind[volume.Source]; !isSamePod && volume.Type == "bind" && !found {
|
if _, found := tobind[volume.Source]; volume.Type == "bind" && !found {
|
||||||
logger.Warn(
|
logger.Warn(
|
||||||
"Bind volumes are not supported yet, " +
|
"Bind volumes are not supported yet, " +
|
||||||
"excepting for those declared as " +
|
"excepting for those declared as " +
|
||||||
|
@@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
"katenary.io/internal/generator/labels"
|
"katenary.io/internal/generator/labels"
|
||||||
"katenary.io/internal/generator/labels/labelstructs"
|
"katenary.io/internal/generator/labels/labelstructs"
|
||||||
|
"katenary.io/internal/logger"
|
||||||
"katenary.io/internal/utils"
|
"katenary.io/internal/utils"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
@@ -99,6 +100,7 @@ func Generate(project *types.Project) (*HelmChart, error) {
|
|||||||
|
|
||||||
// drop all "same-pod" deployments because the containers and volumes are already
|
// drop all "same-pod" deployments because the containers and volumes are already
|
||||||
// in the target deployment
|
// in the target deployment
|
||||||
|
drops := []string{}
|
||||||
for _, service := range podToMerge {
|
for _, service := range podToMerge {
|
||||||
if samepod, ok := service.Labels[labels.LabelSamePod]; ok && samepod != "" {
|
if samepod, ok := service.Labels[labels.LabelSamePod]; ok && samepod != "" {
|
||||||
// move this deployment volumes to the target deployment
|
// move this deployment volumes to the target deployment
|
||||||
@@ -109,9 +111,11 @@ func Generate(project *types.Project) (*HelmChart, error) {
|
|||||||
// copy all init containers
|
// copy all init containers
|
||||||
initContainers := deployments[service.Name].Spec.Template.Spec.InitContainers
|
initContainers := deployments[service.Name].Spec.Template.Spec.InitContainers
|
||||||
target.Spec.Template.Spec.InitContainers = append(target.Spec.Template.Spec.InitContainers, initContainers...)
|
target.Spec.Template.Spec.InitContainers = append(target.Spec.Template.Spec.InitContainers, initContainers...)
|
||||||
delete(deployments, service.Name)
|
drops = append(drops, service.Name)
|
||||||
} else {
|
} else {
|
||||||
log.Printf("service %[1]s is declared as %[2]s, but %[2]s is not defined", service.Name, labels.LabelSamePod)
|
err := fmt.Errorf("service %s is declared as %s, but %s is not defined", service.Name, labels.LabelSamePod, samepod)
|
||||||
|
logger.Failure(err.Error())
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -122,13 +126,18 @@ func Generate(project *types.Project) (*HelmChart, error) {
|
|||||||
if dep, ok := deployments[d]; ok {
|
if dep, ok := deployments[d]; ok {
|
||||||
err := deployments[s.Name].DependsOn(dep, d)
|
err := deployments[s.Name].DependsOn(dep, d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("error creating init container for service %[1]s: %[2]s", s.Name, err)
|
logger.Info(fmt.Sprintf("error creating init container for service %[1]s: %[2]s", s.Name, err))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Printf("service %[1]s depends on %[2]s, but %[2]s is not defined", s.Name, d)
|
err := fmt.Errorf("service %[1]s depends on %[2]s, but %[2]s is not defined", s.Name, d)
|
||||||
|
logger.Failure(err.Error())
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for _, name := range drops {
|
||||||
|
delete(deployments, name)
|
||||||
|
}
|
||||||
// it's now time to get "value-from", before makeing the secrets and configmaps!
|
// it's now time to get "value-from", before makeing the secrets and configmaps!
|
||||||
for _, s := range project.Services {
|
for _, s := range project.Services {
|
||||||
chart.setEnvironmentValuesFrom(s, deployments)
|
chart.setEnvironmentValuesFrom(s, deployments)
|
||||||
@@ -226,6 +235,7 @@ func fixResourceNames(project *types.Project) error {
|
|||||||
s.Labels[labels.LabelSamePod] = fixed
|
s.Labels[labels.LabelSamePod] = fixed
|
||||||
project.Services[j] = s
|
project.Services[j] = s
|
||||||
}
|
}
|
||||||
|
|
||||||
// also, the value-from label should be updated
|
// also, the value-from label should be updated
|
||||||
if valuefrom, ok := s.Labels[labels.LabelValuesFrom]; ok {
|
if valuefrom, ok := s.Labels[labels.LabelValuesFrom]; ok {
|
||||||
vf, err := labelstructs.GetValueFrom(valuefrom)
|
vf, err := labelstructs.GetValueFrom(valuefrom)
|
||||||
@@ -244,8 +254,15 @@ func fixResourceNames(project *types.Project) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
service.Name = fixed
|
service.Name = fixed
|
||||||
project.Services[i] = service
|
|
||||||
}
|
}
|
||||||
|
// rename depends_on
|
||||||
|
for _, d := range service.GetDependencies() {
|
||||||
|
depname := utils.AsResourceName(d)
|
||||||
|
dep := service.DependsOn[d]
|
||||||
|
delete(service.DependsOn, d)
|
||||||
|
service.DependsOn[depname] = dep
|
||||||
|
}
|
||||||
|
project.Services[i] = service
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@@ -136,16 +136,17 @@ func GetValuesFromLabel(service types.ServiceConfig, LabelValues string) map[str
|
|||||||
log.Printf("Error parsing label %s: %s", v, err)
|
log.Printf("Error parsing label %s: %s", v, err)
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, value := range labelContent {
|
for _, value := range labelContent {
|
||||||
switch val := value.(type) {
|
switch value := value.(type) {
|
||||||
case string:
|
case string:
|
||||||
descriptions[val] = nil
|
descriptions[value] = nil
|
||||||
case map[string]any:
|
case map[string]any:
|
||||||
for k, v := range value.(map[string]any) {
|
for k, v := range value {
|
||||||
descriptions[k] = &EnvConfig{Service: service, Description: v.(string)}
|
descriptions[k] = &EnvConfig{Service: service, Description: v.(string)}
|
||||||
}
|
}
|
||||||
case map[any]any:
|
case map[any]any:
|
||||||
for k, v := range value.(map[any]any) {
|
for k, v := range value {
|
||||||
descriptions[k.(string)] = &EnvConfig{Service: service, Description: v.(string)}
|
descriptions[k.(string)] = &EnvConfig{Service: service, Description: v.(string)}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user