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

Make logging more consumable #143

Merged
merged 4 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ HELM_RELEASE_NAME?=vdb-op
# For example to specify a custom webhook tls cert when deploying use this command:
# HELM_OVERRIDES="--set webhook.tlsSecret=custom-cert" make deploy-operator
HELM_OVERRIDES?=
# Enables development mode by default. Is used only when the operator is deployed
# through the Makefile
DEV_MODE?=true
# Maximum number of tests to run at once. (default 2)
# Set it to any value not greater than 8 to override the default one
E2E_PARALLELISM?=2
Expand Down Expand Up @@ -354,7 +357,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified

deploy-operator: manifests kustomize ## Using helm or olm, deploy the operator in the K8s cluster
ifeq ($(DEPLOY_WITH), helm)
helm install --wait -n $(NAMESPACE) $(HELM_RELEASE_NAME) $(OPERATOR_CHART) --set image.name=${OPERATOR_IMG} $(HELM_OVERRIDES)
helm install --wait -n $(NAMESPACE) $(HELM_RELEASE_NAME) $(OPERATOR_CHART) --set image.name=${OPERATOR_IMG} --set logging.dev=${DEV_MODE} $(HELM_OVERRIDES)
scripts/wait-for-webhook.sh -n $(NAMESPACE) -t 60
else ifeq ($(DEPLOY_WITH), olm)
scripts/deploy-olm.sh -n $(NAMESPACE) $(OLM_TEST_CATALOG_SOURCE)
Expand Down
173 changes: 153 additions & 20 deletions cmd/operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,103 @@ package main
import (
"flag"
"fmt"
"log"
"os"
"strconv"
"time"

// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
// to ensure that exec-entrypoint and run can make use of them.
"net/http"
_ "net/http/pprof" // nolint:gosec

_ "k8s.io/client-go/plugin/pkg/client/auth"

"github.com/go-logr/zapr"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
lumberjack "gopkg.in/natefinch/lumberjack.v2"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
_ "k8s.io/client-go/plugin/pkg/client/auth"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

verticacomv1beta1 "github.com/vertica/vertica-kubernetes/api/v1beta1"
"github.com/vertica/vertica-kubernetes/pkg/controllers"
//+kubebuilder:scaffold:imports
)

const (
DefaultMaxFileSize = 500
DefaultMaxFileAge = 7
DefaultMaxFileRotation = 3
DefaultLevel = "info"
DefaultDevMode = true
DefaultZapcoreLevel = zapcore.InfoLevel
First = 100
ThereAfter = 100
)

var (
scheme = runtime.NewScheme()
setupLog = ctrl.Log.WithName("setup")
)

type FlagConfig struct {
MetricsAddr string
EnableLeaderElection bool
ProbeAddr string
EnableProfiler bool
LogArgs *Logging
}

type Logging struct {
FilePath string
Level string
MaxFileSize int
MaxFileAge int
MaxFileRotation int
DevMode bool
}

func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))

utilruntime.Must(verticacomv1beta1.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
}

// setLoggingFlagArgs define logging flags with specified names and default values
func (l *Logging) setLoggingFlagArgs() {
flag.StringVar(&l.FilePath, "filepath", "",
"The path to the log file. If omitted, all logging will be written to stdout.")
flag.IntVar(&l.MaxFileSize, "maxfilesize", DefaultMaxFileSize,
"The maximum size in megabytes of the log file "+
"before it gets rotated.")
flag.IntVar(&l.MaxFileAge, "maxfileage", DefaultMaxFileAge,
"The maximum number of days to retain old log files based on the timestamp encoded in the file.")
flag.IntVar(&l.MaxFileRotation, "maxfilerotation", DefaultMaxFileRotation,
"The maximum number of files that are kept in rotation before the old ones are removed.")
flag.StringVar(&l.Level, "level", DefaultLevel,
"The minimum logging level. Valid values are: debug, info, warn, and error.")
flag.BoolVar(&l.DevMode, "dev", DefaultDevMode,
"Enables development mode if true and production mode otherwise.")
}

