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
a1539747
Unverified
Commit
a1539747
authored
Feb 12, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Feb 12, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #73926 from alculquicondor/fix/kubelet-app-lint
Fix cmd/kubelet/app lint issues
parents
cdd235b4
17a63544
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
10 deletions
+9
-10
options.go
cmd/kubelet/app/options/options.go
+7
-5
server.go
cmd/kubelet/app/server.go
+2
-3
.golint_failures
hack/.golint_failures
+0
-2
No files found.
cmd/kubelet/app/options/options.go
View file @
a1539747
...
@@ -19,7 +19,7 @@ package options
...
@@ -19,7 +19,7 @@ package options
import
(
import
(
"fmt"
"fmt"
_
"net/http/pprof"
_
"net/http/pprof"
// Enable pprof HTTP handlers.
"path/filepath"
"path/filepath"
"runtime"
"runtime"
"strings"
"strings"
...
@@ -47,10 +47,11 @@ import (
...
@@ -47,10 +47,11 @@ import (
const
defaultRootDir
=
"/var/lib/kubelet"
const
defaultRootDir
=
"/var/lib/kubelet"
// KubeletFlags contains configuration flags for the Kubelet.
// A configuration field should go in KubeletFlags instead of KubeletConfiguration if any of these are true:
// A configuration field should go in KubeletFlags instead of KubeletConfiguration if any of these are true:
// - its value will never, or cannot safely be changed during the lifetime of a node
// - its value will never, or cannot safely be changed during the lifetime of a node
, or
// - its value cannot be safely shared between nodes at the same time (e.g. a hostname)
// - its value cannot be safely shared between nodes at the same time (e.g. a hostname)
;
// KubeletConfiguration is intended to be shared between nodes
// KubeletConfiguration is intended to be shared between nodes
.
// In general, please try to avoid adding flags or configuration fields,
// In general, please try to avoid adding flags or configuration fields,
// we already have a confusingly large amount of them.
// we already have a confusingly large amount of them.
type
KubeletFlags
struct
{
type
KubeletFlags
struct
{
...
@@ -245,6 +246,7 @@ func NewKubeletFlags() *KubeletFlags {
...
@@ -245,6 +246,7 @@ func NewKubeletFlags() *KubeletFlags {
}
}
}
}
// ValidateKubeletFlags validates Kubelet's configuration flags and returns an error if they are invalid.
func
ValidateKubeletFlags
(
f
*
KubeletFlags
)
error
{
func
ValidateKubeletFlags
(
f
*
KubeletFlags
)
error
{
// ensure that nobody sets DynamicConfigDir if the dynamic config feature gate is turned off
// ensure that nobody sets DynamicConfigDir if the dynamic config feature gate is turned off
if
f
.
DynamicConfigDir
.
Provided
()
&&
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
DynamicKubeletConfig
)
{
if
f
.
DynamicConfigDir
.
Provided
()
&&
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
DynamicKubeletConfig
)
{
...
@@ -336,7 +338,7 @@ func NewKubeletServer() (*KubeletServer, error) {
...
@@ -336,7 +338,7 @@ func NewKubeletServer() (*KubeletServer, error) {
},
nil
},
nil
}
}
//
validateKubeletServer validates configuration of KubeletServer and returns an error if the input configuration is invalid
//
ValidateKubeletServer validates configuration of KubeletServer and returns an error if the input configuration is invalid.
func
ValidateKubeletServer
(
s
*
KubeletServer
)
error
{
func
ValidateKubeletServer
(
s
*
KubeletServer
)
error
{
// please add any KubeletConfiguration validation to the kubeletconfigvalidation.ValidateKubeletConfiguration function
// please add any KubeletConfiguration validation to the kubeletconfigvalidation.ValidateKubeletConfiguration function
if
err
:=
kubeletconfigvalidation
.
ValidateKubeletConfiguration
(
&
s
.
KubeletConfiguration
);
err
!=
nil
{
if
err
:=
kubeletconfigvalidation
.
ValidateKubeletConfiguration
(
&
s
.
KubeletConfiguration
);
err
!=
nil
{
...
...
cmd/kubelet/app/server.go
View file @
a1539747
...
@@ -25,7 +25,6 @@ import (
...
@@ -25,7 +25,6 @@ import (
"math/rand"
"math/rand"
"net"
"net"
"net/http"
"net/http"
_
"net/http/pprof"
"net/url"
"net/url"
"os"
"os"
"path"
"path"
...
@@ -992,7 +991,7 @@ func RunKubelet(kubeServer *options.KubeletServer, kubeDeps *kubelet.Dependencie
...
@@ -992,7 +991,7 @@ func RunKubelet(kubeServer *options.KubeletServer, kubeDeps *kubelet.Dependencie
kubeDeps
.
OSInterface
=
kubecontainer
.
RealOS
{}
kubeDeps
.
OSInterface
=
kubecontainer
.
RealOS
{}
}
}
k
,
err
:=
C
reateAndInitKubelet
(
&
kubeServer
.
KubeletConfiguration
,
k
,
err
:=
c
reateAndInitKubelet
(
&
kubeServer
.
KubeletConfiguration
,
kubeDeps
,
kubeDeps
,
&
kubeServer
.
ContainerRuntimeOptions
,
&
kubeServer
.
ContainerRuntimeOptions
,
kubeServer
.
ContainerRuntime
,
kubeServer
.
ContainerRuntime
,
...
@@ -1068,7 +1067,7 @@ func startKubelet(k kubelet.Bootstrap, podCfg *config.PodConfig, kubeCfg *kubele
...
@@ -1068,7 +1067,7 @@ func startKubelet(k kubelet.Bootstrap, podCfg *config.PodConfig, kubeCfg *kubele
}
}
}
}
func
C
reateAndInitKubelet
(
kubeCfg
*
kubeletconfiginternal
.
KubeletConfiguration
,
func
c
reateAndInitKubelet
(
kubeCfg
*
kubeletconfiginternal
.
KubeletConfiguration
,
kubeDeps
*
kubelet
.
Dependencies
,
kubeDeps
*
kubelet
.
Dependencies
,
crOptions
*
config
.
ContainerRuntimeOptions
,
crOptions
*
config
.
ContainerRuntimeOptions
,
containerRuntime
string
,
containerRuntime
string
,
...
...
hack/.golint_failures
View file @
a1539747
...
@@ -7,8 +7,6 @@ cmd/kubeadm/app/apis/kubeadm/v1alpha3
...
@@ -7,8 +7,6 @@ cmd/kubeadm/app/apis/kubeadm/v1alpha3
cmd/kubeadm/app/apis/kubeadm/v1beta1
cmd/kubeadm/app/apis/kubeadm/v1beta1
cmd/kubeadm/app/util/config
cmd/kubeadm/app/util/config
cmd/kubeadm/app/util/system
cmd/kubeadm/app/util/system
cmd/kubelet/app
cmd/kubelet/app/options
pkg/apis/abac/latest
pkg/apis/abac/latest
pkg/apis/admission
pkg/apis/admission
pkg/apis/admission/v1beta1
pkg/apis/admission/v1beta1
...
...
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