@@ -47,6 +47,9 @@ const (
47
47
stageTimeoutOpt = "apps-stage-timeout"
48
48
uploadTimeoutOpt = "apps-upload-timeout"
49
49
taskExecutionTimeoutOpt = "apps-task-execution-timeout"
50
+ applyNamespaceAppNamesOpt = "apply-namespace-app-names"
51
+ applyNamespaceServiceNamesOpt = "apply-namespace-service-names"
52
+ applyNamespaceAppRoutesOpt = "apply-namespace-app-routes"
50
53
)
51
54
52
55
type listFlag struct {
@@ -98,13 +101,16 @@ func (c *DeployCommand) GetPluginCommand() plugin.Command {
98
101
HelpText : "Deploy a new multi-target app or sync changes to an existing one" ,
99
102
UsageDetails : plugin.Usage {
100
103
Usage : `Deploy a multi-target app archive
101
- cf deploy MTA [-e EXT_DESCRIPTOR[,...]] [-t TIMEOUT] [--version-rule VERSION_RULE] [-u URL] [-f] [--retries RETRIES] [--no-start] [--namespace NAMESPACE] [--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]
104
+
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]
106
+
102
107
103
108
Perform action on an active deploy operation
104
109
cf deploy -i OPERATION_ID -a ACTION [-u URL]
105
110
106
111
(EXPERIMENTAL) Deploy a multi-target app archive referenced by a remote URL
107
- <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] [--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]` ,
113
+
108
114
Options : map [string ]string {
109
115
extDescriptorsOpt : "Extension descriptors" ,
110
116
deployServiceURLOpt : "Deploy service URL, by default 'deploy-service.<system-domain>'" ,
@@ -115,7 +121,10 @@ func (c *DeployCommand) GetPluginCommand() plugin.Command {
115
121
moduleOpt : "Deploy list of modules which are contained in the deployment descriptor, in the current location" ,
116
122
resourceOpt : "Deploy list of resources which are contained in the deployment descriptor, in the current location" ,
117
123
util .GetShortOption (noStartOpt ): "Do not start apps" ,
118
- util .GetShortOption (namespaceOpt ): "(EXPERIMENTAL) Namespace for the mta, applied to app and service names as well" ,
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)" ,
119
128
util .GetShortOption (deleteServicesOpt ): "Recreate changed services / delete discontinued services" ,
120
129
util .GetShortOption (deleteServiceKeysOpt ): "Delete existing service keys and apply the new ones" ,
121
130
util .GetShortOption (deleteServiceBrokersOpt ): "Delete discontinued service brokers" ,
@@ -189,7 +198,10 @@ func (c *DeployCommand) defineCommandOptions(flags *flag.FlagSet) {
189
198
flags .String (versionRuleOpt , "" , "" )
190
199
flags .Bool (deleteServicesOpt , false , "" )
191
200
flags .Bool (noStartOpt , false , "" )
192
- flags .String (namespaceOpt , "" , "" )
201
+ flags .String (namespaceOpt , "" , "" )
202
+ flags .String (applyNamespaceAppNamesOpt , "" , "" )
203
+ flags .String (applyNamespaceServiceNamesOpt , "" , "" )
204
+ flags .String (applyNamespaceAppRoutesOpt , "" , "" )
193
205
flags .Bool (deleteServiceKeysOpt , false , "" )
194
206
flags .Bool (deleteServiceBrokersOpt , false , "" )
195
207
flags .Bool (keepFilesOpt , false , "" )
@@ -336,6 +348,10 @@ func (c *DeployCommand) executeInternal(positionalArgs []string, dsHost string,
336
348
// Build the process instance
337
349
processBuilder := NewDeploymentStrategy (flags , c .processTypeProvider ).CreateProcessBuilder ()
338
350
processBuilder .Namespace (namespace )
351
+ processBuilder .Parameter ("applyNamespaceAppNames" , GetStringOpt (applyNamespaceAppNamesOpt , flags ))
352
+ processBuilder .Parameter ("applyNamespaceServiceNames" , GetStringOpt (applyNamespaceServiceNamesOpt , flags ))
353
+ processBuilder .Parameter ("applyNamespaceAppRoutes" , GetStringOpt (applyNamespaceAppRoutesOpt , flags ))
354
+
339
355
processBuilder .Parameter ("appArchiveId" , strings .Join (uploadedArchivePartIds , "," ))
340
356
processBuilder .Parameter ("mtaExtDescriptorId" , strings .Join (uploadedExtDescriptorIDs , "," ))
341
357
processBuilder .Parameter ("mtaId" , mtaId )
@@ -652,28 +668,13 @@ func (deployCommandFlagsValidator) ValidateParsedFlags(flags *flag.FlagSet) erro
652
668
err = fmt .Errorf ("%s is not a valid deployment strategy, available strategies: %v" , f .Value .String (), AvailableStrategies ())
653
669
return
654
670
}
655
- case timeoutOpt :
656
- if e := ValidateTimeoutOption (f .Name , flags , 259200 ); e != nil {
657
- err = e
658
- return
659
- }
660
- case startTimeoutOpt :
661
- if e := ValidateTimeoutOption (f .Name , flags , 259200 ); e != nil {
662
- err = e
663
- return
664
- }
665
- case stageTimeoutOpt :
666
- if e := ValidateTimeoutOption (f .Name , flags , 259200 ); e != nil {
667
- err = e
668
- return
669
- }
670
- case uploadTimeoutOpt :
671
+ case timeoutOpt , startTimeoutOpt , stageTimeoutOpt , uploadTimeoutOpt , taskExecutionTimeoutOpt :
671
672
if e := ValidateTimeoutOption (f .Name , flags , 259200 ); e != nil {
672
673
err = e
673
674
return
674
675
}
675
- case taskExecutionTimeoutOpt :
676
- if e := ValidateTimeoutOption (f .Name , flags , 259200 ); e != nil {
676
+ case applyNamespaceAppNamesOpt , applyNamespaceServiceNamesOpt , applyNamespaceAppRoutesOpt :
677
+ if e := ValidateBooleanFlag (f .Name , flags ); e != nil {
677
678
err = e
678
679
return
679
680
}
@@ -694,3 +695,17 @@ func ValidateTimeoutOption(optionName string, flags *flag.FlagSet, maxAllowedVal
694
695
}
695
696
return nil
696
697
}
698
+
699
+ func ValidateBooleanFlag (flagName string , flags * flag.FlagSet ) error {
700
+ flagValueStr := flags .Lookup (flagName ).Value .String ()
701
+
702
+ if flagValueStr == "" {
703
+ return fmt .Errorf ("%s flag defined but no argument specified" , flagName )
704
+ }
705
+
706
+ if flagValueStr != "true" && flagValueStr != "false" {
707
+ return fmt .Errorf ("Invalid value for %s: %s. Expected true or false." , flagName , flagValueStr )
708
+ }
709
+
710
+ return nil
711
+ }
0 commit comments