Merge pull request #107 from surajssd/port-checking

Abstracted port checking function
This commit is contained in:
Suraj Deshmukh authored and GitHub committed 2016-08-16 16:13:31 +05:30
commit 08488f8fdc
3 files changed
+12 -6

No files matched your search

+9
View File
@@ -213,3 +213,12 @@ func convertToVersion(objs []runtime.Object) ([]runtime.Object, error) {
return ret, nil
}
func PortsExist(name string, service kobject.ServiceConfig) bool {
if len(service.Port) == 0 {
logrus.Warningf("[%s] Service cannot be created because of missing port.", name)
return false
} else {
return true
}
}
+2 -3
View File
@@ -314,11 +314,10 @@ func (k *Kubernetes) Transform(komposeObject kobject.KomposeObject, opt kobject.
}
// If ports not provided in configuration we will not make service
if len(ports) == 0 {
logrus.Warningf("[%s] Service cannot be created because of missing port.", name)
} else {
if PortsExist(name, service) {
objects = append(objects, sc)
}
allobjects = append(allobjects, objects...)
}
+1 -3
View File
@@ -153,9 +153,7 @@ func (k *OpenShift) Transform(komposeObject kobject.KomposeObject, opt kobject.C
}
// If ports not provided in configuration we will not make service
if len(ports) == 0 {
logrus.Warningf("[%s] Service cannot be created because of missing port.", name)
} else {
if kubernetes.PortsExist(name, service) {
objects = append(objects, sc)
}
allobjects = append(allobjects, objects...)