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
4bacd773
Commit
4bacd773
authored
Apr 30, 2018
by
Davanum Srinivas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused code
parent
03c5f298
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
0 additions
and
186 deletions
+0
-186
.golint_failures
hack/.golint_failures
+0
-1
container_manager_linux.go
pkg/kubelet/cm/container_manager_linux.go
+0
-15
helpers.go
pkg/kubelet/container/helpers.go
+0
-19
hairpin.go
pkg/kubelet/dockershim/network/hairpin/hairpin.go
+0
-23
hostport.go
pkg/kubelet/dockershim/network/hostport/hostport.go
+0
-25
kubenet_linux.go
pkg/kubelet/dockershim/network/kubenet/kubenet_linux.go
+0
-15
plugins.go
pkg/kubelet/dockershim/network/plugins.go
+0
-4
selinux_util.go
pkg/kubelet/dockershim/selinux_util.go
+0
-6
kubelet.go
pkg/kubelet/kubelet.go
+0
-15
BUILD
pkg/kubelet/lifecycle/BUILD
+0
-1
fake_handler_runner.go
pkg/kubelet/lifecycle/fake_handler_runner.go
+0
-62
No files found.
hack/.golint_failures
View file @
4bacd773
...
...
@@ -180,7 +180,6 @@ pkg/kubelet/dockershim/libdocker
pkg/kubelet/dockershim/network
pkg/kubelet/dockershim/network/cni
pkg/kubelet/dockershim/network/cni/testing
pkg/kubelet/dockershim/network/hairpin
pkg/kubelet/dockershim/network/hostport
pkg/kubelet/dockershim/network/hostport/testing
pkg/kubelet/dockershim/network/kubenet
...
...
pkg/kubelet/cm/container_manager_linux.go
View file @
4bacd773
...
...
@@ -859,21 +859,6 @@ func isKernelPid(pid int) bool {
return
err
!=
nil
}
// Helper for getting the docker API version.
func
getDockerAPIVersion
(
cadvisor
cadvisor
.
Interface
)
*
utilversion
.
Version
{
versions
,
err
:=
cadvisor
.
VersionInfo
()
if
err
!=
nil
{
glog
.
Errorf
(
"Error requesting cAdvisor VersionInfo: %v"
,
err
)
return
utilversion
.
MustParseSemantic
(
"0.0"
)
}
dockerAPIVersion
,
err
:=
utilversion
.
ParseGeneric
(
versions
.
DockerAPIVersion
)
if
err
!=
nil
{
glog
.
Errorf
(
"Error parsing docker version %q: %v"
,
versions
.
DockerVersion
,
err
)
return
utilversion
.
MustParseSemantic
(
"0.0"
)
}
return
dockerAPIVersion
}
func
(
cm
*
containerManagerImpl
)
GetCapacity
()
v1
.
ResourceList
{
return
cm
.
capacity
}
...
...
pkg/kubelet/container/helpers.go
View file @
4bacd773
...
...
@@ -259,10 +259,6 @@ type containerCommandRunnerWrapper struct {
var
_
ContainerCommandRunner
=
&
containerCommandRunnerWrapper
{}
func
DirectStreamingRunner
(
runtime
DirectStreamingRuntime
)
ContainerCommandRunner
{
return
&
containerCommandRunnerWrapper
{
runtime
}
}
func
(
r
*
containerCommandRunnerWrapper
)
RunInContainer
(
id
ContainerID
,
cmd
[]
string
,
timeout
time
.
Duration
)
([]
byte
,
error
)
{
var
buffer
bytes
.
Buffer
output
:=
ioutils
.
WriteCloserWrapper
(
&
buffer
)
...
...
@@ -300,21 +296,6 @@ func HasPrivilegedContainer(pod *v1.Pod) bool {
return
false
}
// MakeCapabilities creates string slices from Capability slices
func
MakeCapabilities
(
capAdd
[]
v1
.
Capability
,
capDrop
[]
v1
.
Capability
)
([]
string
,
[]
string
)
{
var
(
addCaps
[]
string
dropCaps
[]
string
)
for
_
,
cap
:=
range
capAdd
{
addCaps
=
append
(
addCaps
,
string
(
cap
))
}
for
_
,
cap
:=
range
capDrop
{
dropCaps
=
append
(
dropCaps
,
string
(
cap
))
}
return
addCaps
,
dropCaps
}
// MakePortMappings creates internal port mapping from api port mapping.
func
MakePortMappings
(
container
*
v1
.
Container
)
(
ports
[]
PortMapping
)
{
names
:=
make
(
map
[
string
]
struct
{})
...
...
pkg/kubelet/dockershim/network/hairpin/hairpin.go
View file @
4bacd773
...
...
@@ -40,29 +40,6 @@ var (
ethtoolOutputRegex
=
regexp
.
MustCompile
(
"peer_ifindex: (
\\
d+)"
)
)
func
SetUpContainerPid
(
containerPid
int
,
containerInterfaceName
string
)
error
{
pidStr
:=
fmt
.
Sprintf
(
"%d"
,
containerPid
)
nsenterArgs
:=
[]
string
{
"-t"
,
pidStr
,
"-n"
}
return
setUpContainerInternal
(
containerInterfaceName
,
pidStr
,
nsenterArgs
)
}
func
SetUpContainerPath
(
netnsPath
string
,
containerInterfaceName
string
)
error
{
if
netnsPath
[
0
]
!=
'/'
{
return
fmt
.
Errorf
(
"netnsPath path '%s' was invalid"
,
netnsPath
)
}
nsenterArgs
:=
[]
string
{
"--net="
+
netnsPath
}
return
setUpContainerInternal
(
containerInterfaceName
,
netnsPath
,
nsenterArgs
)
}
func
setUpContainerInternal
(
containerInterfaceName
,
containerDesc
string
,
nsenterArgs
[]
string
)
error
{
e
:=
exec
.
New
()
hostIfName
,
err
:=
findPairInterfaceOfContainerInterface
(
e
,
containerInterfaceName
,
containerDesc
,
nsenterArgs
)
if
err
!=
nil
{
return
err
}
return
setUpInterface
(
hostIfName
)
}
func
findPairInterfaceOfContainerInterface
(
e
exec
.
Interface
,
containerInterfaceName
,
containerDesc
string
,
nsenterArgs
[]
string
)
(
string
,
error
)
{
nsenterPath
,
err
:=
e
.
LookPath
(
"nsenter"
)
if
err
!=
nil
{
...
...
pkg/kubelet/dockershim/network/hostport/hostport.go
View file @
4bacd773
...
...
@@ -52,31 +52,6 @@ type PodPortMapping struct {
IP
net
.
IP
}
// ConstructPodPortMapping creates a PodPortMapping from the ports specified in the pod's
// containers.
func
ConstructPodPortMapping
(
pod
*
v1
.
Pod
,
podIP
net
.
IP
)
*
PodPortMapping
{
portMappings
:=
make
([]
*
PortMapping
,
0
)
for
_
,
c
:=
range
pod
.
Spec
.
Containers
{
for
_
,
port
:=
range
c
.
Ports
{
portMappings
=
append
(
portMappings
,
&
PortMapping
{
Name
:
port
.
Name
,
HostPort
:
port
.
HostPort
,
ContainerPort
:
port
.
ContainerPort
,
Protocol
:
port
.
Protocol
,
HostIP
:
port
.
HostIP
,
})
}
}
return
&
PodPortMapping
{
Namespace
:
pod
.
Namespace
,
Name
:
pod
.
Name
,
PortMappings
:
portMappings
,
HostNetwork
:
pod
.
Spec
.
HostNetwork
,
IP
:
podIP
,
}
}
type
hostport
struct
{
port
int32
protocol
string
...
...
pkg/kubelet/dockershim/network/kubenet/kubenet_linux.go
View file @
4bacd773
...
...
@@ -547,21 +547,6 @@ func (plugin *kubenetNetworkPlugin) checkRequiredCNIPluginsInOneDir(dir string)
return
true
}
// podIsExited returns true if the pod is exited (all containers inside are exited).
func
podIsExited
(
p
*
kubecontainer
.
Pod
)
bool
{
for
_
,
c
:=
range
p
.
Containers
{
if
c
.
State
!=
kubecontainer
.
ContainerStateExited
{
return
false
}
}
for
_
,
c
:=
range
p
.
Sandboxes
{
if
c
.
State
!=
kubecontainer
.
ContainerStateExited
{
return
false
}
}
return
true
}
func
(
plugin
*
kubenetNetworkPlugin
)
buildCNIRuntimeConf
(
ifName
string
,
id
kubecontainer
.
ContainerID
,
needNetNs
bool
)
(
*
libcni
.
RuntimeConf
,
error
)
{
netnsPath
,
err
:=
plugin
.
host
.
GetNetNS
(
id
.
ID
)
if
needNetNs
&&
err
!=
nil
{
...
...
pkg/kubelet/dockershim/network/plugins.go
View file @
4bacd773
...
...
@@ -165,10 +165,6 @@ func InitNetworkPlugin(plugins []NetworkPlugin, networkPluginName string, host H
return
chosenPlugin
,
utilerrors
.
NewAggregate
(
allErrs
)
}
func
UnescapePluginName
(
in
string
)
string
{
return
strings
.
Replace
(
in
,
"~"
,
"/"
,
-
1
)
}
type
NoopNetworkPlugin
struct
{
Sysctl
utilsysctl
.
Interface
}
...
...
pkg/kubelet/dockershim/selinux_util.go
View file @
4bacd773
...
...
@@ -54,12 +54,6 @@ func selinuxLabelLevel(separator rune) string {
return
fmt
.
Sprintf
(
"label%clevel"
,
separator
)
}
// dockerLaelDisable returns the Docker security opt that disables SELinux for
// the container.
func
selinuxLabelDisable
(
separator
rune
)
string
{
return
fmt
.
Sprintf
(
"label%cdisable"
,
separator
)
}
// addSELinuxOptions adds SELinux options to config using the given
// separator.
func
addSELinuxOptions
(
config
[]
string
,
selinuxOpts
*
runtimeapi
.
SELinuxOption
,
separator
rune
)
[]
string
{
...
...
pkg/kubelet/kubelet.go
View file @
4bacd773
...
...
@@ -27,7 +27,6 @@ import (
"os"
"path"
"sort"
"strings"
"sync"
"sync/atomic"
"time"
...
...
@@ -2071,20 +2070,6 @@ func (kl *Kubelet) updateRuntimeUp() {
kl
.
runtimeState
.
setRuntimeSync
(
kl
.
clock
.
Now
())
}
// updateCloudProviderFromMachineInfo updates the node's provider ID field
// from the given cadvisor machine info.
func
(
kl
*
Kubelet
)
updateCloudProviderFromMachineInfo
(
node
*
v1
.
Node
,
info
*
cadvisorapi
.
MachineInfo
)
{
if
info
.
CloudProvider
!=
cadvisorapi
.
UnknownProvider
&&
info
.
CloudProvider
!=
cadvisorapi
.
Baremetal
{
// The cloud providers from pkg/cloudprovider/providers/* that update ProviderID
// will use the format of cloudprovider://project/availability_zone/instance_name
// here we only have the cloudprovider and the instance name so we leave project
// and availability zone empty for compatibility.
node
.
Spec
.
ProviderID
=
strings
.
ToLower
(
string
(
info
.
CloudProvider
))
+
":////"
+
string
(
info
.
InstanceID
)
}
}
// GetConfiguration returns the KubeletConfiguration used to configure the kubelet.
func
(
kl
*
Kubelet
)
GetConfiguration
()
kubeletconfiginternal
.
KubeletConfiguration
{
return
kl
.
kubeletConfiguration
...
...
pkg/kubelet/lifecycle/BUILD
View file @
4bacd773
...
...
@@ -11,7 +11,6 @@ go_library(
srcs = [
"admission_failure_handler_stub.go",
"doc.go",
"fake_handler_runner.go",
"handlers.go",
"interfaces.go",
"predicate.go",
...
...
pkg/kubelet/lifecycle/fake_handler_runner.go
deleted
100644 → 0
View file @
03c5f298
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
lifecycle
import
(
"fmt"
"sync"
"k8s.io/api/core/v1"
kubecontainer
"k8s.io/kubernetes/pkg/kubelet/container"
"k8s.io/kubernetes/pkg/kubelet/util/format"
)
type
FakeHandlerRunner
struct
{
sync
.
Mutex
HandlerRuns
[]
string
Err
error
}
func
NewFakeHandlerRunner
()
*
FakeHandlerRunner
{
return
&
FakeHandlerRunner
{
HandlerRuns
:
[]
string
{}}
}
func
(
hr
*
FakeHandlerRunner
)
Run
(
containerID
kubecontainer
.
ContainerID
,
pod
*
v1
.
Pod
,
container
*
v1
.
Container
,
handler
*
v1
.
Handler
)
(
string
,
error
)
{
hr
.
Lock
()
defer
hr
.
Unlock
()
if
hr
.
Err
!=
nil
{
return
""
,
hr
.
Err
}
switch
{
case
handler
.
Exec
!=
nil
:
hr
.
HandlerRuns
=
append
(
hr
.
HandlerRuns
,
fmt
.
Sprintf
(
"exec on pod: %v, container: %v: %v"
,
format
.
Pod
(
pod
),
container
.
Name
,
containerID
.
String
()))
case
handler
.
HTTPGet
!=
nil
:
hr
.
HandlerRuns
=
append
(
hr
.
HandlerRuns
,
fmt
.
Sprintf
(
"http-get on pod: %v, container: %v: %v"
,
format
.
Pod
(
pod
),
container
.
Name
,
containerID
.
String
()))
case
handler
.
TCPSocket
!=
nil
:
hr
.
HandlerRuns
=
append
(
hr
.
HandlerRuns
,
fmt
.
Sprintf
(
"tcp-socket on pod: %v, container: %v: %v"
,
format
.
Pod
(
pod
),
container
.
Name
,
containerID
.
String
()))
default
:
return
""
,
fmt
.
Errorf
(
"Invalid handler: %v"
,
handler
)
}
return
""
,
nil
}
func
(
hr
*
FakeHandlerRunner
)
Reset
()
{
hr
.
HandlerRuns
=
[]
string
{}
hr
.
Err
=
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