fix(schema): Use ingress default values

Ingress has some default values, like path and classname. We need to
ensure that values are taken or nil, and to apply them if they are not
set explicitally. Port is a sepcial case.
This commit is contained in:
2024-11-22 15:55:59 +01:00
parent e925f58e82
commit 7b890df1c5
3 changed files with 31 additions and 8 deletions

View File

@@ -107,6 +107,19 @@ func getLabelContent(o any, service *types.ServiceConfig, labelName string) erro
return err
}
val := strings.TrimSpace(string(c))
if labelName == labels.LabelIngress {
// special case, values must be set from some defaults
ing, err := labelStructs.IngressFrom(val)
if err != nil {
log.Fatal(err)
return err
}
c, err := yaml.Marshal(ing)
if err != nil {
return err
}
val = strings.TrimSpace(string(c))
}
service.Labels[labelName] = val
return nil