forked from LaconicNetwork/kompose
Add --volumes parameter, deprecate emptyvols
This adds the --volumes paramater with a "generate" and "empty" By default, "generate" will be used as a place-holder for "true". Although not used in the code, we will eventually add "none" This uses CLI paramater naming processes (no emptyVols as that is Go / Kubernetes specific) and thus we use dashes.
This commit is contained in:
@@ -44,6 +44,7 @@ type ConvertOptions struct {
|
||||
GenerateYaml bool
|
||||
GenerateJSON bool
|
||||
EmptyVols bool
|
||||
Volumes string
|
||||
InsecureRepository bool
|
||||
Replicas int
|
||||
InputFiles []string
|
||||
|
||||
@@ -383,6 +383,10 @@ func (k *Kubernetes) ConfigVolumes(name string, service kobject.ServiceConfig) (
|
||||
// as opposed to persistent volumes and volume claims
|
||||
useEmptyVolumes := k.Opt.EmptyVols
|
||||
|
||||
if k.Opt.Volumes == "emptyDir" {
|
||||
useEmptyVolumes = true
|
||||
}
|
||||
|
||||
var count int
|
||||
//interating over array of `Vols` struct as it contains all necessary information about volumes
|
||||
for _, volume := range service.Volumes {
|
||||
@@ -684,7 +688,7 @@ func (k *Kubernetes) Deploy(komposeObject kobject.KomposeObject, opt kobject.Con
|
||||
}
|
||||
|
||||
pvcStr := " "
|
||||
if !opt.EmptyVols {
|
||||
if !opt.EmptyVols || opt.Volumes != "emptyDir" {
|
||||
pvcStr = " and PersistentVolumeClaims "
|
||||
}
|
||||
log.Info("We are going to create Kubernetes Deployments, Services" + pvcStr + "for your Dockerized application. " +
|
||||
@@ -736,7 +740,7 @@ func (k *Kubernetes) Deploy(komposeObject kobject.KomposeObject, opt kobject.Con
|
||||
}
|
||||
}
|
||||
|
||||
if !opt.EmptyVols {
|
||||
if !opt.EmptyVols || opt.Volumes != "emptyDir" {
|
||||
pvcStr = ",pvc"
|
||||
} else {
|
||||
pvcStr = ""
|
||||
|
||||
@@ -425,7 +425,7 @@ func (o *OpenShift) Deploy(komposeObject kobject.KomposeObject, opt kobject.Conv
|
||||
}
|
||||
|
||||
pvcStr := " "
|
||||
if !opt.EmptyVols {
|
||||
if !opt.EmptyVols || opt.Volumes != "emptyDir" {
|
||||
pvcStr = " and PersistentVolumeClaims "
|
||||
}
|
||||
log.Info("We are going to create OpenShift DeploymentConfigs, Services" + pvcStr + "for your Dockerized application. \n" +
|
||||
@@ -493,7 +493,7 @@ func (o *OpenShift) Deploy(komposeObject kobject.KomposeObject, opt kobject.Conv
|
||||
}
|
||||
}
|
||||
|
||||
if !opt.EmptyVols {
|
||||
if !opt.EmptyVols || opt.Volumes != "emptyDir" {
|
||||
pvcStr = ",pvc"
|
||||
} else {
|
||||
pvcStr = ""
|
||||
|
||||
Reference in New Issue
Block a user