Skip to content

Commit f2bb337

Browse files
NoevaMNoeva
authored andcommitted
Added --apply-namespace option
1 parent 7f6f08a commit f2bb337

File tree

3 files changed

+16
-33
lines changed

3 files changed

+16
-33
lines changed

clients/models/operation.go

Lines changed: 0 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

commands/blue_green_deploy_command.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (c *BlueGreenDeployCommand) GetPluginCommand() plugin.Command {
3333
HelpText: "Deploy a multi-target app using blue-green deployment",
3434
UsageDetails: plugin.Usage{
3535
Usage: `Deploy a multi-target app using blue-green deployment
36-
cf bg-deploy MTA [-e EXT_DESCRIPTOR[,...]] [-t TIMEOUT] [--version-rule VERSION_RULE] [-u URL] [-f] [--retries RETRIES] [--no-start] [--namespace NAMESPACE] [--apply-namespace-app-names=true/false] [--apply-namespace-service-names=true/false] [--apply-namespace-app-routes=true/false] [--delete-services] [--delete-service-keys] [--delete-service-brokers] [--keep-files] [--no-restart-subscribed-apps] [--no-confirm] [--skip-idle-start] [--do-not-fail-on-missing-permissions] [--abort-on-error] [--apps-start-timeout TIMEOUT] [--apps-stage-timeout TIMEOUT] [--apps-upload-timeout TIMEOUT] [--apps-task-execution-timeout TIMEOUT]
36+
cf bg-deploy MTA [-e EXT_DESCRIPTOR[,...]] [-t TIMEOUT] [--version-rule VERSION_RULE] [-u URL] [-f] [--retries RETRIES] [--no-start] [--namespace NAMESPACE] [--apply-namespace-app-names true/false] [--apply-namespace-service-names true/false] [--apply-namespace-app-routes true/false] [--delete-services] [--delete-service-keys] [--delete-service-brokers] [--keep-files] [--no-restart-subscribed-apps] [--no-confirm] [--skip-idle-start] [--do-not-fail-on-missing-permissions] [--abort-on-error] [--apps-start-timeout TIMEOUT] [--apps-stage-timeout TIMEOUT] [--apps-upload-timeout TIMEOUT] [--apps-task-execution-timeout TIMEOUT]
3737
3838
Perform action on an active deploy operation
3939
cf deploy -i OPERATION_ID -a ACTION [-u URL]`,
@@ -45,10 +45,10 @@ func (c *BlueGreenDeployCommand) GetPluginCommand() plugin.Command {
4545
actionOpt: "Action to perform on active deploy operation (abort, retry, resume, monitor)",
4646
forceOpt: "Force deploy without confirmation for aborting conflicting processes",
4747
util.GetShortOption(noStartOpt): "Do not start apps",
48-
util.GetShortOption(namespaceOpt): "(EXPERIMENTAL) Namespace for the mta, applied to app and service names as well",
49-
util.GetShortOption(applyNamespaceAppNamesOpt): "Apply namespace to application names",
50-
util.GetShortOption(applyNamespaceServiceNamesOpt): "Apply namespace to service names",
51-
util.GetShortOption(applyNamespaceAppRoutesOpt): "Apply namespace to application routes",
48+
util.GetShortOption(namespaceOpt): "(EXPERIMENTAL) Namespace for the MTA, applied on app names, app routes and service names",
49+
util.GetShortOption(applyNamespaceAppNamesOpt): "(EXPERIMENTAL) Apply namespace to application names: (true, false)",
50+
util.GetShortOption(applyNamespaceServiceNamesOpt): "(EXPERIMENTAL) Apply namespace to service names: (true, false)",
51+
util.GetShortOption(applyNamespaceAppRoutesOpt): "(EXPERIMENTAL) Apply namespace to application routes: (true, false)",
5252
util.GetShortOption(deleteServicesOpt): "Recreate changed services / delete discontinued services",
5353
util.GetShortOption(deleteServiceKeysOpt): "Delete existing service keys and apply the new ones",
5454
util.GetShortOption(deleteServiceBrokersOpt): "Delete discontinued service brokers",

commands/deploy_command.go

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ func (c *DeployCommand) GetPluginCommand() plugin.Command {
102102
UsageDetails: plugin.Usage{
103103
Usage: `Deploy a multi-target app archive
104104
105-
cf deploy MTA [-e EXT_DESCRIPTOR[,...]] [-t TIMEOUT] [--version-rule VERSION_RULE] [-u URL] [-f] [--retries RETRIES] [--no-start] [--namespace NAMESPACE] [--apply-namespace-app-names=true/false] [--apply-namespace-service-names=true/false] [--apply-namespace-app-routes=true/false] [--delete-services] [--delete-service-keys] [--delete-service-brokers] [--keep-files] [--no-restart-subscribed-apps] [--do-not-fail-on-missing-permissions] [--abort-on-error] [--strategy STRATEGY] [--skip-testing-phase] [--skip-idle-start] [--apps-start-timeout TIMEOUT] [--apps-stage-timeout TIMEOUT] [--apps-upload-timeout TIMEOUT] [--apps-task-execution-timeout TIMEOUT]
105+
cf deploy MTA [-e EXT_DESCRIPTOR[,...]] [-t TIMEOUT] [--version-rule VERSION_RULE] [-u URL] [-f] [--retries RETRIES] [--no-start] [--namespace NAMESPACE] [--apply-namespace-app-names true/false] [--apply-namespace-service-names true/false] [--apply-namespace-app-routes true/false] [--delete-services] [--delete-service-keys] [--delete-service-brokers] [--keep-files] [--no-restart-subscribed-apps] [--do-not-fail-on-missing-permissions] [--abort-on-error] [--strategy STRATEGY] [--skip-testing-phase] [--skip-idle-start] [--apps-start-timeout TIMEOUT] [--apps-stage-timeout TIMEOUT] [--apps-upload-timeout TIMEOUT] [--apps-task-execution-timeout TIMEOUT]
106106
107107
108108
Perform action on an active deploy operation
109109
cf deploy -i OPERATION_ID -a ACTION [-u URL]
110110
111111
(EXPERIMENTAL) Deploy a multi-target app archive referenced by a remote URL
112-
<write MTA archive URL to STDOUT> | cf deploy [-e EXT_DESCRIPTOR[,...]] [-t TIMEOUT] [--version-rule VERSION_RULE] [-u MTA_CONTROLLER_URL] [--retries RETRIES] [--no-start] [--namespace NAMESPACE] [--apply-namespace-app-names=true/false] [--apply-namespace-service-names=true/false] [--apply-namespace-app-routes=true/false] [--delete-services] [--delete-service-keys] [--delete-service-brokers] [--keep-files] [--no-restart-subscribed-apps] [--do-not-fail-on-missing-permissions] [--abort-on-error] [--strategy STRATEGY] [--skip-testing-phase] [--skip-idle-start] [--apps-start-timeout TIMEOUT] [--apps-stage-timeout TIMEOUT] [--apps-upload-timeout TIMEOUT] [--apps-task-execution-timeout TIMEOUT]`,
112+
<write MTA archive URL to STDOUT> | cf deploy [-e EXT_DESCRIPTOR[,...]] [-t TIMEOUT] [--version-rule VERSION_RULE] [-u MTA_CONTROLLER_URL] [--retries RETRIES] [--no-start] [--namespace NAMESPACE] [--apply-namespace-app-names true/false] [--apply-namespace-service-names true/false] [--apply-namespace-app-routes true/false] [--delete-services] [--delete-service-keys] [--delete-service-brokers] [--keep-files] [--no-restart-subscribed-apps] [--do-not-fail-on-missing-permissions] [--abort-on-error] [--strategy STRATEGY] [--skip-testing-phase] [--skip-idle-start] [--apps-start-timeout TIMEOUT] [--apps-stage-timeout TIMEOUT] [--apps-upload-timeout TIMEOUT] [--apps-task-execution-timeout TIMEOUT]`,
113113

114114
Options: map[string]string{
115115
extDescriptorsOpt: "Extension descriptors",
@@ -121,10 +121,10 @@ func (c *DeployCommand) GetPluginCommand() plugin.Command {
121121
moduleOpt: "Deploy list of modules which are contained in the deployment descriptor, in the current location",
122122
resourceOpt: "Deploy list of resources which are contained in the deployment descriptor, in the current location",
123123
util.GetShortOption(noStartOpt): "Do not start apps",
124-
util.GetShortOption(namespaceOpt): "(EXPERIMENTAL) Namespace for the mta, applied to app and service names as well",
125-
util.GetShortOption(applyNamespaceAppNamesOpt): "Apply namespace to application names",
126-
util.GetShortOption(applyNamespaceServiceNamesOpt): "Apply namespace to service names",
127-
util.GetShortOption(applyNamespaceAppRoutesOpt): "Apply namespace to application routes",
124+
util.GetShortOption(namespaceOpt): "(EXPERIMENTAL) Namespace for the MTA, applied on app names, app routes and service names",
125+
util.GetShortOption(applyNamespaceAppNamesOpt): "(EXPERIMENTAL) Apply namespace to application names: (true, false)",
126+
util.GetShortOption(applyNamespaceServiceNamesOpt): "(EXPERIMENTAL) Apply namespace to service names: (true, false)",
127+
util.GetShortOption(applyNamespaceAppRoutesOpt): "(EXPERIMENTAL) Apply namespace to application routes: (true, false)",
128128
util.GetShortOption(deleteServicesOpt): "Recreate changed services / delete discontinued services",
129129
util.GetShortOption(deleteServiceKeysOpt): "Delete existing service keys and apply the new ones",
130130
util.GetShortOption(deleteServiceBrokersOpt): "Delete discontinued service brokers",
@@ -348,15 +348,10 @@ func (c *DeployCommand) executeInternal(positionalArgs []string, dsHost string,
348348
// Build the process instance
349349
processBuilder := NewDeploymentStrategy(flags, c.processTypeProvider).CreateProcessBuilder()
350350
processBuilder.Namespace(namespace)
351-
if(namespace == "") {
352-
processBuilder.Parameter("applyNamespaceAppNames", "false")
353-
processBuilder.Parameter("applyNamespaceServiceNames", "false")
354-
processBuilder.Parameter("applyNamespaceAppRoutes", "false")
355-
} else {
356-
processBuilder.Parameter("applyNamespaceAppNames", GetStringOpt(applyNamespaceAppNamesOpt, flags))
357-
processBuilder.Parameter("applyNamespaceServiceNames", GetStringOpt(applyNamespaceServiceNamesOpt, flags))
358-
processBuilder.Parameter("applyNamespaceAppRoutes", GetStringOpt(applyNamespaceAppRoutesOpt, flags))
359-
}
351+
processBuilder.Parameter("applyNamespaceAppNames", GetStringOpt(applyNamespaceAppNamesOpt, flags))
352+
processBuilder.Parameter("applyNamespaceServiceNames", GetStringOpt(applyNamespaceServiceNamesOpt, flags))
353+
processBuilder.Parameter("applyNamespaceAppRoutes", GetStringOpt(applyNamespaceAppRoutesOpt, flags))
354+
360355
processBuilder.Parameter("appArchiveId", strings.Join(uploadedArchivePartIds, ","))
361356
processBuilder.Parameter("mtaExtDescriptorId", strings.Join(uploadedExtDescriptorIDs, ","))
362357
processBuilder.Parameter("mtaId", mtaId)
@@ -709,7 +704,7 @@ func ValidateBooleanFlag(flagName string, flags *flag.FlagSet) error {
709704
}
710705

711706
if flagValueStr != "true" && flagValueStr != "false" {
712-
return fmt.Errorf("invalid value for %s: %s. Expected true or false.", flagName, flagValueStr)
707+
return fmt.Errorf("Invalid value for %s: %s. Expected true or false.", flagName, flagValueStr)
713708
}
714709

715710
return nil

0 commit comments

Comments
 (0)