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(kuma-dp): support setting Envoy's --component-log-level #8241

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions app/kuma-dp/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ func newRunCmd(opts kuma_cmd.RunCmdOpts, rootCtx *RootContext) *cobra.Command {
cmd.PersistentFlags().StringVarP(&cfg.DataplaneRuntime.ResourcePath, "dataplane-file", "d", "", "Path to Dataplane template to apply (YAML or JSON)")
cmd.PersistentFlags().StringToStringVarP(&cfg.DataplaneRuntime.ResourceVars, "dataplane-var", "v", map[string]string{}, "Variables to replace Dataplane template")
cmd.PersistentFlags().StringVar(&cfg.DataplaneRuntime.EnvoyLogLevel, "envoy-log-level", "", "Envoy log level. Available values are: [trace][debug][info][warning|warn][error][critical][off]. By default it inherits Kuma DP logging level.")
cmd.PersistentFlags().StringVar(&cfg.DataplaneRuntime.EnvoyComponentLogLevel, "envoy-component-log-level", "", "Configures Envoy's --component-log-level")
cmd.PersistentFlags().StringVar(&cfg.DataplaneRuntime.Metrics.CertPath, "metrics-cert-path", cfg.DataplaneRuntime.Metrics.CertPath, "A path to the certificate for metrics listener")
cmd.PersistentFlags().StringVar(&cfg.DataplaneRuntime.Metrics.KeyPath, "metrics-key-path", cfg.DataplaneRuntime.Metrics.KeyPath, "A path to the certificate key for metrics listener")
cmd.PersistentFlags().BoolVar(&cfg.DNS.Enabled, "dns-enabled", cfg.DNS.Enabled, "If true then builtin DNS functionality is enabled and CoreDNS server is started")
Expand Down
4 changes: 4 additions & 0 deletions app/kuma-dp/pkg/dataplane/envoy/envoy.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ func (e *Envoy) Start(stop <-chan struct{}) error {
"--log-level", e.opts.Config.DataplaneRuntime.EnvoyLogLevel,
}

if e.opts.Config.DataplaneRuntime.EnvoyComponentLogLevel != "" {
args = append(args, "--component-log-level", e.opts.Config.DataplaneRuntime.EnvoyComponentLogLevel)
}

// If the concurrency is explicit, use that. On Linux, users
// can also implicitly set concurrency using cpusets.
if e.opts.Config.DataplaneRuntime.Concurrency > 0 {
Expand Down
1 change: 1 addition & 0 deletions docs/generated/cmd/kuma-dp/kuma-dp_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ kuma-dp run [flags]
--dns-prometheus-port uint32 A port for exposing Prometheus stats (default 19153)
--dns-server-config-dir string Directory in which DNS Server config will be generated
--drain-time duration drain time for Envoy connections on Kuma DP shutdown (default 30s)
--envoy-component-log-level string Configures Envoy's --component-log-level
--envoy-log-level string Envoy log level. Available values are: [trace][debug][info][warning|warn][error][critical][off]. By default it inherits Kuma DP logging level.
-h, --help help for run
--mesh string Mesh that Dataplane belongs to
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/app/kuma-dp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ type DataplaneRuntime struct {
// Available values are: [trace][debug][info][warning|warn][error][critical][off]
// By default it inherits Kuma DP logging level.
EnvoyLogLevel string `json:"envoyLogLevel,omitempty" envconfig:"kuma_dataplane_runtime_envoy_log_level"`
// EnvoyComponentLogLevel configures Envoy's --component-log-level
michaelbeaumont marked this conversation as resolved.
Show resolved Hide resolved
EnvoyComponentLogLevel string `json:"envoyComponentLogLevel,omitempty" envconfig:"kuma_dataplane_runtime_envoy_component_log_level"`
// Resources defines the resources for this proxy.
Resources DataplaneResources `json:"resources,omitempty"`
// SocketDir dir to store socket used between Envoy and the dp process
Expand Down
6 changes: 6 additions & 0 deletions pkg/plugins/runtime/k8s/containers/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ func (i *DataplaneProxyFactory) sidecarEnvVars(mesh string, podAnnotations map[s
Value: logLevel,
}
}
if complogLevel, exist := metadata.Annotations(podAnnotations).GetString(metadata.KumaEnvoyComponentLogLevel); exist {
envVars["KUMA_DATAPLANE_RUNTIME_ENVOY_COMPONENT_LOG_LEVEL"] = kube_core.EnvVar{
Name: "KUMA_DATAPLANE_RUNTIME_ENVOY_COMPONENT_LOG_LEVEL",
Value: complogLevel,
}
}

// override defaults with cfg env vars
for envName, envVal := range i.ContainerConfig.EnvVars {
Expand Down
3 changes: 2 additions & 1 deletion pkg/plugins/runtime/k8s/metadata/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ const (

// KumaEnvoyLogLevel allows to control Envoy log level.
// Available values are: [trace][debug][info][warning|warn][error][critical][off]
KumaEnvoyLogLevel = "kuma.io/envoy-log-level"
KumaEnvoyLogLevel = "kuma.io/envoy-log-level"
KumaEnvoyComponentLogLevel = "kuma.io/envoy-component-log-level"

// KumaMetricsPrometheusAggregatePath allows to specify which path for specific app should request for metrics
KumaMetricsPrometheusAggregatePath = "prometheus.metrics.kuma.io/aggregate-%s-path"
Expand Down
Loading