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
6ef00009
Commit
6ef00009
authored
Jun 10, 2021
by
Brad Davidson
Committed by
Brad Davidson
Jun 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add nodename to UA string for deploy controller
Signed-off-by:
Brad Davidson
<
brad.davidson@rancher.com
>
parent
2afa3dbe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
controller.go
pkg/deploy/controller.go
+3
-2
context.go
pkg/server/context.go
+17
-0
No files found.
pkg/deploy/controller.go
View file @
6ef00009
...
@@ -31,8 +31,9 @@ import (
...
@@ -31,8 +31,9 @@ import (
)
)
const
(
const
(
ns
=
"kube-system"
ControllerName
=
"deploy"
startKey
=
"_start_"
ns
=
"kube-system"
startKey
=
"_start_"
)
)
func
WatchFiles
(
ctx
context
.
Context
,
apply
apply
.
Apply
,
addons
v1
.
AddonController
,
disables
map
[
string
]
bool
,
bases
...
string
)
error
{
func
WatchFiles
(
ctx
context
.
Context
,
apply
apply
.
Apply
,
addons
v1
.
AddonController
,
disables
map
[
string
]
bool
,
bases
...
string
)
error
{
...
...
pkg/server/context.go
View file @
6ef00009
...
@@ -2,9 +2,14 @@ package server
...
@@ -2,9 +2,14 @@ package server
import
(
import
(
"context"
"context"
"fmt"
"os"
"runtime"
"github.com/k3s-io/helm-controller/pkg/generated/controllers/helm.cattle.io"
"github.com/k3s-io/helm-controller/pkg/generated/controllers/helm.cattle.io"
"github.com/rancher/k3s/pkg/deploy"
"github.com/rancher/k3s/pkg/generated/controllers/k3s.cattle.io"
"github.com/rancher/k3s/pkg/generated/controllers/k3s.cattle.io"
"github.com/rancher/k3s/pkg/version"
"github.com/rancher/wrangler-api/pkg/generated/controllers/apps"
"github.com/rancher/wrangler-api/pkg/generated/controllers/apps"
"github.com/rancher/wrangler-api/pkg/generated/controllers/batch"
"github.com/rancher/wrangler-api/pkg/generated/controllers/batch"
"github.com/rancher/wrangler-api/pkg/generated/controllers/core"
"github.com/rancher/wrangler-api/pkg/generated/controllers/core"
...
@@ -12,6 +17,8 @@ import (
...
@@ -12,6 +17,8 @@ import (
"github.com/rancher/wrangler/pkg/apply"
"github.com/rancher/wrangler/pkg/apply"
"github.com/rancher/wrangler/pkg/crd"
"github.com/rancher/wrangler/pkg/crd"
"github.com/rancher/wrangler/pkg/start"
"github.com/rancher/wrangler/pkg/start"
"github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/apis/meta/v1/validation"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/tools/clientcmd"
...
@@ -38,6 +45,16 @@ func NewContext(ctx context.Context, cfg string) (*Context, error) {
...
@@ -38,6 +45,16 @@ func NewContext(ctx context.Context, cfg string) (*Context, error) {
return
nil
,
err
return
nil
,
err
}
}
// Construct a custom user-agent string for the apply client used by the deploy controller
// so that we can track which node's deploy controller most recently modified a resource.
nodeName
:=
os
.
Getenv
(
"NODE_NAME"
)
managerName
:=
deploy
.
ControllerName
+
"@"
+
nodeName
if
nodeName
==
""
||
len
(
managerName
)
>
validation
.
FieldManagerMaxLength
{
logrus
.
Warn
(
"Deploy controller node name is empty or too long, and will not be tracked via server side apply field management"
)
managerName
=
deploy
.
ControllerName
}
restConfig
.
UserAgent
=
fmt
.
Sprintf
(
"%s/%s (%s/%s) %s/%s"
,
managerName
,
version
.
Version
,
runtime
.
GOOS
,
runtime
.
GOARCH
,
version
.
Program
,
version
.
GitCommit
)
if
err
:=
crds
(
ctx
,
restConfig
);
err
!=
nil
{
if
err
:=
crds
(
ctx
,
restConfig
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
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