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