Add kompose.service.expose.ingress-class-name (#1486)

Signed-off-by: Sergey Shevchenko <shevchenko@simple.life>
This commit is contained in:
Sergey Shevchenko
2022-03-15 10:51:00 -04:00
committed by GitHub
parent 8e94728ddb
commit 98578640c0
8 changed files with 68 additions and 44 deletions
+2
View File
@@ -40,6 +40,8 @@ const (
LabelServiceExpose = "kompose.service.expose"
// LabelServiceExposeTLSSecret provides the name of the TLS secret to use with the Kubernetes ingress controller
LabelServiceExposeTLSSecret = "kompose.service.expose.tls-secret"
// LabelServiceExposeIngressClassName provides the name of ingress class to use with the Kubernetes ingress controller
LabelServiceExposeIngressClassName = "kompose.service.expose.ingress-class-name"
// LabelServiceAccountName defines the service account name to provide the credential info of the pod.
LabelServiceAccountName = "kompose.serviceaccount-name"
// LabelControllerType defines the type of controller to be created
+6
View File
@@ -658,6 +658,8 @@ func parseKomposeLabels(labels map[string]string, serviceConfig *kobject.Service
serviceConfig.NodePortPort = cast.ToInt32(value)
case LabelServiceExposeTLSSecret:
serviceConfig.ExposeServiceTLS = value
case LabelServiceExposeIngressClassName:
serviceConfig.ExposeServiceIngressClassName = &value
case LabelImagePullSecret:
serviceConfig.ImagePullSecret = value
case LabelImagePullPolicy:
@@ -671,6 +673,10 @@ func parseKomposeLabels(labels map[string]string, serviceConfig *kobject.Service
return errors.New("kompose.service.expose.tls-secret was specified without kompose.service.expose")
}
if serviceConfig.ExposeService == "" && serviceConfig.ExposeServiceIngressClassName != nil {
return errors.New("kompose.service.expose.ingress-class-name was specified without kompose.service.expose")
}
if serviceConfig.ServiceType != string(api.ServiceTypeNodePort) && serviceConfig.NodePortPort != 0 {
return errors.New("kompose.service.type must be nodeport when assign node port value")
}