forked from LaconicNetwork/kompose
fix #121: update all objects, even when port is missing
This commit is contained in:
parent
6cbdec444b
commit
4f36dca026
@ -225,9 +225,20 @@ func PortsExist(name string, service kobject.ServiceConfig) bool {
|
|||||||
|
|
||||||
// create a kubernetes Service
|
// create a kubernetes Service
|
||||||
func CreateService(name string, service kobject.ServiceConfig, objects []runtime.Object) *api.Service {
|
func CreateService(name string, service kobject.ServiceConfig, objects []runtime.Object) *api.Service {
|
||||||
|
|
||||||
svc := InitSvc(name, service)
|
svc := InitSvc(name, service)
|
||||||
|
|
||||||
|
// Configure the service ports.
|
||||||
|
servicePorts := ConfigServicePorts(name, service)
|
||||||
|
svc.Spec.Ports = servicePorts
|
||||||
|
|
||||||
|
// Configure annotations
|
||||||
|
annotations := transformer.ConfigAnnotations(service)
|
||||||
|
svc.ObjectMeta.Annotations = annotations
|
||||||
|
|
||||||
|
return svc
|
||||||
|
}
|
||||||
|
|
||||||
|
func UpdateKubernetesObjects(name string, service kobject.ServiceConfig, objects []runtime.Object) {
|
||||||
// Configure the environment variables.
|
// Configure the environment variables.
|
||||||
envs := ConfigEnvs(name, service)
|
envs := ConfigEnvs(name, service)
|
||||||
|
|
||||||
@ -240,13 +251,8 @@ func CreateService(name string, service kobject.ServiceConfig, objects []runtime
|
|||||||
// Configure the container ports.
|
// Configure the container ports.
|
||||||
ports := ConfigPorts(name, service)
|
ports := ConfigPorts(name, service)
|
||||||
|
|
||||||
// Configure the service ports.
|
|
||||||
servicePorts := ConfigServicePorts(name, service)
|
|
||||||
svc.Spec.Ports = servicePorts
|
|
||||||
|
|
||||||
// Configure annotations
|
// Configure annotations
|
||||||
annotations := transformer.ConfigAnnotations(service)
|
annotations := transformer.ConfigAnnotations(service)
|
||||||
svc.ObjectMeta.Annotations = annotations
|
|
||||||
|
|
||||||
// fillTemplate fills the pod template with the value calculated from config
|
// fillTemplate fills the pod template with the value calculated from config
|
||||||
fillTemplate := func(template *api.PodTemplateSpec) {
|
fillTemplate := func(template *api.PodTemplateSpec) {
|
||||||
@ -289,6 +295,4 @@ func CreateService(name string, service kobject.ServiceConfig, objects []runtime
|
|||||||
for _, obj := range objects {
|
for _, obj := range objects {
|
||||||
UpdateController(obj, fillTemplate, fillObjectMeta)
|
UpdateController(obj, fillTemplate, fillObjectMeta)
|
||||||
}
|
}
|
||||||
|
|
||||||
return svc
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -245,6 +245,8 @@ func (k *Kubernetes) Transform(komposeObject kobject.KomposeObject, opt kobject.
|
|||||||
objects = append(objects, svc)
|
objects = append(objects, svc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateKubernetesObjects(name, service, objects)
|
||||||
|
|
||||||
allobjects = append(allobjects, objects...)
|
allobjects = append(allobjects, objects...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user