Make sure that Services are first in the List

Sorts objects in Transform function, this should
make sure that Services are first everywhere as
long as we keep order in the slice that Transform returns.

fixes #130
This commit is contained in:
Tomas Kral
2016-09-02 10:09:00 +02:00
parent b24556e9d5
commit e2da0f089a
4 changed files with 28 additions and 24 deletions
+4 -2
View File
@@ -62,7 +62,8 @@ func initDeploymentConfig(name string, service kobject.ServiceConfig, replicas i
return dc
}
// Maps komposeObject to openshift objects
// Transform maps komposeObject to openshift objects
// returns objects that are already sorted in the way that Services are first
func (k *OpenShift) Transform(komposeObject kobject.KomposeObject, opt kobject.ConvertOptions) []runtime.Object {
// this will hold all the converted data
var allobjects []runtime.Object
@@ -84,6 +85,7 @@ func (k *OpenShift) Transform(komposeObject kobject.KomposeObject, opt kobject.C
allobjects = append(allobjects, objects...)
}
// sort all object so Services are first
kubernetes.SortServicesFirst(&allobjects)
return allobjects
}