Skip to content

Commit 56a3a74

Browse files
authored
Some cleanup (#446)
1 parent 02565bb commit 56a3a74

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

server/options.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"k8s.io/client-go/kubernetes"
1515
)
1616

17-
type ControllerOptions struct {
17+
type ExtraOptions struct {
1818
EnableRBAC bool
1919
StashImageTag string
2020
DockerRegistry string
@@ -27,8 +27,8 @@ type ControllerOptions struct {
2727
ResyncPeriod time.Duration
2828
}
2929

30-
func NewControllerOptions() *ControllerOptions {
31-
return &ControllerOptions{
30+
func NewExtraOptions() *ExtraOptions {
31+
return &ExtraOptions{
3232
DockerRegistry: docker.ACRegistry,
3333
StashImageTag: stringz.Val(v.Version.Version, "canary"),
3434
MaxNumRequeues: 5,
@@ -41,7 +41,7 @@ func NewControllerOptions() *ControllerOptions {
4141
}
4242
}
4343

44-
func (s *ControllerOptions) AddGoFlags(fs *flag.FlagSet) {
44+
func (s *ExtraOptions) AddGoFlags(fs *flag.FlagSet) {
4545
fs.StringVar(&s.OpsAddress, "ops-address", s.OpsAddress, "Address to listen on for web interface and telemetry.")
4646
fs.BoolVar(&s.EnableRBAC, "rbac", s.EnableRBAC, "Enable RBAC for operator")
4747
fs.StringVar(&s.ScratchDir, "scratch-dir", s.ScratchDir, "Directory used to store temporary files. Use an `emptyDir` in Kubernetes.")
@@ -53,13 +53,13 @@ func (s *ControllerOptions) AddGoFlags(fs *flag.FlagSet) {
5353
fs.DurationVar(&s.ResyncPeriod, "resync-period", s.ResyncPeriod, "If non-zero, will re-list this often. Otherwise, re-list will be delayed aslong as possible (until the upstream source closes the watch or times out.")
5454
}
5555

56-
func (s *ControllerOptions) AddFlags(fs *pflag.FlagSet) {
56+
func (s *ExtraOptions) AddFlags(fs *pflag.FlagSet) {
5757
pfs := flag.NewFlagSet("stash", flag.ExitOnError)
5858
s.AddGoFlags(pfs)
5959
fs.AddGoFlagSet(pfs)
6060
}
6161

62-
func (s *ControllerOptions) ApplyTo(cfg *controller.ControllerConfig) error {
62+
func (s *ExtraOptions) ApplyTo(cfg *controller.Config) error {
6363
var err error
6464

6565
cfg.EnableRBAC = s.EnableRBAC

server/start.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const defaultEtcdPathPrefix = "/registry/stash.appscode.com"
1818

1919
type StashOptions struct {
2020
RecommendedOptions *genericoptions.RecommendedOptions
21-
ControllerOptions *ControllerOptions
21+
ExtraOptions *ExtraOptions
2222

2323
StdOut io.Writer
2424
StdErr io.Writer
@@ -28,7 +28,7 @@ func NewStashOptions(out, errOut io.Writer) *StashOptions {
2828
o := &StashOptions{
2929
// TODO we will nil out the etcd storage options. This requires a later level of k8s.io/apiserver
3030
RecommendedOptions: genericoptions.NewRecommendedOptions(defaultEtcdPathPrefix, server.Codecs.LegacyCodec(admissionv1beta1.SchemeGroupVersion)),
31-
ControllerOptions: NewControllerOptions(),
31+
ExtraOptions: NewExtraOptions(),
3232
StdOut: out,
3333
StdErr: errOut,
3434
}
@@ -39,7 +39,7 @@ func NewStashOptions(out, errOut io.Writer) *StashOptions {
3939

4040
func (o StashOptions) AddFlags(fs *pflag.FlagSet) {
4141
o.RecommendedOptions.AddFlags(fs)
42-
o.ControllerOptions.AddFlags(fs)
42+
o.ExtraOptions.AddFlags(fs)
4343
}
4444

4545
func (o StashOptions) Validate(args []string) error {
@@ -75,14 +75,14 @@ func (o StashOptions) Config() (*server.StashConfig, error) {
7575
"/apis/admission.stash.appscode.com/v1alpha1/replicasets",
7676
}
7777

78-
controllerConfig := controller.NewControllerConfig(serverConfig.ClientConfig)
79-
if err := o.ControllerOptions.ApplyTo(controllerConfig); err != nil {
78+
extraConfig := controller.NewConfig(serverConfig.ClientConfig)
79+
if err := o.ExtraOptions.ApplyTo(extraConfig); err != nil {
8080
return nil, err
8181
}
8282

8383
config := &server.StashConfig{
84-
GenericConfig: serverConfig,
85-
ControllerConfig: controllerConfig,
84+
GenericConfig: serverConfig,
85+
ExtraConfig: extraConfig,
8686
}
8787
return config, nil
8888
}

0 commit comments

Comments
 (0)