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
|
||||
packages: write
|
||||
steps:
|
||||
- name: Extract version
|
||||
- name: Extract version and image name
|
||||
run: |
|
||||
# remove "releases/"
|
||||
VERSION="${VERSION#releases/}"
|
||||
# set image name to lower case
|
||||
IMAGE_NAME="${IMAGE_NAME,,}"
|
||||
|
||||
echo "Exporting variable VERSION=$VERSION"
|
||||
echo "Exporting variable IMAGE_NAME=$IMAGE_NAME"
|
||||
|
||||
echo "VERSION=$VERSION" >> $GITEA_OUTPUT
|
||||
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITEA_OUTPUT
|
||||
|
||||
echo "VERSION=$VERSION" >> $GITEA_ENV
|
||||
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITEA_ENV
|
||||
|
||||
- name: Install Buildah
|
||||
run: |-
|
||||
@@ -44,12 +53,12 @@ jobs:
|
||||
|
||||
- name: Build and tag
|
||||
run: |-
|
||||
echo "Building image $REGISTRY/${IMAGE_NAME,,}:$VERSION / latest"
|
||||
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,,}:latest
|
||||
echo "Building image ${REGISTRY}/${IMAGE_NAME}:${VERSION} / latest"
|
||||
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}:latest
|
||||
|
||||
- name: Push image
|
||||
run: |-
|
||||
buildah push $REGISTRY/${IMAGE_NAME,,}:$VERSION
|
||||
buildah push $REGISTRY/${IMAGE_NAME,,}:latest
|
||||
buildah push ${REGISTRY}/${IMAGE_NAME}:${VERSION}
|
||||
buildah push ${REGISTRY}/${IMAGE_NAME}:latest
|
||||
|
@@ -146,11 +146,11 @@ func generateConvertCommand() *cobra.Command {
|
||||
convertCmd := &cobra.Command{
|
||||
Use: "convert",
|
||||
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 {
|
||||
appVersion = &givenAppVersion
|
||||
}
|
||||
return generator.Convert(generator.ConvertOptions{
|
||||
if err := generator.Convert(generator.ConvertOptions{
|
||||
Force: force,
|
||||
OutputDir: outputDir,
|
||||
Profiles: profiles,
|
||||
@@ -159,7 +159,9 @@ func generateConvertCommand() *cobra.Command {
|
||||
ChartVersion: chartVersion,
|
||||
Icon: icon,
|
||||
EnvFiles: envFiles,
|
||||
}, dockerComposeFile...)
|
||||
}, dockerComposeFile...); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
@@ -78,7 +78,7 @@ tested some concepts.
|
||||
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,
|
||||
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,
|
||||
your help is greatly appreciated.
|
||||
- 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
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
<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
|
||||
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.
|
||||
|
||||
<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
|
||||
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>
|
||||
### 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
|
||||
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>
|
||||
### 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
|
||||
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.
|
||||
|
||||
<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
|
||||
func (d *Deployment) Filename() string
|
||||
@@ -403,7 +403,7 @@ func (d *Deployment) Filename() string
|
||||
Filename returns the filename of the deployment.
|
||||
|
||||
<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
|
||||
func (d *Deployment) MountExchangeVolumes()
|
||||
@@ -412,7 +412,7 @@ func (d *Deployment) MountExchangeVolumes()
|
||||
|
||||
|
||||
<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
|
||||
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.
|
||||
|
||||
<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
|
||||
func (d *Deployment) Yaml() ([]byte, error)
|
||||
@@ -471,7 +471,7 @@ type HelmChart struct {
|
||||
```
|
||||
|
||||
<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
|
||||
func Generate(project *types.Project) (*HelmChart, error)
|
||||
|
@@ -17,7 +17,7 @@ const DirectoryPermission = 0o755
|
||||
```
|
||||
|
||||
<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
|
||||
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.
|
||||
|
||||
<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
|
||||
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.
|
||||
|
||||
<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
|
||||
func EncodeBasicYaml(data any) ([]byte, error)
|
||||
@@ -53,7 +53,7 @@ func EncodeBasicYaml(data any) ([]byte, error)
|
||||
EncodeBasicYaml encodes a basic yaml from an interface.
|
||||
|
||||
<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
|
||||
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.
|
||||
|
||||
<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
|
||||
func WordWrap(text string, lineWidth int) string
|
||||
|
@@ -1,7 +1,7 @@
|
||||
'\" t
|
||||
.\" 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
|
||||
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.
|
||||
@@ -414,11 +414,11 @@ The file or directory is relative to the service directory.
|
||||
.PP
|
||||
If it is a directory, all files inside it are added to the ConfigMap.
|
||||
.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
|
||||
Warning
|
||||
.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.
|
||||
Keep in mind that your project sources should be stored in an application image or in a storage.
|
||||
.PP
|
||||
@@ -438,8 +438,13 @@ Create a cronjob from the service.
|
||||
.PP
|
||||
This adds a cronjob to the chart.
|
||||
.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...)
|
||||
\- 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
|
||||
The label value is a YAML object with the following attributes:
|
||||
.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
|
||||
\f[B]Example:\f[R]
|
||||
.IP
|
||||
@@ -555,7 +560,13 @@ a \f[CR]voumeMount\f[R] in the pod for \f[B]each container\f[R]
|
||||
.IP \[bu] 2
|
||||
a \f[CR]initContainer\f[R] for each definition
|
||||
.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
|
||||
Warning
|
||||
.PP
|
||||
@@ -734,7 +745,7 @@ Environment variables to be added to the values.yaml
|
||||
.PP
|
||||
\f[B]Type\f[R]: \f[CR][]string or map[string]string\f[R]
|
||||
.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.
|
||||
.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.
|
||||
|
4
go.mod
4
go.mod
@@ -1,6 +1,8 @@
|
||||
module katenary.io
|
||||
|
||||
go 1.25
|
||||
go 1.24.0
|
||||
|
||||
toolchain go1.24.7
|
||||
|
||||
require (
|
||||
github.com/compose-spec/compose-go v1.20.2
|
||||
|
@@ -130,7 +130,7 @@ func Convert(config ConvertOptions, dockerComposeFile ...string) error {
|
||||
// parse the compose files
|
||||
project, err := parser.Parse(config.Profiles, config.EnvFiles, dockerComposeFile...)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
logger.Failure("Cannot parse compose files", err.Error())
|
||||
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 {
|
||||
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 {
|
||||
// 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
|
||||
logger.Info("Adding dependency from ", d.service.Name, " to ", to.service.Name)
|
||||
for _, container := range to.Spec.Template.Spec.Containers {
|
||||
commands := []string{}
|
||||
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)
|
||||
|
||||
defer func(d *Deployment, container *corev1.Container, index int) {
|
||||
d.Spec.Template.Spec.Containers[index] = *container
|
||||
}(d, container, index)
|
||||
|
||||
if _, found := tobind[volume.Source]; !isSamePod && volume.Type == "bind" && !found {
|
||||
if _, found := tobind[volume.Source]; volume.Type == "bind" && !found {
|
||||
logger.Warn(
|
||||
"Bind volumes are not supported yet, " +
|
||||
"excepting for those declared as " +
|
||||
|
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"katenary.io/internal/generator/labels"
|
||||
"katenary.io/internal/generator/labels/labelstructs"
|
||||
"katenary.io/internal/logger"
|
||||
"katenary.io/internal/utils"
|
||||
|
||||
"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
|
||||
// in the target deployment
|
||||
drops := []string{}
|
||||
for _, service := range podToMerge {
|
||||
if samepod, ok := service.Labels[labels.LabelSamePod]; ok && samepod != "" {
|
||||
// move this deployment volumes to the target deployment
|
||||
@@ -109,9 +111,11 @@ func Generate(project *types.Project) (*HelmChart, error) {
|
||||
// copy all init containers
|
||||
initContainers := deployments[service.Name].Spec.Template.Spec.InitContainers
|
||||
target.Spec.Template.Spec.InitContainers = append(target.Spec.Template.Spec.InitContainers, initContainers...)
|
||||
delete(deployments, service.Name)
|
||||
drops = append(drops, service.Name)
|
||||
} 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 {
|
||||
err := deployments[s.Name].DependsOn(dep, d)
|
||||
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 {
|
||||
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!
|
||||
for _, s := range project.Services {
|
||||
chart.setEnvironmentValuesFrom(s, deployments)
|
||||
@@ -226,6 +235,7 @@ func fixResourceNames(project *types.Project) error {
|
||||
s.Labels[labels.LabelSamePod] = fixed
|
||||
project.Services[j] = s
|
||||
}
|
||||
|
||||
// also, the value-from label should be updated
|
||||
if valuefrom, ok := s.Labels[labels.LabelValuesFrom]; ok {
|
||||
vf, err := labelstructs.GetValueFrom(valuefrom)
|
||||
@@ -244,8 +254,15 @@ func fixResourceNames(project *types.Project) error {
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
@@ -136,16 +136,17 @@ func GetValuesFromLabel(service types.ServiceConfig, LabelValues string) map[str
|
||||
log.Printf("Error parsing label %s: %s", v, err)
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
for _, value := range labelContent {
|
||||
switch val := value.(type) {
|
||||
switch value := value.(type) {
|
||||
case string:
|
||||
descriptions[val] = nil
|
||||
descriptions[value] = nil
|
||||
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)}
|
||||
}
|
||||
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)}
|
||||
}
|
||||
default:
|
||||
|
Reference in New Issue
Block a user