forked from joeholley/supergloo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrules_shared.go
30 lines (24 loc) · 916 Bytes
/
rules_shared.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package flagutils
import (
"fmt"
"github.com/solo-io/supergloo/cli/pkg/options"
"github.com/spf13/pflag"
)
func addSelectorFlags(prefix, direction string, set *pflag.FlagSet, in *options.Selector) {
set.Var(&in.SelectedUpstreams,
prefix+"-"+"upstreams",
fmt.Sprintf("apply this rule to requests %v these upstreams. format must be <NAMESPACE>.<NAME>.", direction))
set.Var(&in.SelectedLabels,
prefix+"-"+"labels",
fmt.Sprintf("apply this rule to requests %v pods with these labels. format must be KEY=VALUE", direction))
set.StringSliceVar(&in.SelectedNamespaces,
prefix+"-"+"namespaces",
nil,
fmt.Sprintf("apply this rule to requests %v pods in these namespaces", direction))
}
func addTargetMeshFlags(set *pflag.FlagSet, in *options.ResourceRefValue) {
set.Var(in,
"target-mesh",
"select the target mesh or mesh group to which to apply this rule. format must be NAMESPACE.NAME",
)
}