5
5
"errors"
6
6
"fmt"
7
7
"katenary/generator/extrafiles"
8
- "katenary/generator/labelStructs"
8
+ "katenary/generator/katenaryfile"
9
+ "katenary/generator/labels"
10
+ "katenary/generator/labels/labelStructs"
9
11
"katenary/parser"
10
12
"katenary/utils"
11
13
"log"
@@ -125,6 +127,9 @@ func Convert(config ConvertOptions, dockerComposeFile ...string) {
125
127
os .Exit (1 )
126
128
}
127
129
130
+ // TODO: use katenary.yaml file here to set the labels
131
+ katenaryfile .OverrideWithConfig (project )
132
+
128
133
if ! config .Force {
129
134
// check if the chart directory exists
130
135
// if yes, prevent the user from overwriting it and ask for confirmation
@@ -264,7 +269,7 @@ func addDependencyDescription(values []byte, dependencies []labelStructs.Depende
264
269
// of the service definition.
265
270
func addDescriptions (values []byte , project types.Project ) []byte {
266
271
for _ , service := range project .Services {
267
- if description , ok := service .Labels [LabelDescription ]; ok {
272
+ if description , ok := service .Labels [labels . LabelDescription ]; ok {
268
273
// set it as comment
269
274
description = "\n # " + strings .ReplaceAll (description , "\n " , "\n # " )
270
275
@@ -288,7 +293,7 @@ func addDescriptions(values []byte, project types.Project) []byte {
288
293
289
294
func addDocToVariable (service types.ServiceConfig , lines []string ) []string {
290
295
currentService := ""
291
- variables := utils .GetValuesFromLabel (service , LabelValues )
296
+ variables := utils .GetValuesFromLabel (service , labels . LabelValues )
292
297
for i , line := range lines {
293
298
// if the line is a service, it is a name followed by a colon
294
299
if regexp .MustCompile (`(?m)^` + service .Name + `:` ).MatchString (line ) {
@@ -378,7 +383,7 @@ func addMainTagAppDoc(values []byte, project *types.Project) []byte {
378
383
379
384
for _ , service := range project .Services {
380
385
// read the label LabelMainApp
381
- if v , ok := service .Labels [LabelMainApp ]; ! ok {
386
+ if v , ok := service .Labels [labels . LabelMainApp ]; ! ok {
382
387
continue
383
388
} else if v == "false" || v == "no" || v == "0" {
384
389
continue
@@ -651,7 +656,7 @@ func checkOldLabels(project *types.Project) error {
651
656
badServices := make ([]string , 0 )
652
657
for _ , service := range project .Services {
653
658
for label := range service .Labels {
654
- if strings .Contains (label , "katenary." ) && ! strings .Contains (label , katenaryLabelPrefix ) {
659
+ if strings .Contains (label , "katenary." ) && ! strings .Contains (label , labels . KatenaryLabelPrefix ) {
655
660
badServices = append (badServices , fmt .Sprintf ("- %s: %s" , service .Name , label ))
656
661
}
657
662
}
@@ -667,7 +672,7 @@ func checkOldLabels(project *types.Project) error {
667
672
Services to upgrade:
668
673
%s` ,
669
674
project .Name ,
670
- katenaryLabelPrefix [0 :len (katenaryLabelPrefix )- 1 ],
675
+ labels . KatenaryLabelPrefix [0 :len (labels . KatenaryLabelPrefix )- 1 ],
671
676
strings .Join (badServices , "\n " ),
672
677
)
673
678
0 commit comments