Skip to content

Commit fec493c

Browse files
authored
ROX-33584: Add glog verbosity setting to fleetshard-sync (#2623)
ROX-33584: Add verbosity setting to FSS and use the glog log adapter to forward client-go logs to glog
1 parent a267e44 commit fec493c

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

deploy/charts/fleetshard-sync/templates/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ spec:
5656
value: {{ .Values.clusterName }}
5757
- name: ENVIRONMENT
5858
value: {{ .Values.environment }}
59+
- name: GLOG_V
60+
value: {{ .Values.glogVerbosity | quote }}
5961
- name: CREATE_AUTH_PROVIDER
6062
value: "{{ .Values.createAuthProvider }}"
6163
- name: AUTH_TYPE

deploy/charts/fleetshard-sync/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ createAuthProvider: true
1818
# Static token can be issued by the kubernetes issuer with the following command:
1919
# $ kubectl create token -n rhacs fleetshard-sync --audience acs-fleet-manager-private-api
2020
staticToken: ""
21+
# glog verbosity level (see CONTRIBUTING.md for guidelines)
22+
# 1: Production level logging - no unnecessary spam, no sensitive information
23+
# 5: Stage/test level logging - useful debugging information, not spammy
24+
# 10: Local/debug level logging - useful for tracing transactions during development
25+
glogVerbosity: "1"
2126
auditLogs:
2227
enabled: true
2328
skipTLSVerify: true

fleetshard/config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type Config struct {
3030
ServiceAccountTokenFile string `env:"FLEET_MANAGER_TOKEN_FILE"`
3131
CreateAuthProvider bool `env:"CREATE_AUTH_PROVIDER" envDefault:"false"`
3232
MetricsAddress string `env:"FLEETSHARD_METRICS_ADDRESS" envDefault:":8080"`
33+
LogVerbosity string `env:"GLOG_V" envDefault:"1"`
3334
DefaultBaseCRDURL string `env:"DEFAULT_BASE_CRD_URL" envDefault:"https://raw.githubusercontent.com/stackrox/stackrox/%s/operator/bundle/manifests/"`
3435
// TenantImagePullSecret can be used to inject a Kubernetes image pull secret into tenant namespaces.
3536
// If it is empty, nothing is injected (for example, it is not required when running on OpenShift).

fleetshard/main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"k8s.io/client-go/informers"
1515

1616
"github.com/golang/glog"
17-
"github.com/stackrox/acs-fleet-manager/fleetshard/config"
17+
cfg "github.com/stackrox/acs-fleet-manager/fleetshard/config"
1818
"github.com/stackrox/acs-fleet-manager/fleetshard/pkg/fleetshardmetrics"
1919
"github.com/stackrox/acs-fleet-manager/fleetshard/pkg/k8s"
2020
"github.com/stackrox/acs-fleet-manager/fleetshard/pkg/runtime"
@@ -35,10 +35,13 @@ func main() {
3535
glog.Info("Unable to set logtostderr to true")
3636
}
3737

38-
config, err := config.GetConfig()
38+
config, err := cfg.GetConfig()
3939
if err != nil {
4040
glog.Fatalf("Failed to load configuration: %v", err)
4141
}
42+
if err := flag.Set("v", config.LogVerbosity); err != nil {
43+
glog.Errorf("Unable to set glog verbosity: %v", err)
44+
}
4245

4346
ctx, cancel := context.WithTimeout(context.Background(), config.StartupTimeout)
4447
defer cancel()
@@ -47,6 +50,7 @@ func main() {
4750
glog.Infof("ClusterID: %s", config.ClusterID)
4851
glog.Infof("RuntimePollPeriod: %s", config.RuntimePollPeriod.String())
4952
glog.Infof("AuthType: %s", config.AuthType)
53+
glog.Infof("LogVerbosity: %s", config.LogVerbosity)
5054
glog.Infof("ManagedDB.Enabled: %t", config.ManagedDB.Enabled)
5155
glog.Infof("ManagedDB.SecurityGroup: %s", config.ManagedDB.SecurityGroup)
5256
glog.Infof("ManagedDB.SubnetGroup: %s", config.ManagedDB.SubnetGroup)

0 commit comments

Comments
 (0)