Skip to content
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

feat: support customization for logger dev mode #406

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,19 @@ func init() {
func main() {
var metricsAddr string
var enableLeaderElection bool
var loggerUseDevMode bool
var probeAddr string
flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoints bind to.")
flag.BoolVar(&enableLeaderElection, "enable-leader-election", false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
flag.BoolVar(&loggerUseDevMode, "logger_use_dev_mode", true,
"Sets the logger to use dev mode, e.g. more friendly printing format")

flag.Parse()

ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
ctrl.SetLogger(zap.New(zap.UseDevMode(loggerUseDevMode)))

mgrOptions := ctrl.Options{
Scheme: scheme,
Expand Down
1 change: 1 addition & 0 deletions sapbtp-operator-charts/templates/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ spec:
{{- if .Values.manager.enable_leader_election }}
- --enable-leader-election
{{- end}}
- --logger_use_dev_mode={{.Values.manager.logger_use_dev_mode}}
command:
- /manager
envFrom:
Expand Down
1 change: 1 addition & 0 deletions sapbtp-operator-charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ manager:
allowed_namespaces: []
replica_count: 2
enable_leader_election: true
logger_use_dev_mode: true
management_namespace:
image:
repository: ghcr.io/sap/sap-btp-service-operator/controller
Expand Down
Loading