Handling Volume at early stage

It will resolve #544 as well as refactor volume handling part.
This commit is contained in:
Suraj Narwade
2017-07-26 19:59:05 +05:30
parent be17e101b9
commit d5a5f42d8b
15 changed files with 1161 additions and 140 deletions
+1 -4
View File
@@ -470,10 +470,7 @@ func (o *OpenShift) Transform(komposeObject kobject.KomposeObject, opt kobject.C
allobjects = append(allobjects, objects...)
}
// If docker-compose has a volumes_from directive it will be handled here
o.VolumesFrom(&allobjects, komposeObject)
// sort all object so all services are first
// sort all object so Services are first
o.SortServicesFirst(&allobjects)
return allobjects, nil
+3 -2
View File
@@ -42,7 +42,7 @@ func newServiceConfig() kobject.ServiceConfig {
Command: []string{"cmd"},
WorkingDir: "dir",
Args: []string{"arg1", "arg2"},
Volumes: []string{"/tmp/volume"},
VolList: []string{"/tmp/volume"},
Network: []string{"network1", "network2"}, // not supported
Labels: nil,
Annotations: map[string]string{"abc": "def"},
@@ -406,7 +406,8 @@ func TestRecreateStrategyWithVolumesPresent(t *testing.T) {
service := kobject.ServiceConfig{
ContainerName: "name",
Image: "image",
Volumes: []string{"/tmp/volume"},
VolList: []string{"/tmp/volume"},
Volumes: []kobject.Volumes{{SvcName: "app", MountPath: "/tmp/volume", PVCName: "app-claim0"}},
}
komposeObject := kobject.KomposeObject{
ServiceConfigs: map[string]kobject.ServiceConfig{"app": service},