cli: add --emptyvols option

This commit is contained in:
Dusty Mabe 2016-10-25 23:38:11 -04:00
parent df09fd5193
commit 9ce3f0cf15
No known key found for this signature in database
GPG Key ID: 3302DBD73952E671
4 changed files with 13 additions and 1 deletions

View File

@ -139,6 +139,7 @@ func Convert(c *cli.Context) {
CreateDS: c.BoolT("daemonset"),
CreateRC: c.BoolT("replicationcontroller"),
CreateDeploymentConfig: c.BoolT("deploymentconfig"),
EmptyVols: c.BoolT("emptyvols"),
}
validateFlags(c, &opt)

View File

@ -88,6 +88,10 @@ func ConvertKubernetesCommand() cli.Command {
Name: "chart,c",
Usage: "Create a Helm chart for converted objects",
},
cli.BoolFlag{
Name: "emptyvols",
Usage: "Use Empty Volumes. Don't generate PVCs",
},
cli.BoolFlag{
Name: "deployment,d",
Usage: "Generate a Kubernetes deployment object (default on)",
@ -119,6 +123,10 @@ func ConvertOpenShiftCommand() cli.Command {
Name: "deploymentconfig,dc",
Usage: "Generate a OpenShift DeploymentConfig object",
},
cli.BoolFlag{
Name: "emptyvols",
Usage: "Use Empty Volumes. Don't generate PVCs",
},
},
}
command.Flags = append(command.Flags, commonConvertFlags()...)

View File

@ -113,6 +113,7 @@ type ConvertOptions struct {
CreateDeploymentConfig bool
CreateChart bool
GenerateYaml bool
EmptyVols bool
Replicas int
InputFile string
OutFile string

View File

@ -223,7 +223,9 @@ func (k *Kubernetes) ConfigVolumes(name string, service kobject.ServiceConfig) (
volumes := []api.Volume{}
var PVCs []*api.PersistentVolumeClaim
useEmptyVolumes := true
// Set a var based on if the user wants to use emtpy volumes
// as opposed to persistent volumes and volume claims
useEmptyVolumes := k.Opt.EmptyVols
var count int
for _, volume := range service.Volumes {