Skip to content
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ mqtt_client_cert ?= ""
mqtt_client_key ?= ""

# Log verbosity level
klog_v:=4
klog_v:=2

# Location of the JSON web key set used to verify tokens:
jwks_url:=https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/certs
Expand Down
10 changes: 3 additions & 7 deletions cmd/maestro/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,16 @@ func main() {
// set the logging config file
viper.SetConfigFile(logConfigFile)
// default log level is info
viper.SetDefault(varLogLevel, "info")
logger.SetLogLevel("info")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is related with #268. we allow to modify the log level in runtime.

Copy link
Contributor Author

@skeeey skeeey Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we still allow to modify the log level in runtime, but we should not use viper.SetDefault to set default log level, it does not work

if err := viper.ReadInConfig(); err != nil {
if _, ok := err.(*os.PathError); ok {
log.Infof("no config file '%s'", logConfigFile)
} else {
log.Errorf("failed to read the config file '%s': %v", logConfigFile, err)
}
log.Warnf("failed to read the log config file '%s', using info as default log level, %v", logConfigFile, err)
} else {
logger.SetLogLevel(viper.GetString(varLogLevel))
}
// monitor the changes in the config file
viper.WatchConfig()
viper.OnConfigChange(func(e fsnotify.Event) {
log.Infof("config file changed: %s, new log level: %s", e.Name, viper.GetString(varLogLevel))
log.Infof("log config file changed: %s, new log level: %s", e.Name, viper.GetString(varLogLevel))
logger.SetLogLevel(viper.GetString(varLogLevel))
})

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ require (
k8s.io/component-base v0.33.4
k8s.io/klog/v2 v2.130.1
k8s.io/utils v0.0.0-20241210054802-24370beab758
open-cluster-management.io/api v1.0.1-0.20251009064814-48b723491429
open-cluster-management.io/api v1.1.0
open-cluster-management.io/ocm v1.0.1-0.20251017020440-daa9b2fa5467
open-cluster-management.io/sdk-go v1.0.1-0.20251016065040-b82d34b3c2c2
open-cluster-management.io/sdk-go v1.0.1-0.20251020023450-e3c5205637d2
sigs.k8s.io/yaml v1.6.0
)

Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -957,12 +957,12 @@ k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff h1:/usPimJzUKKu+m+TE36gUy
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff/go.mod h1:5jIi+8yX4RIb8wk3XwBo5Pq2ccx4FP10ohkbSKCZoK8=
k8s.io/utils v0.0.0-20241210054802-24370beab758 h1:sdbE21q2nlQtFh65saZY+rRM6x6aJJI8IUa1AmH/qa0=
k8s.io/utils v0.0.0-20241210054802-24370beab758/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
open-cluster-management.io/api v1.0.1-0.20251009064814-48b723491429 h1:jU4r3zijNA+Ab17oF7lBck0YHc7f7wM8r2RqZJw6ZSs=
open-cluster-management.io/api v1.0.1-0.20251009064814-48b723491429/go.mod h1:lEc5Wkc9ON5ym/qAtIqNgrE7NW7IEOCOC611iQMlnKM=
open-cluster-management.io/api v1.1.0 h1:fu5xst9T/Ya6o41kqdd0zbNiDU+D3nNMTvoRVeF8j+U=
open-cluster-management.io/api v1.1.0/go.mod h1:lEc5Wkc9ON5ym/qAtIqNgrE7NW7IEOCOC611iQMlnKM=
open-cluster-management.io/ocm v1.0.1-0.20251017020440-daa9b2fa5467 h1:8ZnlbBeVqqRBQE6UR10O7ijGzRgBaOACbdI4ypUHAJ8=
open-cluster-management.io/ocm v1.0.1-0.20251017020440-daa9b2fa5467/go.mod h1:GAanBImFCdlTjRqMcXu6i9ZyWamWerxaUIaumUL0PWk=
open-cluster-management.io/sdk-go v1.0.1-0.20251016065040-b82d34b3c2c2 h1:cQJuyf4p9VqqIbfpYkN8eRBrbyLpEc19WXeu8oyWpXA=
open-cluster-management.io/sdk-go v1.0.1-0.20251016065040-b82d34b3c2c2/go.mod h1:DH4EMNDMiousmaj+noHYQxm48T+dbogiAfALhDnrjMg=
open-cluster-management.io/sdk-go v1.0.1-0.20251020023450-e3c5205637d2 h1:W7mkuOGoBi4XRwqCHHk/icLqDwN0iD2cZ6twJ7q+skQ=
open-cluster-management.io/sdk-go v1.0.1-0.20251020023450-e3c5205637d2/go.mod h1:kkw5jJp4y8Ofqpdp1Dj4GKudb5QApwnXriOvEsgn/wE=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
sigs.k8s.io/controller-runtime v0.21.0 h1:CYfjpEuicjUecRk+KAeyYh+ouUBn4llGyDYytIGcJS8=
Expand Down
2 changes: 1 addition & 1 deletion templates/agent-template-aro-hcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ parameters:
- name: KLOG_V
displayName: KLOG V Level
description: Log verbosity level
value: "4"
value: "2"

objects:
- apiVersion: apiextensions.k8s.io/v1
Expand Down
2 changes: 1 addition & 1 deletion templates/agent-template-rosa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ parameters:
- name: KLOG_V
displayName: KLOG V Level
description: Log verbosity level
value: "4"
value: "2"

- name: MQTT_HOST
description: Hostname for the mqtt broker.
Expand Down
2 changes: 1 addition & 1 deletion templates/agent-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ parameters:
- name: KLOG_V
displayName: KLOG V Level
description: Log verbosity level
value: "4"
value: "2"

- name: MESSAGE_DRIVER_TYPE
displayName: Message Driver Type
Expand Down
2 changes: 1 addition & 1 deletion templates/agent-tls-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ parameters:
- name: KLOG_V
displayName: KLOG V Level
description: Log verbosity level
value: "4"
value: "2"

- name: MESSAGE_DRIVER_TYPE
displayName: Message Driver Type
Expand Down
2 changes: 1 addition & 1 deletion templates/service-template-aro-hcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ parameters:
- name: KLOG_V
displayName: KLOG V Level
description: Log verbosity level
value: "4"
value: "2"

- name: MEMORY_REQUEST
description: Memory request for the API pods.
Expand Down
2 changes: 1 addition & 1 deletion templates/service-template-rosa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ parameters:
- name: KLOG_V
displayName: KLOG V Level
description: Log verbosity level
value: "4"
value: "2"

- name: MEMORY_REQUEST
description: Memory request for the API pods.
Expand Down
2 changes: 1 addition & 1 deletion templates/service-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ parameters:
- name: KLOG_V
displayName: KLOG V Level
description: Log verbosity level
value: "4"
value: "2"

- name: MEMORY_REQUEST
description: Memory request for the API pods.
Expand Down
2 changes: 1 addition & 1 deletion templates/service-tls-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ parameters:
- name: KLOG_V
displayName: KLOG V Level
description: Log verbosity level
value: "4"
value: "2"

- name: MEMORY_REQUEST
description: Memory request for the API pods.
Expand Down