Added support for different namespaces

Now we can deploy application in different namespaces using the "--namespace=<value>" flag with kompose up and kompose down. The --namepace flag will deploy the application in that particular "namespace" if exist."
This commit is contained in:
Abhishek
2017-04-12 18:40:32 +05:30
parent cba4c569a3
commit f41985a00e
5 changed files with 43 additions and 8 deletions
+7 -3
View File
@@ -26,7 +26,8 @@ import (
// TODO: comment
var (
DownOpt kobject.ConvertOptions
DownNamespace string
DownOpt kobject.ConvertOptions
)
var downCmd = &cobra.Command{
@@ -37,8 +38,10 @@ var downCmd = &cobra.Command{
// Create the Convert options.
DownOpt = kobject.ConvertOptions{
InputFiles: GlobalFiles,
Provider: strings.ToLower(GlobalProvider),
InputFiles: GlobalFiles,
Provider: strings.ToLower(GlobalProvider),
Namespace: DownNamespace,
IsNamespaceFlag: cmd.Flags().Lookup("namespace").Changed,
}
// Validate before doing anything else.
@@ -50,5 +53,6 @@ var downCmd = &cobra.Command{
}
func init() {
downCmd.Flags().StringVar(&DownNamespace, "namespace", "default", " Specify Namespace to deploy your application")
RootCmd.AddCommand(downCmd)
}
+4
View File
@@ -29,6 +29,7 @@ var (
UpReplicas int
UpEmptyVols bool
UpInsecureRepo bool
UpNamespace string
UpOpt kobject.ConvertOptions
)
@@ -44,7 +45,9 @@ var upCmd = &cobra.Command{
InputFiles: GlobalFiles,
Provider: strings.ToLower(GlobalProvider),
EmptyVols: UpEmptyVols,
Namespace: UpNamespace,
InsecureRepository: UpInsecureRepo,
IsNamespaceFlag: cmd.Flags().Lookup("namespace").Changed,
}
// Validate before doing anything else.
@@ -59,5 +62,6 @@ func init() {
upCmd.Flags().BoolVar(&UpEmptyVols, "emptyvols", false, "Use empty volumes. Do not generate PersistentVolumeClaim")
upCmd.Flags().IntVar(&UpReplicas, "replicas", 1, "Specify the number of replicas generated")
upCmd.Flags().BoolVar(&UpInsecureRepo, "insecure-repository", false, "Use an insecure Docker repository for OpenShift ImageStream")
upCmd.Flags().StringVar(&UpNamespace, "namespace", "default", "Specify Namespace to deploy your application")
RootCmd.AddCommand(upCmd)
}