Skip to content

Commit eb5a018

Browse files
rename GetControllerManagerConfiguration to Complete
Signed-off-by: Chris Hein <[email protected]>
1 parent 8d01076 commit eb5a018

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

pkg/config/config.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ import (
3232
type ControllerManagerConfiguration interface {
3333
runtime.Object
3434

35-
// GetControllerManagerConfiguration returns the versioned configuration
36-
GetControllerManagerConfiguration() (v1alpha1.ControllerManagerConfigurationSpec, error)
35+
// Complete returns the versioned configuration
36+
Complete() (v1alpha1.ControllerManagerConfigurationSpec, error)
3737
}
3838

3939
// DeferredFileLoader is used to configure the decoder for loading controller
@@ -62,13 +62,13 @@ func File() *DeferredFileLoader {
6262
}
6363
}
6464

65-
// GetControllerManagerConfiguration will use sync.Once to set the scheme
66-
func (d *DeferredFileLoader) GetControllerManagerConfiguration() (v1alpha1.ControllerManagerConfigurationSpec, error) {
65+
// Complete will use sync.Once to set the scheme
66+
func (d *DeferredFileLoader) Complete() (v1alpha1.ControllerManagerConfigurationSpec, error) {
6767
d.once.Do(d.loadFile)
6868
if d.err != nil {
6969
return v1alpha1.ControllerManagerConfigurationSpec{}, d.err
7070
}
71-
return d.ControllerManagerConfiguration.GetControllerManagerConfiguration()
71+
return d.ControllerManagerConfiguration.Complete()
7272
}
7373

7474
// AtPath will set the path to load the file for the decoder

pkg/config/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var _ = Describe("config", func() {
2828

2929
It("should error loading from non existent file", func() {
3030
loader := config.File()
31-
_, err := loader.GetControllerManagerConfiguration()
31+
_, err := loader.Complete()
3232
Expect(err).ToNot(BeNil())
3333
})
3434

@@ -37,7 +37,7 @@ var _ = Describe("config", func() {
3737
loader := config.File().AtPath("./testdata/config.yaml").OfKind(&conf)
3838
Expect(conf.CacheNamespace).To(Equal(""))
3939

40-
_, err := loader.GetControllerManagerConfiguration()
40+
_, err := loader.Complete()
4141
Expect(err).To(BeNil())
4242

4343
Expect(*conf.LeaderElection.LeaderElect).To(Equal(true))

pkg/config/example_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ func init() {
3232
_ = v1alpha1.AddToScheme(scheme)
3333
}
3434

35-
// This example will load a file using GetControllerManagerConfiguration with only
35+
// This example will load a file using Complete with only
3636
// defaults set.
3737
func ExampleFile() {
3838
// This will load a config file from ./config.yaml
3939
loader := config.File()
40-
_, err := loader.GetControllerManagerConfiguration()
40+
_, err := loader.Complete()
4141
if err != nil {
4242
fmt.Println("failed to load config")
4343
os.Exit(1)
@@ -47,7 +47,7 @@ func ExampleFile() {
4747
// This example will load the file from a custom path
4848
func ExampleDeferredFileLoader_atPath() {
4949
loader := config.File().AtPath("/var/run/controller-runtime/config.yaml")
50-
_, err := loader.GetControllerManagerConfiguration()
50+
_, err := loader.Complete()
5151
if err != nil {
5252
fmt.Println("failed to load config")
5353
os.Exit(1)
@@ -63,7 +63,7 @@ func ExampleDeferredFileLoader_injectScheme() {
6363
os.Exit(1)
6464
}
6565

66-
_, err = loader.GetControllerManagerConfiguration()
66+
_, err = loader.Complete()
6767
if err != nil {
6868
fmt.Println("failed to load config")
6969
os.Exit(1)
@@ -78,7 +78,7 @@ func ExampleDeferredFileLoader_ofKind() {
7878
fmt.Println("failed to inject scheme")
7979
os.Exit(1)
8080
}
81-
_, err = loader.GetControllerManagerConfiguration()
81+
_, err = loader.Complete()
8282
if err != nil {
8383
fmt.Println("failed to load config")
8484
os.Exit(1)

pkg/config/v1alpha1/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ type ControllerManagerConfiguration struct {
121121
ControllerManagerConfigurationSpec `json:",inline"`
122122
}
123123

124-
// GetControllerManagerConfiguration returns the configuration for controller-runtime
125-
func (c *ControllerManagerConfigurationSpec) GetControllerManagerConfiguration() (ControllerManagerConfigurationSpec, error) {
124+
// Complete returns the configuration for controller-runtime
125+
func (c *ControllerManagerConfigurationSpec) Complete() (ControllerManagerConfigurationSpec, error) {
126126
return *c, nil
127127
}

pkg/manager/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ func (o Options) AndFrom(loader config.ControllerManagerConfiguration) (Options,
416416
}
417417
}
418418

419-
newObj, err := loader.GetControllerManagerConfiguration()
419+
newObj, err := loader.Complete()
420420
if err != nil {
421421
return o, err
422422
}

pkg/manager/manager_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ type fakeDeferredLoader struct {
16101610
*v1alpha1.ControllerManagerConfiguration
16111611
}
16121612

1613-
func (f *fakeDeferredLoader) GetControllerManagerConfiguration() (v1alpha1.ControllerManagerConfigurationSpec, error) {
1613+
func (f *fakeDeferredLoader) Complete() (v1alpha1.ControllerManagerConfigurationSpec, error) {
16141614
return f.ControllerManagerConfiguration.ControllerManagerConfigurationSpec, nil
16151615
}
16161616

0 commit comments

Comments
 (0)