Skip to content

Commit

Permalink
[manager] Setting options via config file
Browse files Browse the repository at this point in the history
  • Loading branch information
didierofrivia committed Oct 20, 2022
1 parent 57cdd9d commit 52b2cdb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
1 change: 1 addition & 0 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ patchesStrategicMerge:
# If you want your controller-manager to expose the /metrics
# endpoint w/o any authn/z, please comment the following line.
#- manager_auth_proxy_patch.yaml
- manager_config_patch.yaml
- manager_metrics_patch.yaml

# Mount the controller config file for loading manager configurations
Expand Down
2 changes: 0 additions & 2 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ spec:
containers:
- command:
- /manager
args:
- --leader-elect
env:
- name: RELATED_IMAGE_WASMSHIM
value: "oci://quay.io/kuadrant/wasm-shim:latest"
Expand Down
22 changes: 4 additions & 18 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,31 +93,17 @@ func main() {
setupLog := log.Log

var (
metricsAddr string
enableLeaderElection bool
probeAddr string
configFile string
err error
configFile string
err error
)
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
flag.StringVar(&configFile, "config", "",
"The operator will load its initial configuration from this file. "+
"Omit this flag to use the default configuration values. "+
"Command-line flags override configuration from this file.")
flag.Parse()

options := ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "f139389e.kuadrant.io",
}
options := ctrl.Options{Scheme: scheme}

if configFile != "" {
options, err = options.AndFrom(ctrl.ConfigFile().AtPath(configFile))
if err != nil {
Expand Down

0 comments on commit 52b2cdb

Please sign in to comment.