Option to keep or remove prefix when router triggers prefix based function (#2133)
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
@@ -33,7 +33,8 @@ func Commands() *cobra.Command {
|
||||
Required: []flag.Flag{flag.HtFnName},
|
||||
Optional: []flag.Flag{flag.HtUrl, flag.HtName, flag.HtMethod, flag.HtIngress,
|
||||
flag.HtIngressRule, flag.HtIngressAnnotation, flag.HtIngressTLS,
|
||||
flag.HtFnWeight, flag.HtHost, flag.NamespaceFunction, flag.SpecSave, flag.SpecDry, flag.HtPrefix},
|
||||
flag.HtFnWeight, flag.HtHost, flag.NamespaceFunction, flag.SpecSave, flag.SpecDry,
|
||||
flag.HtPrefix, flag.HtKeepPrefix},
|
||||
})
|
||||
|
||||
getCmd := &cobra.Command{
|
||||
@@ -56,7 +57,8 @@ func Commands() *cobra.Command {
|
||||
Required: []flag.Flag{flag.HtName},
|
||||
Optional: []flag.Flag{flag.HtUrl, flag.HtFnName,
|
||||
flag.HtMethod, flag.HtIngress, flag.HtIngressRule, flag.HtIngressAnnotation,
|
||||
flag.HtIngressTLS, flag.HtFnWeight, flag.HtHost, flag.NamespaceTrigger, flag.HtPrefix},
|
||||
flag.HtIngressTLS, flag.HtFnWeight, flag.HtHost, flag.NamespaceTrigger,
|
||||
flag.HtPrefix, flag.HtKeepPrefix},
|
||||
})
|
||||
|
||||
deleteCmd := &cobra.Command{
|
||||
|
||||
@@ -179,9 +179,14 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
CreateIngress: createIngress,
|
||||
IngressConfig: *ingressConfig,
|
||||
Prefix: &prefix,
|
||||
KeepPrefix: input.Bool(flagkey.HtKeepPrefix),
|
||||
},
|
||||
}
|
||||
|
||||
if input.IsSet(flagkey.HtKeepPrefix) {
|
||||
opts.trigger.Spec.KeepPrefix = input.Bool(flagkey.HtKeepPrefix)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,10 @@ func (opts *UpdateSubCommand) complete(input cli.Input) error {
|
||||
ht.Spec.RelativeURL = triggerUrl
|
||||
ht.Spec.Prefix = &prefix
|
||||
|
||||
if input.IsSet(flagkey.HtKeepPrefix) {
|
||||
ht.Spec.KeepPrefix = input.Bool(flagkey.HtKeepPrefix)
|
||||
}
|
||||
|
||||
methods := input.StringSlice(flagkey.HtMethod)
|
||||
if len(methods) > 0 {
|
||||
for _, method := range methods {
|
||||
|
||||
@@ -134,6 +134,7 @@ var (
|
||||
HtFnWeight = Flag{Type: IntSlice, Name: flagkey.HtFnWeight, Usage: "Weight for each function supplied with --function flag, in the same order. Used for canary deployment"}
|
||||
HtFnFilter = Flag{Type: String, Name: flagkey.HtFilter, Usage: "Name of the function for trigger(s)"}
|
||||
HtPrefix = Flag{Type: String, Name: flagkey.HtPrefix, Usage: "Prefix with which functions are exposed. NOTE: Prefix takes precedence over URL/RelativeURL"}
|
||||
HtKeepPrefix = Flag{Type: Bool, Name: flagkey.HtKeepPrefix, Usage: "Keep the prefix in the URL while forwarding request to the function"}
|
||||
|
||||
TtName = Flag{Type: String, Name: flagkey.TtName, Usage: "Time Trigger name"}
|
||||
TtCron = Flag{Type: String, Name: flagkey.TtCron, Usage: "Time trigger cron spec with each asterisk representing respectively second, minute, hour, the day of the month, month and day of the week. Also supports readable formats like '@every 5m', '@hourly'"}
|
||||
|
||||
@@ -87,6 +87,7 @@ const (
|
||||
HtFnWeight = "weight"
|
||||
HtFilter = HtFnName
|
||||
HtPrefix = "prefix"
|
||||
HtKeepPrefix = "keepprefix"
|
||||
|
||||
TtName = resourceName
|
||||
TtCron = "cron"
|
||||
|
||||
Reference in New Issue
Block a user