parent
af82f7e6db
commit
36593e8759
@ -135,7 +135,7 @@ type ServiceConfig struct {
|
||||
ExposeServicePath string `compose:"kompose.service.expose.path"`
|
||||
BuildLabels map[string]string `compose:"build-labels"`
|
||||
ExposeServiceTLS string `compose:"kompose.service.expose.tls-secret"`
|
||||
ExposeServiceIngressClassName *string `compose:"kompose.service.expose.ingress-class-name"`
|
||||
ExposeServiceIngressClassName string `compose:"kompose.service.expose.ingress-class-name"`
|
||||
ImagePullSecret string `compose:"kompose.image-pull-secret"`
|
||||
Stdin bool `compose:"stdin_open"`
|
||||
Tty bool `compose:"tty"`
|
||||
|
||||
@ -518,7 +518,6 @@ func dockerComposeToKomposeMapping(composeObject *types.Config) (kobject.Kompose
|
||||
// Again, in v3, we use the "long syntax" for volumes in terms of parsing
|
||||
// https://docs.docker.com/compose/compose-file/#long-syntax-3
|
||||
serviceConfig.VolList = loadV3Volumes(composeServiceConfig.Volumes)
|
||||
|
||||
if err := parseKomposeLabels(composeServiceConfig.Labels, &serviceConfig); err != nil {
|
||||
return kobject.KomposeObject{}, err
|
||||
}
|
||||
@ -538,7 +537,6 @@ func dockerComposeToKomposeMapping(composeObject *types.Config) (kobject.Kompose
|
||||
}
|
||||
|
||||
handleV3Volume(&komposeObject, &composeObject.Volumes)
|
||||
|
||||
return komposeObject, nil
|
||||
}
|
||||
|
||||
@ -652,7 +650,6 @@ func parseKomposeLabels(labels map[string]string, serviceConfig *kobject.Service
|
||||
// Label handler
|
||||
// Labels used to influence conversion of kompose will be handled
|
||||
// from here for docker-compose. Each loader will have such handler.
|
||||
|
||||
if serviceConfig.Labels == nil {
|
||||
serviceConfig.Labels = make(map[string]string)
|
||||
}
|
||||
@ -673,7 +670,7 @@ func parseKomposeLabels(labels map[string]string, serviceConfig *kobject.Service
|
||||
case LabelServiceExposeTLSSecret:
|
||||
serviceConfig.ExposeServiceTLS = value
|
||||
case LabelServiceExposeIngressClassName:
|
||||
serviceConfig.ExposeServiceIngressClassName = &value
|
||||
serviceConfig.ExposeServiceIngressClassName = value
|
||||
case LabelImagePullSecret:
|
||||
serviceConfig.ImagePullSecret = value
|
||||
case LabelImagePullPolicy:
|
||||
@ -687,7 +684,7 @@ 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 {
|
||||
if serviceConfig.ExposeService == "" && serviceConfig.ExposeServiceIngressClassName != "" {
|
||||
return errors.New("kompose.service.expose.ingress-class-name was specified without kompose.service.expose")
|
||||
}
|
||||
|
||||
|
||||
@ -531,8 +531,8 @@ func (k *Kubernetes) initIngress(name string, service kobject.ServiceConfig, por
|
||||
}
|
||||
}
|
||||
|
||||
if service.ExposeServiceIngressClassName != nil {
|
||||
ingress.Spec.IngressClassName = service.ExposeServiceIngressClassName
|
||||
if service.ExposeServiceIngressClassName != "" {
|
||||
ingress.Spec.IngressClassName = &service.ExposeServiceIngressClassName
|
||||
}
|
||||
|
||||
return ingress
|
||||
|
||||
30
script/test/fixtures/expose/compose.yaml
vendored
30
script/test/fixtures/expose/compose.yaml
vendored
@ -1,14 +1,16 @@
|
||||
web:
|
||||
image: tuna/docker-counter23
|
||||
ports:
|
||||
- "5000:5000"
|
||||
links:
|
||||
- redis
|
||||
labels:
|
||||
kompose.service.expose: "batman.example.com/dev,batwoman.example.com"
|
||||
kompose.service.expose.tls-secret: "test-secret"
|
||||
kompose.service.expose.ingress-class-name: "nginx"
|
||||
redis:
|
||||
image: redis:3.0
|
||||
ports:
|
||||
- "6379"
|
||||
version: '3.5'
|
||||
services:
|
||||
web:
|
||||
image: tuna/docker-counter23
|
||||
ports:
|
||||
- "5000:5000"
|
||||
links:
|
||||
- redis
|
||||
labels:
|
||||
kompose.service.expose: "batman.example.com/dev,batwoman.example.com"
|
||||
kompose.service.expose.tls-secret: "test-secret"
|
||||
kompose.service.expose.ingress-class-name: "nginx"
|
||||
redis:
|
||||
image: redis:3.0
|
||||
ports:
|
||||
- "6379"
|
||||
|
||||
6
script/test/fixtures/expose/output-ocp.json
vendored
6
script/test/fixtures/expose/output-ocp.json
vendored
@ -83,7 +83,7 @@
|
||||
"imageChangeParams": {
|
||||
"automatic": true,
|
||||
"containerNames": [
|
||||
"redis"
|
||||
"redis"
|
||||
],
|
||||
"from": {
|
||||
"kind": "ImageStreamTag",
|
||||
@ -146,7 +146,7 @@
|
||||
},
|
||||
"tags": [
|
||||
{
|
||||
"name": "latest",
|
||||
"name": "3.0",
|
||||
"annotations": null,
|
||||
"from": {
|
||||
"kind": "DockerImage",
|
||||
@ -192,7 +192,7 @@
|
||||
"imageChangeParams": {
|
||||
"automatic": true,
|
||||
"containerNames": [
|
||||
"web"
|
||||
"web"
|
||||
],
|
||||
"from": {
|
||||
"kind": "ImageStreamTag",
|
||||
|
||||
@ -73,7 +73,8 @@
|
||||
],
|
||||
"env": [
|
||||
{
|
||||
"name": "TZ"
|
||||
"name": "TZ",
|
||||
"value": "${TZ}"
|
||||
}
|
||||
],
|
||||
"resources": {},
|
||||
@ -89,7 +90,8 @@
|
||||
"image": "librenms/dispatcher:latest",
|
||||
"env": [
|
||||
{
|
||||
"name": "TZ"
|
||||
"name": "TZ",
|
||||
"value": "${TZ}"
|
||||
}
|
||||
],
|
||||
"resources": {},
|
||||
|
||||
@ -259,7 +259,7 @@
|
||||
},
|
||||
"tags": [
|
||||
{
|
||||
"name": "latest",
|
||||
"name": "5.7",
|
||||
"annotations": null,
|
||||
"from": {
|
||||
"kind": "DockerImage",
|
||||
|
||||
2
script/test/fixtures/v2/output-os.json
vendored
2
script/test/fixtures/v2/output-os.json
vendored
@ -432,7 +432,7 @@
|
||||
},
|
||||
"tags": [
|
||||
{
|
||||
"name": "latest",
|
||||
"name": "3.0",
|
||||
"annotations": null,
|
||||
"from": {
|
||||
"kind": "DockerImage",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user