You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: designs/component-config.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ Currently controllers that use `controller-runtime` need to configure the `ctrl.
37
37
38
38
## Motivation
39
39
40
-
This change is important because:
40
+
This change is important because:
41
41
- it will help make it easier for controllers to be configured by other machine processes
42
42
- it will reduce the required flags required to start a controller
43
43
- allow for configuration types which aren't natively supported by flags
@@ -65,7 +65,7 @@ This change is important because:
65
65
66
66
## Proposal
67
67
68
-
The `ctrl.Manager`_SHOULD_ support loading configurations from `ComponentConfig` like objects.
68
+
The `ctrl.Manager`_SHOULD_ support loading configurations from `ComponentConfig` like objects.
69
69
An interface for that object with getters for the specific configuration parameters is created to bridge existing patterns.
70
70
71
71
Without breaking the current `ctrl.NewManager` which uses an exported `ctrl.Options{}` the `manager.go` can expose a new func, `NewFromComponentConfig()` this would be able to loop through the getters to populate an internal `ctrl.Options{}` and pass that into `New()`.
@@ -101,7 +101,7 @@ type ManagerConfiguration interface {
@@ -168,7 +168,7 @@ type ControllerManagerConfigurationHealth struct {
168
168
169
169
#### Default ComponentConfig Type
170
170
171
-
To enable `controller-runtime` to have a default `ComponentConfig` struct which can be used instead of requiring each controller or extension to build it's own `ComponentConfig` type, we can create a `DefaultControllerConfiguration` type which can exist in `pkg/api/config/v1alpha1/types.go`. This will allow the controller authors to use this before needing to implement their own type with additional configs.
171
+
To enable `controller-runtime` to have a default `ComponentConfig` struct which can be used instead of requiring each controller or extension to build its own `ComponentConfig` type, we can create a `DefaultControllerConfiguration` type which can exist in `pkg/api/config/v1alpha1/types.go`. This will allow the controller authors to use this before needing to implement their own type with additional configs.
172
172
173
173
```golang
174
174
// pkg/api/config/v1alpha1/types.go
@@ -212,12 +212,12 @@ if err != nil {
212
212
}
213
213
```
214
214
215
-
The above example uses `configname` which is the name of the file to load the configuration from and uses `scheme` to get the specific serializer, eg `serializer.NewCodecFactory(scheme)`. This will allow the configuration to be unmarshalled into the `runtime.Object` type and passed into the
215
+
The above example uses `configname` which is the name of the file to load the configuration from and uses `scheme` to get the specific serializer, eg `serializer.NewCodecFactory(scheme)`. This will allow the configuration to be unmarshalled into the `runtime.Object` type and passed into the
216
216
`ctrl.NewManagerFromComponentConfig()`as a `ManagerConfiguration` interface.
217
217
218
218
#### Using Flags w/ ComponentConfig
219
219
220
-
Since this design still requires setting up the initial `ComponentConfig` type and passing in a pointer to `ctrl.NewFromComponentConfig()` if you want to allow for the use of flags, your controller can use any of the different flagging interfaces. eg [`flag`](https://golang.org/pkg/flag/), [`pflag`](https://godoc.org/github.com/spf13/pflag), [`flagnum`](https://godoc.org/github.com/luci/luci-go/common/flag/flagenum) and set values on the `ComponentConfig` type prior to passing the pointer into the `ctrl.NewFromComponentConfig()`, example below.
220
+
Since this design still requires setting up the initial `ComponentConfig` type and passing in a pointer to `ctrl.NewFromComponentConfig()` if you want to allow for the use of flags, your controller can use any of the different flagging interfaces. eg [`flag`](https://golang.org/pkg/flag/), [`pflag`](https://pkg.go.dev/github.com/spf13/pflag), [`flagnum`](https://pkg.go.dev/github.com/luci/luci-go/common/flag/flagenum) and set values on the `ComponentConfig` type prior to passing the pointer into the `ctrl.NewFromComponentConfig()`, example below.
0 commit comments