From 4755cc35e41e227544682228c2625608f96a6bde Mon Sep 17 00:00:00 2001 From: Yury Kovalev Date: Wed, 11 Mar 2026 17:49:59 +0100 Subject: [PATCH] ROX-33584: Add verbosity setting to FSS and use the glog log adapter to forward client-go logs to glog --- deploy/charts/fleetshard-sync/templates/deployment.yaml | 2 ++ deploy/charts/fleetshard-sync/values.yaml | 5 +++++ fleetshard/config/config.go | 1 + fleetshard/main.go | 8 ++++++-- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/deploy/charts/fleetshard-sync/templates/deployment.yaml b/deploy/charts/fleetshard-sync/templates/deployment.yaml index 6512ecb805..bc772883b3 100644 --- a/deploy/charts/fleetshard-sync/templates/deployment.yaml +++ b/deploy/charts/fleetshard-sync/templates/deployment.yaml @@ -56,6 +56,8 @@ spec: value: {{ .Values.clusterName }} - name: ENVIRONMENT value: {{ .Values.environment }} + - name: GLOG_V + value: {{ .Values.glogVerbosity | quote }} - name: CREATE_AUTH_PROVIDER value: "{{ .Values.createAuthProvider }}" - name: AUTH_TYPE diff --git a/deploy/charts/fleetshard-sync/values.yaml b/deploy/charts/fleetshard-sync/values.yaml index 15fdc09145..79b9a1d4cf 100644 --- a/deploy/charts/fleetshard-sync/values.yaml +++ b/deploy/charts/fleetshard-sync/values.yaml @@ -18,6 +18,11 @@ createAuthProvider: true # Static token can be issued by the kubernetes issuer with the following command: # $ kubectl create token -n rhacs fleetshard-sync --audience acs-fleet-manager-private-api staticToken: "" +# glog verbosity level (see CONTRIBUTING.md for guidelines) +# 1: Production level logging - no unnecessary spam, no sensitive information +# 5: Stage/test level logging - useful debugging information, not spammy +# 10: Local/debug level logging - useful for tracing transactions during development +glogVerbosity: "1" auditLogs: enabled: true skipTLSVerify: true diff --git a/fleetshard/config/config.go b/fleetshard/config/config.go index 1a0f7fbf93..c5436b1ed1 100644 --- a/fleetshard/config/config.go +++ b/fleetshard/config/config.go @@ -30,6 +30,7 @@ type Config struct { ServiceAccountTokenFile string `env:"FLEET_MANAGER_TOKEN_FILE"` CreateAuthProvider bool `env:"CREATE_AUTH_PROVIDER" envDefault:"false"` MetricsAddress string `env:"FLEETSHARD_METRICS_ADDRESS" envDefault:":8080"` + LogVerbosity string `env:"GLOG_V" envDefault:"1"` DefaultBaseCRDURL string `env:"DEFAULT_BASE_CRD_URL" envDefault:"https://raw.githubusercontent.com/stackrox/stackrox/%s/operator/bundle/manifests/"` // TenantImagePullSecret can be used to inject a Kubernetes image pull secret into tenant namespaces. // If it is empty, nothing is injected (for example, it is not required when running on OpenShift). diff --git a/fleetshard/main.go b/fleetshard/main.go index 64e768d98e..6c0e7658d6 100644 --- a/fleetshard/main.go +++ b/fleetshard/main.go @@ -14,7 +14,7 @@ import ( "k8s.io/client-go/informers" "github.com/golang/glog" - "github.com/stackrox/acs-fleet-manager/fleetshard/config" + cfg "github.com/stackrox/acs-fleet-manager/fleetshard/config" "github.com/stackrox/acs-fleet-manager/fleetshard/pkg/fleetshardmetrics" "github.com/stackrox/acs-fleet-manager/fleetshard/pkg/k8s" "github.com/stackrox/acs-fleet-manager/fleetshard/pkg/runtime" @@ -35,10 +35,13 @@ func main() { glog.Info("Unable to set logtostderr to true") } - config, err := config.GetConfig() + config, err := cfg.GetConfig() if err != nil { glog.Fatalf("Failed to load configuration: %v", err) } + if err := flag.Set("v", config.LogVerbosity); err != nil { + glog.Errorf("Unable to set glog verbosity: %v", err) + } ctx, cancel := context.WithTimeout(context.Background(), config.StartupTimeout) defer cancel() @@ -47,6 +50,7 @@ func main() { glog.Infof("ClusterID: %s", config.ClusterID) glog.Infof("RuntimePollPeriod: %s", config.RuntimePollPeriod.String()) glog.Infof("AuthType: %s", config.AuthType) + glog.Infof("LogVerbosity: %s", config.LogVerbosity) glog.Infof("ManagedDB.Enabled: %t", config.ManagedDB.Enabled) glog.Infof("ManagedDB.SecurityGroup: %s", config.ManagedDB.SecurityGroup) glog.Infof("ManagedDB.SubnetGroup: %s", config.ManagedDB.SubnetGroup)