Add support for compose v3.2

This commit is contained in:
Hang Yan 2018-03-09 00:13:10 +08:00
parent 6bdaeafe2a
commit 61ff9eeeaa
2 changed files with 8 additions and 8 deletions

View File

@ -182,7 +182,7 @@ func (c *Compose) LoadFile(files []string) (kobject.KomposeObject, error) {
}
return komposeObject, nil
// Use docker/cli for 3
case "3", "3.0":
case "3", "3.0", "3.1", "3.2":
komposeObject, err := parseV3(files)
if err != nil {
return kobject.KomposeObject{}, err

View File

@ -167,10 +167,10 @@ func (k *Kubernetes) InitConfigMap(name string, service kobject.ServiceConfig, o
}
// Remove root pathing
// replace all other slashes / preiods
// replace all other slashes / periods
envName := FormatEnvName(envFile)
// In order to differentiate files, we append to the name and remove '.env' if applicate from the file name
// In order to differentiate files, we append to the name and remove '.env' if applicable from the file name
configMap := &api.ConfigMap{
TypeMeta: unversioned.TypeMeta{
Kind: "ConfigMap",
@ -279,7 +279,7 @@ func (k *Kubernetes) initIngress(name string, service kobject.ServiceConfig, por
// CreatePVC initializes PersistentVolumeClaim
func (k *Kubernetes) CreatePVC(name string, mode string, size string) (*api.PersistentVolumeClaim, error) {
volsize, err := resource.ParseQuantity(size)
volSize, err := resource.ParseQuantity(size)
if err != nil {
return nil, errors.Wrap(err, "resource.ParseQuantity failed, Error parsing size")
}
@ -296,7 +296,7 @@ func (k *Kubernetes) CreatePVC(name string, mode string, size string) (*api.Pers
Spec: api.PersistentVolumeClaimSpec{
Resources: api.ResourceRequirements{
Requests: api.ResourceList{
api.ResourceStorage: volsize,
api.ResourceStorage: volSize,
},
},
},
@ -437,7 +437,7 @@ func (k *Kubernetes) ConfigVolumes(name string, service kobject.ServiceConfig) (
}
var count int
//interating over array of `Vols` struct as it contains all necessary information about volumes
//iterating over array of `Vols` struct as it contains all necessary information about volumes
for _, volume := range service.Volumes {
// check if ro/rw mode is defined, default rw
@ -453,12 +453,12 @@ func (k *Kubernetes) ConfigVolumes(name string, service kobject.ServiceConfig) (
} else {
volumeName = volume.VolumeName
}
volmount := api.VolumeMount{
volMount := api.VolumeMount{
Name: volumeName,
ReadOnly: readonly,
MountPath: volume.Container,
}
volumeMounts = append(volumeMounts, volmount)
volumeMounts = append(volumeMounts, volMount)
// Get a volume source based on the type of volume we are using
// For PVC we will also create a PVC object and add to list
var volsource *api.VolumeSource