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
a3fd657d
Unverified
Commit
a3fd657d
authored
May 01, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
May 01, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #77325 from bjhaid/cleanup_kubeadm
Clean up kubeadm.
parents
7d14d539
a2b0cb62
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
12 additions
and
42 deletions
+12
-42
init.go
cmd/kubeadm/app/cmd/init.go
+0
-1
join.go
cmd/kubeadm/app/cmd/join.go
+1
-2
proxy_test.go
cmd/kubeadm/app/phases/addons/proxy/proxy_test.go
+0
-1
certs_test.go
cmd/kubeadm/app/phases/certs/certs_test.go
+1
-2
volumes_test.go
cmd/kubeadm/app/phases/controlplane/volumes_test.go
+3
-7
markcontrolplane.go
cmd/kubeadm/app/phases/markcontrolplane/markcontrolplane.go
+1
-1
postupgrade.go
cmd/kubeadm/app/phases/upgrade/postupgrade.go
+0
-3
cgroupdriver.go
cmd/kubeadm/app/util/cgroupdriver.go
+0
-7
initconfiguration_test.go
cmd/kubeadm/app/util/config/initconfiguration_test.go
+0
-11
runtime.go
cmd/kubeadm/app/util/runtime/runtime.go
+1
-3
report.go
cmd/kubeadm/app/util/system/report.go
+5
-4
No files found.
cmd/kubeadm/app/cmd/init.go
View file @
a3fd657d
...
@@ -117,7 +117,6 @@ type initData struct {
...
@@ -117,7 +117,6 @@ type initData struct {
dryRunDir
string
dryRunDir
string
externalCA
bool
externalCA
bool
client
clientset
.
Interface
client
clientset
.
Interface
waiter
apiclient
.
Waiter
outputWriter
io
.
Writer
outputWriter
io
.
Writer
uploadCerts
bool
uploadCerts
bool
certificateKey
string
certificateKey
string
...
...
cmd/kubeadm/app/cmd/join.go
View file @
a3fd657d
...
@@ -138,7 +138,6 @@ var _ phases.JoinData = &joinData{}
...
@@ -138,7 +138,6 @@ var _ phases.JoinData = &joinData{}
// this data is shared across all the phases that are included in the workflow.
// this data is shared across all the phases that are included in the workflow.
type
joinData
struct
{
type
joinData
struct
{
cfg
*
kubeadmapi
.
JoinConfiguration
cfg
*
kubeadmapi
.
JoinConfiguration
skipTokenPrint
bool
initCfg
*
kubeadmapi
.
InitConfiguration
initCfg
*
kubeadmapi
.
InitConfiguration
tlsBootstrapCfg
*
clientcmdapi
.
Config
tlsBootstrapCfg
*
clientcmdapi
.
Config
clientSet
*
clientset
.
Clientset
clientSet
*
clientset
.
Clientset
...
@@ -187,7 +186,7 @@ func NewCmdJoin(out io.Writer, joinOptions *joinOptions) *cobra.Command {
...
@@ -187,7 +186,7 @@ func NewCmdJoin(out io.Writer, joinOptions *joinOptions) *cobra.Command {
}
else
{
}
else
{
// otherwise, if the node joined as a worker node;
// otherwise, if the node joined as a worker node;
// outputs the join done message and exit
// outputs the join done message and exit
fmt
.
Fprint
f
(
data
.
outputWriter
,
joinWorkerNodeDoneMsg
)
fmt
.
Fprint
(
data
.
outputWriter
,
joinWorkerNodeDoneMsg
)
}
}
},
},
// We accept the control-plane location as an optional positional argument
// We accept the control-plane location as an optional positional argument
...
...
cmd/kubeadm/app/phases/addons/proxy/proxy_test.go
View file @
a3fd657d
...
@@ -100,7 +100,6 @@ func TestCompileManifests(t *testing.T) {
...
@@ -100,7 +100,6 @@ func TestCompileManifests(t *testing.T) {
name
string
name
string
manifest
string
manifest
string
data
interface
{}
data
interface
{}
expected
bool
}{
}{
{
{
name
:
"KubeProxyConfigMap19"
,
name
:
"KubeProxyConfigMap19"
,
...
...
cmd/kubeadm/app/phases/certs/certs_test.go
View file @
a3fd657d
...
@@ -376,7 +376,7 @@ func TestWriteKeyFilesIfNotExist(t *testing.T) {
...
@@ -376,7 +376,7 @@ func TestWriteKeyFilesIfNotExist(t *testing.T) {
t
.
Fatalf
(
"Failed to marshal expected private key: %v"
,
err
)
t
.
Fatalf
(
"Failed to marshal expected private key: %v"
,
err
)
}
}
if
bytes
.
Compare
(
resultingKeyPEM
,
expectedKeyPEM
)
!=
0
{
if
!
bytes
.
Equal
(
resultingKeyPEM
,
expectedKeyPEM
)
{
t
.
Error
(
"created key does not match expected key"
)
t
.
Error
(
"created key does not match expected key"
)
}
}
}
}
...
@@ -736,7 +736,6 @@ func TestNewCSR(t *testing.T) {
...
@@ -736,7 +736,6 @@ func TestNewCSR(t *testing.T) {
func
TestCreateCertificateFilesMethods
(
t
*
testing
.
T
)
{
func
TestCreateCertificateFilesMethods
(
t
*
testing
.
T
)
{
var
tests
=
[]
struct
{
var
tests
=
[]
struct
{
setupFunc
func
(
cfg
*
kubeadmapi
.
InitConfiguration
)
error
createFunc
func
(
cfg
*
kubeadmapi
.
InitConfiguration
)
error
createFunc
func
(
cfg
*
kubeadmapi
.
InitConfiguration
)
error
expectedFiles
[]
string
expectedFiles
[]
string
externalEtcd
bool
externalEtcd
bool
...
...
cmd/kubeadm/app/phases/controlplane/volumes_test.go
View file @
a3fd657d
...
@@ -521,12 +521,8 @@ func TestGetHostPathVolumesForTheControlPlane(t *testing.T) {
...
@@ -521,12 +521,8 @@ func TestGetHostPathVolumesForTheControlPlane(t *testing.T) {
mounts
:=
getHostPathVolumesForTheControlPlane
(
rt
.
cfg
)
mounts
:=
getHostPathVolumesForTheControlPlane
(
rt
.
cfg
)
// Avoid unit test errors when the flexvolume is mounted
// Avoid unit test errors when the flexvolume is mounted
if
_
,
ok
:=
mounts
.
volumes
[
kubeadmconstants
.
KubeControllerManager
][
flexvolumeDirVolumeName
];
ok
{
delete
(
mounts
.
volumes
[
kubeadmconstants
.
KubeControllerManager
],
flexvolumeDirVolumeName
)
delete
(
mounts
.
volumes
[
kubeadmconstants
.
KubeControllerManager
],
flexvolumeDirVolumeName
)
delete
(
mounts
.
volumeMounts
[
kubeadmconstants
.
KubeControllerManager
],
flexvolumeDirVolumeName
)
}
if
_
,
ok
:=
mounts
.
volumeMounts
[
kubeadmconstants
.
KubeControllerManager
][
flexvolumeDirVolumeName
];
ok
{
delete
(
mounts
.
volumeMounts
[
kubeadmconstants
.
KubeControllerManager
],
flexvolumeDirVolumeName
)
}
if
!
reflect
.
DeepEqual
(
mounts
.
volumes
,
rt
.
vol
)
{
if
!
reflect
.
DeepEqual
(
mounts
.
volumes
,
rt
.
vol
)
{
t
.
Errorf
(
t
.
Errorf
(
"failed getHostPathVolumesForTheControlPlane:
\n\t
expected: %v
\n\t
actual: %v"
,
"failed getHostPathVolumesForTheControlPlane:
\n\t
expected: %v
\n\t
actual: %v"
,
...
@@ -632,7 +628,7 @@ func TestAddExtraHostPathMounts(t *testing.T) {
...
@@ -632,7 +628,7 @@ func TestAddExtraHostPathMounts(t *testing.T) {
if
*
vol
.
HostPath
.
Type
!=
v1
.
HostPathType
(
hostMount
.
PathType
)
{
if
*
vol
.
HostPath
.
Type
!=
v1
.
HostPathType
(
hostMount
.
PathType
)
{
t
.
Errorf
(
"Expected to host path type %q"
,
hostMount
.
PathType
)
t
.
Errorf
(
"Expected to host path type %q"
,
hostMount
.
PathType
)
}
}
volMount
,
_
:=
mounts
.
volumeMounts
[
"component"
][
volumeName
]
volMount
:=
mounts
.
volumeMounts
[
"component"
][
volumeName
]
if
volMount
.
Name
!=
volumeName
{
if
volMount
.
Name
!=
volumeName
{
t
.
Errorf
(
"Expected volume mount name %q"
,
volumeName
)
t
.
Errorf
(
"Expected volume mount name %q"
,
volumeName
)
}
}
...
...
cmd/kubeadm/app/phases/markcontrolplane/markcontrolplane.go
View file @
a3fd657d
...
@@ -30,7 +30,7 @@ func MarkControlPlane(client clientset.Interface, controlPlaneName string, taint
...
@@ -30,7 +30,7 @@ func MarkControlPlane(client clientset.Interface, controlPlaneName string, taint
fmt
.
Printf
(
"[mark-control-plane] Marking the node %s as control-plane by adding the label
\"
%s=''
\"\n
"
,
controlPlaneName
,
constants
.
LabelNodeRoleMaster
)
fmt
.
Printf
(
"[mark-control-plane] Marking the node %s as control-plane by adding the label
\"
%s=''
\"\n
"
,
controlPlaneName
,
constants
.
LabelNodeRoleMaster
)
if
taints
!=
nil
&&
len
(
taints
)
>
0
{
if
len
(
taints
)
>
0
{
taintStrs
:=
[]
string
{}
taintStrs
:=
[]
string
{}
for
_
,
taint
:=
range
taints
{
for
_
,
taint
:=
range
taints
{
taintStrs
=
append
(
taintStrs
,
taint
.
ToString
())
taintStrs
=
append
(
taintStrs
,
taint
.
ToString
())
...
...
cmd/kubeadm/app/phases/upgrade/postupgrade.go
View file @
a3fd657d
...
@@ -19,7 +19,6 @@ package upgrade
...
@@ -19,7 +19,6 @@ package upgrade
import
(
import
(
"os"
"os"
"path/filepath"
"path/filepath"
"time"
"github.com/pkg/errors"
"github.com/pkg/errors"
...
@@ -41,8 +40,6 @@ import (
...
@@ -41,8 +40,6 @@ import (
dryrunutil
"k8s.io/kubernetes/cmd/kubeadm/app/util/dryrun"
dryrunutil
"k8s.io/kubernetes/cmd/kubeadm/app/util/dryrun"
)
)
var
expiry
=
180
*
24
*
time
.
Hour
// PerformPostUpgradeTasks runs nearly the same functions as 'kubeadm init' would do
// PerformPostUpgradeTasks runs nearly the same functions as 'kubeadm init' would do
// Note that the mark-control-plane phase is left out, not needed, and no token is created as that doesn't belong to the upgrade
// Note that the mark-control-plane phase is left out, not needed, and no token is created as that doesn't belong to the upgrade
func
PerformPostUpgradeTasks
(
client
clientset
.
Interface
,
cfg
*
kubeadmapi
.
InitConfiguration
,
newK8sVer
*
version
.
Version
,
dryRun
bool
)
error
{
func
PerformPostUpgradeTasks
(
client
clientset
.
Interface
,
cfg
*
kubeadmapi
.
InitConfiguration
,
newK8sVer
*
version
.
Version
,
dryRun
bool
)
error
{
...
...
cmd/kubeadm/app/util/cgroupdriver.go
View file @
a3fd657d
...
@@ -45,13 +45,6 @@ func GetCgroupDriverDocker(execer utilsexec.Interface) (string, error) {
...
@@ -45,13 +45,6 @@ func GetCgroupDriverDocker(execer utilsexec.Interface) (string, error) {
return
strings
.
TrimSuffix
(
driver
,
"
\n
"
),
nil
return
strings
.
TrimSuffix
(
driver
,
"
\n
"
),
nil
}
}
func
validateCgroupDriver
(
driver
string
)
error
{
if
driver
!=
CgroupDriverCgroupfs
&&
driver
!=
CgroupDriverSystemd
{
return
errors
.
Errorf
(
"unknown cgroup driver %q"
,
driver
)
}
return
nil
}
func
callDockerInfo
(
execer
utilsexec
.
Interface
)
(
string
,
error
)
{
func
callDockerInfo
(
execer
utilsexec
.
Interface
)
(
string
,
error
)
{
out
,
err
:=
execer
.
Command
(
"docker"
,
"info"
,
"-f"
,
"{{.CgroupDriver}}"
)
.
Output
()
out
,
err
:=
execer
.
Command
(
"docker"
,
"info"
,
"-f"
,
"{{.CgroupDriver}}"
)
.
Output
()
if
err
!=
nil
{
if
err
!=
nil
{
...
...
cmd/kubeadm/app/util/config/initconfiguration_test.go
View file @
a3fd657d
...
@@ -29,17 +29,6 @@ import (
...
@@ -29,17 +29,6 @@ import (
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
)
)
const
(
controlPlaneV1beta1YAML
=
"testdata/conversion/controlplane/v1beta1.yaml"
controlPlaneV1beta1YAMLNonLinux
=
"testdata/conversion/controlplane/v1beta1_non_linux.yaml"
controlPlaneInternalYAML
=
"testdata/conversion/controlplane/internal.yaml"
controlPlaneInternalYAMLNonLinux
=
"testdata/conversion/controlplane/internal_non_linux.yaml"
controlPlaneIncompleteYAML
=
"testdata/defaulting/controlplane/incomplete.yaml"
controlPlaneDefaultedYAML
=
"testdata/defaulting/controlplane/defaulted.yaml"
controlPlaneDefaultedYAMLNonLinux
=
"testdata/defaulting/controlplane/defaulted_non_linux.yaml"
controlPlaneInvalidYAML
=
"testdata/validation/invalid_controlplanecfg.yaml"
)
func
diff
(
expected
,
actual
[]
byte
)
string
{
func
diff
(
expected
,
actual
[]
byte
)
string
{
// Write out the diff
// Write out the diff
var
diffBytes
bytes
.
Buffer
var
diffBytes
bytes
.
Buffer
...
...
cmd/kubeadm/app/util/runtime/runtime.go
View file @
a3fd657d
...
@@ -109,9 +109,7 @@ func (runtime *CRIRuntime) ListKubeContainers() ([]string, error) {
...
@@ -109,9 +109,7 @@ func (runtime *CRIRuntime) ListKubeContainers() ([]string, error) {
return
nil
,
errors
.
Wrapf
(
err
,
"output: %s, error"
,
string
(
out
))
return
nil
,
errors
.
Wrapf
(
err
,
"output: %s, error"
,
string
(
out
))
}
}
pods
:=
[]
string
{}
pods
:=
[]
string
{}
for
_
,
pod
:=
range
strings
.
Fields
(
string
(
out
))
{
pods
=
append
(
pods
,
strings
.
Fields
(
string
(
out
))
...
)
pods
=
append
(
pods
,
pod
)
}
return
pods
,
nil
return
pods
,
nil
}
}
...
...
cmd/kubeadm/app/util/system/report.go
View file @
a3fd657d
...
@@ -18,9 +18,10 @@ package system
...
@@ -18,9 +18,10 @@ package system
import
(
import
(
"fmt"
"fmt"
"github.com/pkg/errors"
"io"
"io"
"os"
"os"
"github.com/pkg/errors"
)
)
// ValidationResultType is type of the validation result. Different validation results
// ValidationResultType is type of the validation result. Different validation results
...
@@ -38,9 +39,9 @@ type color int32
...
@@ -38,9 +39,9 @@ type color int32
const
(
const
(
red
color
=
31
red
color
=
31
green
=
32
green
color
=
32
yellow
=
33
yellow
color
=
33
white
=
37
white
color
=
37
)
)
func
colorize
(
s
string
,
c
color
)
string
{
func
colorize
(
s
string
,
c
color
)
string
{
...
...
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