@@ -50,6 +50,8 @@ const (
5050 applyNamespaceAppNamesOpt = "apply-namespace-app-names"
5151 applyNamespaceServiceNamesOpt = "apply-namespace-service-names"
5252 applyNamespaceAppRoutesOpt = "apply-namespace-app-routes"
53+ applyNamespaceAsSuffix = "apply-namespace-as-suffix"
54+ maxNamespaceSize = 36
5355)
5456
5557type listFlag struct {
@@ -102,14 +104,14 @@ func (c *DeployCommand) GetPluginCommand() plugin.Command {
102104 UsageDetails : plugin.Usage {
103105 Usage : `Deploy a multi-target app archive
104106
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]
107+ 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] [--apply-namespace-as-suffix 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]
106108
107109
108110 Perform action on an active deploy operation
109111 cf deploy -i OPERATION_ID -a ACTION [-u URL]
110112
111113 (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]` ,
114+ <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] [--apply-namespace-as-suffix 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]` ,
113115
114116 Options : map [string ]string {
115117 extDescriptorsOpt : "Extension descriptors" ,
@@ -125,6 +127,7 @@ func (c *DeployCommand) GetPluginCommand() plugin.Command {
125127 util .GetShortOption (applyNamespaceAppNamesOpt ): "(EXPERIMENTAL) Apply namespace to application names: (true, false)" ,
126128 util .GetShortOption (applyNamespaceServiceNamesOpt ): "(EXPERIMENTAL) Apply namespace to service names: (true, false)" ,
127129 util .GetShortOption (applyNamespaceAppRoutesOpt ): "(EXPERIMENTAL) Apply namespace to application routes: (true, false)" ,
130+ util .GetShortOption (applyNamespaceAsSuffix ): "(EXPERIMENTAL) Apply namespace as a suffix rather than a prefix: (true, false)" ,
128131 util .GetShortOption (deleteServicesOpt ): "Recreate changed services / delete discontinued services" ,
129132 util .GetShortOption (deleteServiceKeysOpt ): "Delete existing service keys and apply the new ones" ,
130133 util .GetShortOption (deleteServiceBrokersOpt ): "Delete discontinued service brokers" ,
@@ -202,6 +205,7 @@ func (c *DeployCommand) defineCommandOptions(flags *flag.FlagSet) {
202205 flags .String (applyNamespaceAppNamesOpt , "" , "" )
203206 flags .String (applyNamespaceServiceNamesOpt , "" , "" )
204207 flags .String (applyNamespaceAppRoutesOpt , "" , "" )
208+ flags .String (applyNamespaceAsSuffix , "" , "" )
205209 flags .Bool (deleteServiceKeysOpt , false , "" )
206210 flags .Bool (deleteServiceBrokersOpt , false , "" )
207211 flags .Bool (keepFilesOpt , false , "" )
@@ -351,6 +355,7 @@ func (c *DeployCommand) executeInternal(positionalArgs []string, dsHost string,
351355 processBuilder .Parameter ("applyNamespaceAppNames" , GetStringOpt (applyNamespaceAppNamesOpt , flags ))
352356 processBuilder .Parameter ("applyNamespaceServiceNames" , GetStringOpt (applyNamespaceServiceNamesOpt , flags ))
353357 processBuilder .Parameter ("applyNamespaceAppRoutes" , GetStringOpt (applyNamespaceAppRoutesOpt , flags ))
358+ processBuilder .Parameter ("applyNamespaceAsSuffix" , GetStringOpt (applyNamespaceAsSuffix , flags ))
354359
355360 processBuilder .Parameter ("appArchiveId" , strings .Join (uploadedArchivePartIds , "," ))
356361 processBuilder .Parameter ("mtaExtDescriptorId" , strings .Join (uploadedExtDescriptorIDs , "," ))
@@ -668,12 +673,17 @@ func (deployCommandFlagsValidator) ValidateParsedFlags(flags *flag.FlagSet) erro
668673 err = fmt .Errorf ("%s is not a valid deployment strategy, available strategies: %v" , f .Value .String (), AvailableStrategies ())
669674 return
670675 }
676+ case namespaceOpt :
677+ if len (f .Value .String ()) > maxNamespaceSize {
678+ err = fmt .Errorf ("Invalid value for namespace. The namespace cannot be more than %d symbols." , maxNamespaceSize )
679+ return
680+ }
671681 case timeoutOpt , startTimeoutOpt , stageTimeoutOpt , uploadTimeoutOpt , taskExecutionTimeoutOpt :
672682 if e := ValidateTimeoutOption (f .Name , flags , 259200 ); e != nil {
673683 err = e
674684 return
675685 }
676- case applyNamespaceAppNamesOpt , applyNamespaceServiceNamesOpt , applyNamespaceAppRoutesOpt :
686+ case applyNamespaceAppNamesOpt , applyNamespaceServiceNamesOpt , applyNamespaceAppRoutesOpt , applyNamespaceAsSuffix :
677687 if e := ValidateBooleanFlag (f .Name , flags ); e != nil {
678688 err = e
679689 return
0 commit comments