-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a ComponentConfig to tweak the Manager #518
Comments
/kind feature |
/priority important-longterm |
Just to add context, ComponentConfig implies using API Machinery for the types used in a config file. (Not just unmarshalling a Yaml file into a Go struct) More context in the component-base KEP: |
I would imagine we would have some fields to configure the manager's SharedInformer? |
Yeah, and the various other bits of the manager that can easily be configured with constant values (like metrics and webhook serving ports) |
/wg component-standard |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/lifecycle frozen |
@DirectXMan12 @johnsonj @stealthybox I'm interested in looking into what this might take, has anyone made any progress or have thoughts about this? Loosely looking through the codebase it seems like we could make it so that I'm thinking something along the lines of: // ManagerConfiguration defines what the ComponentConfig object for ControllerRuntime needs to support
type ManagerConfiguration interface {
GetSyncPeriod() *time.Duration
GetLeaderElection() bool
GetLeaderElectionNamespace() string
GetLeaderElectionID() string
GetLeaseDuration() *time.Duration
GetRenewDeadline() *time.Duration
GetRetryPeriod() *time.Duration
GetNamespace() string
GetMetricsBindAddress() string
GetHealthProbeBindAddress() string
GetReadinessEndpointName() string
GetLivenessEndpointName() string
GetPort() int
GetHost() string
GetCertDir() string
}
func NewFromComponentConfig(config *rest.Config, managerconfig ManagerConfiguration) (Manager, error) {
options := Options{}
// loop though getters to set Options params
if managerconfig.GetLeaderElection() {
managerconfig.GetLeaderElection()
}
return New(config, options)
} From here we could make a cli flag on The idea in package config
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type ControllerNameConfiguration struct {
metav1.TypeMeta
LeaderElection ControllerNameConfigurationLeaderElection `json:"leaderElection,omitempty"`
LeaseDuration *time.Duration `json:"leaseDuration,omitempty"`
RenewDeadline *time.Duration `json:"renewDeadline,omitempty"`
RetryPeriod *time.Duration`json:"retryPeriod,omitempty"`
Namespace string `json:"namespace,omitempty"`
MetricsBindAddress string `json:"metricsBindAddress,omitempty"`
Health ControllerNameConfigurationHealth
Port int `json:"port,omitempty"`
Host string `json:"host,omitempty"`
CertDir string `json:"certDir,omitempty"`
}
type ControllerNameConfigurationLeaderElection struct {
Enabled bool `json:"enabled,omitempty"`
Namespace string `json:"namespace,omitempty"`
ID string `json:"id,omitempty"`
}
type ControllerNameConfigurationHealth struct {
HealthProbeBindAddress string `json:"healthProbeBindAddress,omitempty"`
ReadinessEndpointName string `json:"readinessEndpointName,omitempty"`
LivenessEndpointName string `json:"livenessEndpointName,omitempty"`
} Does this make sense? Is this something |
Thanks @christopherhein
I suppose then that the top-level If I recall and understand you correctly, this interface is a way to prevent breaking changes with the existing config structs. @DirectXMan12, is backwards compatibility on the existing flags/config struct for generated controllers important to you? |
Yes, @stealthybox, the idea would be we could base scaffold, similar to deepcopy funcs, the entire object getters and setters using the object, they would end up being the The main advantage is we would be able to have controller specific configuration structs, controller designers could implement the api of those object how ever they saw fit, but it gives a starting place. Which will natively convert to the internal So for example the coredns-operator could have a CoreDNSOperatorConfiguration object, under its own GV. |
/kind design /assign @christopherhein |
/close |
Thanks! |
Controllers would like to tweak the settings of the manager (eg, change logging verbosity) through a ComponentConfig.
Additionally, individual controllers may want to expose settings that relate to their usecase (eg, a whitelist of git repos an operator can pull from). I'm not sure if that's a usecase worth splitting off but we would like to use this for addon-operators
/cc @stealthybox @shawn-hurley @DirectXMan12
The text was updated successfully, but these errors were encountered: