Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
66fcca66
Commit
66fcca66
authored
Apr 21, 2023
by
Thomas Ferrandiz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ensure that klog verbosity is set to the same level as logrus
by repeatedly settting it every second during k3s startup Signed-off-by:
Thomas Ferrandiz
<
thomas.ferrandiz@suse.com
>
parent
f2bde63e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
embed.go
pkg/daemons/executor/embed.go
+24
-0
No files found.
pkg/daemons/executor/embed.go
View file @
66fcca66
...
...
@@ -5,9 +5,12 @@ package executor
import
(
"context"
"flag"
"net/http"
"runtime"
"runtime/debug"
"strconv"
"time"
"github.com/k3s-io/k3s/pkg/cli/cmds"
daemonconfig
"github.com/k3s-io/k3s/pkg/daemons/config"
...
...
@@ -31,6 +34,7 @@ import (
cloudcontrollerconfig
"k8s.io/cloud-provider/app/config"
ccmopt
"k8s.io/cloud-provider/options"
cliflag
"k8s.io/component-base/cli/flag"
"k8s.io/klog/v2"
"k8s.io/kubernetes/cmd/kube-apiserver/app"
cmapp
"k8s.io/kubernetes/cmd/kube-controller-manager/app"
proxy
"k8s.io/kubernetes/cmd/kube-proxy/app"
...
...
@@ -47,6 +51,26 @@ func init() {
func
(
e
*
Embedded
)
Bootstrap
(
ctx
context
.
Context
,
nodeConfig
*
daemonconfig
.
Node
,
cfg
cmds
.
Agent
)
error
{
e
.
nodeConfig
=
nodeConfig
go
func
()
{
// Ensure that the log verbosity remains set to the configured level by resetting it at 1-second intervals
// for the first 2 minutes that K3s is starting up. This is necessary because each of the Kubernetes
// components will initialize klog and reset the verbosity flag when they are starting.
logCtx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
time
.
Second
*
120
)
defer
cancel
()
klog
.
InitFlags
(
nil
)
for
{
flag
.
Set
(
"v"
,
strconv
.
Itoa
(
cmds
.
LogConfig
.
VLevel
))
select
{
case
<-
time
.
After
(
time
.
Second
)
:
case
<-
logCtx
.
Done
()
:
return
}
}
}()
return
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment