forked from thetirefire/badidea
-
Notifications
You must be signed in to change notification settings - Fork 2
/
options.go
39 lines (30 loc) · 914 Bytes
/
options.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
31
32
33
34
35
36
37
38
39
package options
import (
"errors"
"github.com/spf13/pflag"
)
type Options struct {
FromKubeconfig string
ToKubeconfig string
PodNamespace string
}
func NewOptions() *Options {
return &Options{}
}
func (options *Options) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&options.FromKubeconfig, "from-kubeconfig", options.FromKubeconfig, "Kubeconfig file for - from cluster.")
fs.StringVar(&options.ToKubeconfig, "to-kubeconfig", options.ToKubeconfig, "Kubeconfig file for - to cluster.")
fs.StringVar(&options.PodNamespace, "pod-namespace", "default", "The running namespace of the syncer pod")
}
func (options *Options) Complete() error {
return nil
}
func (options *Options) Validate() error {
if options.FromKubeconfig == "" {
return errors.New("--from-kubeconfig is required")
}
// if options.ToKubeconfig == "" {
// return errors.New("--to-kubeconfig is required")
// }
return nil
}