// setFlagArgs define flags with specified names and default values
func (fc *FlagConfig) setFlagArgs() {
flag.StringVar(&fc.MetricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&fc.ProbeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flag.BoolVar(&fc.EnableLeaderElection, "leader-elect", false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
flag.BoolVar(&fc.EnableProfiler, "enable-profiler", false,
"Enables runtime profiling collection. The profiling data can be inspected by connecting to port 6060 "+
"with the path /debug/pprof. See https://golang.org/pkg/net/http/pprof/ for more info.")
fc.LogArgs = &Logging{}
fc.LogArgs.setLoggingFlagArgs()
}

// getWatchNamespace returns the Namespace the operator should be watching for changes
func getWatchNamespace() (string, error) {
// WatchNamespaceEnvVar is the constant for env variable WATCH_NAMESPACE
Expand Down Expand Up @@ -81,26 +144,96 @@ func getIsWebhookEnabled() bool {
return enabled
}

func main() {
var metricsAddr string
var enableLeaderElection bool
var probeAddr string
var enableProfiler bool
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.BoolVar(&enableProfiler, "enable-profiler", false,
"Enables runtime profiling collection. The profiling data can be inspected by connecting to port 6060 "+
"with the path /debug/pprof. See https://golang.org/pkg/net/http/pprof/ for more info.")
opts := zap.Options{
Development: true,
// getEncoderConfig returns a concrete encoders configuration
func getEncoderConfig(devMode bool) zapcore.EncoderConfig {
encoderConfig := zap.NewDevelopmentEncoderConfig()
if !devMode {
encoderConfig = zap.NewProductionEncoderConfig()
encoderConfig.EncodeLevel = zapcore.CapitalLevelEncoder
encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
}
opts.BindFlags(flag.CommandLine)
return encoderConfig
}

// getLogWriter returns an io.writer (setting up rolling files) converted
// into a zapcore.WriteSyncer
func getLogWriter(logArgs Logging) zapcore.WriteSyncer {
lumberJackLogger := &lumberjack.Logger{
Filename: logArgs.FilePath,
MaxSize: logArgs.MaxFileSize, // megabytes
MaxBackups: logArgs.MaxFileRotation,
MaxAge: logArgs.MaxFileAge, // days
}
return zapcore.AddSync(lumberJackLogger)
}

// getZapcoreLevel takes the level as string and returns the corresponding
// zapcore.Level. If the string level is invalid, it returns the default
// level
func getZapcoreLevel(lvl string) zapcore.Level {
var level = new(zapcore.Level)
err := level.UnmarshalText([]byte(lvl))
if err != nil {
log.Println(fmt.Sprintf("unrecognized level, %s level will be used instead", DefaultLevel))
return DefaultZapcoreLevel
}
return *level
}

// getStackTrace returns an option that configures
// the logger to record a stack strace.
func getStackTrace(devMode bool) zap.Option {
lvl := zapcore.ErrorLevel
if devMode {
lvl = zapcore.WarnLevel
}
return zap.AddStacktrace(zapcore.LevelEnabler(lvl))
}

// getLogger is a wrapper that calls other functions
// to build a logger.
func getLogger(logArgs Logging) *zap.Logger {
encoderConfig := getEncoderConfig(logArgs.DevMode)
writes := []zapcore.WriteSyncer{}
opts := []zap.Option{}
lvl := zap.NewAtomicLevelAt(getZapcoreLevel(logArgs.Level))
if logArgs.FilePath != "" {
w := getLogWriter(logArgs)
writes = append(writes, w)
}
if logArgs.FilePath == "" || logArgs.DevMode {
writes = append(writes, zapcore.AddSync(os.Stdout))
}
core := zapcore.NewCore(
zapcore.NewConsoleEncoder(encoderConfig),
zapcore.NewMultiWriteSyncer(writes...),
lvl,
)
opts = append(opts, getStackTrace(logArgs.DevMode))
if !logArgs.DevMode {
// This enables sampling only in prod
core = zapcore.NewSamplerWithOptions(core, time.Second, First, ThereAfter)
}
return zap.New(core, opts...)
}

func main() {
flagArgs := &FlagConfig{}
flagArgs.setFlagArgs()
flag.Parse()

ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))
metricsAddr := flagArgs.MetricsAddr
enableLeaderElection := flagArgs.EnableLeaderElection
probeAddr := flagArgs.ProbeAddr
enableProfiler := flagArgs.EnableProfiler
logArgs := flagArgs.LogArgs

logger := getLogger(*logArgs)
if logArgs.FilePath != "" {
log.Println(fmt.Sprintf("Now logging in file %s", logArgs.FilePath))
}

ctrl.SetLogger(zapr.NewLogger(logger))

if enableProfiler {
go func() {
Expand Down
11 changes: 11 additions & 0 deletions config/default/manager_auth_proxy_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,14 @@ spec:
- "--health-probe-bind-address=:8081"
- "--metrics-bind-address=127.0.0.1:8080"
- "--leader-elect"
# These are the placeholders that we patch in when applying the helm chart.
# The default values here will be replaced in helm templates by the values
# of parameters. When creating the bundle instead for olm these flags with
# these default values will be put in the CSV and as filepath is not set, there
# will be no logging to file with olm as expected.
- "--filepath="
Copy link
Collaborator

Choose a reason for hiding this comment

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

I take it these are all placeholders that we patch in when applying the helm chart. How does this work for olm? Can we have a comment to explain this part a bit.

- "--maxfilesize=500"
- "--maxfileage=7"
- "--maxfilerotation=3"
- "--level=info"
- "--dev=false"
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ require (
github.com/bigkevmcd/go-configparser v0.0.0-20210106142102-909504547ead
github.com/ghodss/yaml v1.0.0
github.com/go-logr/logr v0.3.0
github.com/go-logr/zapr v0.2.0 // indirect
github.com/lithammer/dedent v1.1.0
github.com/mogensen/kubernetes-split-yaml v0.3.0 // indirect
github.com/onsi/ginkgo v1.14.1
github.com/onsi/gomega v1.10.2
github.com/vertica/vertica-sql-go v1.1.1
go.uber.org/zap v1.15.0
gopkg.in/natefinch/lumberjack.v2 v2.0.0
k8s.io/api v0.19.2
k8s.io/apimachinery v0.19.2
k8s.io/client-go v0.19.2
Expand Down
15 changes: 2 additions & 13 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -95,6 +93,7 @@ github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZ
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153 h1:yUdfgN0XgIJw7foRItutHYUIhlcKzcSf5vDpdhQAKTc=
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
Expand Down Expand Up @@ -247,8 +246,6 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
Expand Down Expand Up @@ -282,8 +279,6 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/mogensen/kubernetes-split-yaml v0.3.0 h1:Phj6jF9bcLpXlTUepRvopCtwl6oKPtnISn1LyQBGTfE=
github.com/mogensen/kubernetes-split-yaml v0.3.0/go.mod h1:oRr9IK7d6ID2o/w7CnVlJSz1EZNZyqiJbxnZreCZNXI=
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
Expand Down Expand Up @@ -337,15 +332,11 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo=
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
Expand Down Expand Up @@ -374,10 +365,7 @@ github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhV
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli/v2 v2.2.0 h1:JTTnM6wKzdA0Jqodd966MVj4vWbbquZykeX1sKbe2C4=
github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw=
github.com/vertica/vertica-sql-go v1.1.1 h1:sZYijzBbvdAbJcl4cYlKjR+Eh/X1hGKzukWuhh8PjvI=
github.com/vertica/vertica-sql-go v1.1.1/go.mod h1:fGr44VWdEvL+f+Qt5LkKLOT7GoxaWdoUCnPBU9h6t04=
Expand Down Expand Up @@ -605,6 +593,7 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
Expand Down
6 changes: 6 additions & 0 deletions helm-charts/verticadb-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@ This helm chart will install the operator and an admission controller webhook.
| image.name | The name of image that runs the operator. | vertica/verticadb-operator:1.0.0 |
| webhook.caBundle | A PEM encoded CA bundle that will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used. | |
| webhook.tlsSecret | The webhook requires a TLS certficate to work. By default we rely on cert-manager to be installed as we use it generate the cert. If you don't want to use cert-manager, you need to specify your own cert, which you can do with this parameter. When set, it is a name of a secret in the same namespace the chart is being installed in. The secret must have the keys: tls.key, ca.crt, and tls.crt. | |
| logging.filePath | The path to the log file. If omitted, all logging will be written to stdout. | |
| logging.maxFileSize | The maximum size, in MB, of the logging file before log rotation occurs. This is only applicable if logging to a file. | 500 |
| logging.maxFileAge | The maximum number of days to retain old log files based on the timestamp encoded in the file. This is only applicable if logging to a file. |
| logging.maxFileRotation | The maximum number of files that are kept in rotation before the old ones are removed. This is only applicable if logging to a file. | 3 |
| logging.level | The minimum logging level. Valid values are: debug, info, warn, and error | info |
| logging.dev | Enables development mode if true and production mode otherwise. | false |
| resources.\* | The resource requirements for the operator pod. | <pre>limits:<br> cpu: 100m<br> memory: 750Mi<br>requests:<br> cpu: 100m<br> memory: 20Mi</pre> |

21 changes: 21 additions & 0 deletions helm-charts/verticadb-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,27 @@ webhook:
# apiserver are used.
caBundle: ""

logging:
# filePath is the path to the log file. If omitted, all logging will be written to stdout.
filePath: ""
# maxFileSize is the maximum size, in MB, of the logging file before log rotation occurs.
# This is only applicable if logging to a file.
maxFileSize: 500
# maxFileAge is the maximum number of days to retain old log files based on the timestamp
# encoded in the file. This is only applicable if logging to a file.
maxFileAge: 7
# maxFileRotation is the maximum number of files that are kept in rotation before the old ones are removed.
# This is only applicable if logging to a file.
maxFileRotation: 3
# level is the minimum logging level. Valid values are: debug, info, warn, and error
level: info
# dev Enables development mode if true and production mode otherwise and also affects
# logs format. A few differences on logging will be: in dev mode stack traces are produced more liberally,
# on logs of WarnLevel and above while in production, they are included on logs of ErrorLevel and above.
# Moreover dev mode disables sampling.
dev: false
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think dev mode disables sampling of logging messages and produces stack traces more liberally. The are probably the key things to mention.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah. Those are more meaningful.



# The resource requirements for the operator pod. See this for more info:
# https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
# These defaults must be kept in sync with config/manifests/kustomization.yaml
Expand Down
Loading