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
bc0264fb
Commit
bc0264fb
authored
Jun 05, 2018
by
Lantao Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix standalone dockershim.
parent
77d996b2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
39 deletions
+20
-39
server.go
cmd/kubelet/app/server.go
+10
-9
docker_service.go
pkg/kubelet/dockershim/docker_service.go
+3
-9
docker_server.go
pkg/kubelet/dockershim/remote/docker_server.go
+3
-13
kubelet.go
pkg/kubelet/kubelet.go
+3
-5
BUILD
pkg/kubemark/BUILD
+0
-1
hollow_kubelet.go
pkg/kubemark/hollow_kubelet.go
+1
-2
No files found.
cmd/kubelet/app/server.go
View file @
bc0264fb
...
@@ -721,7 +721,7 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
...
@@ -721,7 +721,7 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
glog
.
Warning
(
err
)
glog
.
Warning
(
err
)
}
}
if
err
:=
RunKubelet
(
&
s
.
KubeletFlags
,
&
s
.
KubeletConfiguration
,
kubeDeps
,
s
.
RunOnce
,
stopCh
);
err
!=
nil
{
if
err
:=
RunKubelet
(
&
s
.
KubeletFlags
,
&
s
.
KubeletConfiguration
,
kubeDeps
,
s
.
RunOnce
);
err
!=
nil
{
return
err
return
err
}
}
...
@@ -887,7 +887,7 @@ func addChaosToClientConfig(s *options.KubeletServer, config *restclient.Config)
...
@@ -887,7 +887,7 @@ func addChaosToClientConfig(s *options.KubeletServer, config *restclient.Config)
// 2 Kubelet binary
// 2 Kubelet binary
// 3 Standalone 'kubernetes' binary
// 3 Standalone 'kubernetes' binary
// Eventually, #2 will be replaced with instances of #3
// Eventually, #2 will be replaced with instances of #3
func
RunKubelet
(
kubeFlags
*
options
.
KubeletFlags
,
kubeCfg
*
kubeletconfiginternal
.
KubeletConfiguration
,
kubeDeps
*
kubelet
.
Dependencies
,
runOnce
bool
,
stopCh
<-
chan
struct
{}
)
error
{
func
RunKubelet
(
kubeFlags
*
options
.
KubeletFlags
,
kubeCfg
*
kubeletconfiginternal
.
KubeletConfiguration
,
kubeDeps
*
kubelet
.
Dependencies
,
runOnce
bool
)
error
{
hostname
:=
nodeutil
.
GetHostname
(
kubeFlags
.
HostnameOverride
)
hostname
:=
nodeutil
.
GetHostname
(
kubeFlags
.
HostnameOverride
)
// Query the cloud provider for our node name, default to hostname if kubeDeps.Cloud == nil
// Query the cloud provider for our node name, default to hostname if kubeDeps.Cloud == nil
nodeName
,
err
:=
getNodeName
(
kubeDeps
.
Cloud
,
hostname
)
nodeName
,
err
:=
getNodeName
(
kubeDeps
.
Cloud
,
hostname
)
...
@@ -961,8 +961,7 @@ func RunKubelet(kubeFlags *options.KubeletFlags, kubeCfg *kubeletconfiginternal.
...
@@ -961,8 +961,7 @@ func RunKubelet(kubeFlags *options.KubeletFlags, kubeCfg *kubeletconfiginternal.
kubeFlags
.
NodeLabels
,
kubeFlags
.
NodeLabels
,
kubeFlags
.
SeccompProfileRoot
,
kubeFlags
.
SeccompProfileRoot
,
kubeFlags
.
BootstrapCheckpointPath
,
kubeFlags
.
BootstrapCheckpointPath
,
kubeFlags
.
NodeStatusMaxImages
,
kubeFlags
.
NodeStatusMaxImages
)
stopCh
)
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to create kubelet: %v"
,
err
)
return
fmt
.
Errorf
(
"failed to create kubelet: %v"
,
err
)
}
}
...
@@ -1047,8 +1046,7 @@ func CreateAndInitKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
...
@@ -1047,8 +1046,7 @@ func CreateAndInitKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
nodeLabels
map
[
string
]
string
,
nodeLabels
map
[
string
]
string
,
seccompProfileRoot
string
,
seccompProfileRoot
string
,
bootstrapCheckpointPath
string
,
bootstrapCheckpointPath
string
,
nodeStatusMaxImages
int32
,
nodeStatusMaxImages
int32
)
(
k
kubelet
.
Bootstrap
,
err
error
)
{
stopCh
<-
chan
struct
{})
(
k
kubelet
.
Bootstrap
,
err
error
)
{
// TODO: block until all sources have delivered at least one update to the channel, or break the sync loop
// TODO: block until all sources have delivered at least one update to the channel, or break the sync loop
// up into "per source" synchronizations
// up into "per source" synchronizations
...
@@ -1082,8 +1080,7 @@ func CreateAndInitKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
...
@@ -1082,8 +1080,7 @@ func CreateAndInitKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
nodeLabels
,
nodeLabels
,
seccompProfileRoot
,
seccompProfileRoot
,
bootstrapCheckpointPath
,
bootstrapCheckpointPath
,
nodeStatusMaxImages
,
nodeStatusMaxImages
)
stopCh
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -1184,5 +1181,9 @@ func RunDockershim(f *options.KubeletFlags, c *kubeletconfiginternal.KubeletConf
...
@@ -1184,5 +1181,9 @@ func RunDockershim(f *options.KubeletFlags, c *kubeletconfiginternal.KubeletConf
}
}
glog
.
V
(
2
)
.
Infof
(
"Starting the GRPC server for the docker CRI shim."
)
glog
.
V
(
2
)
.
Infof
(
"Starting the GRPC server for the docker CRI shim."
)
server
:=
dockerremote
.
NewDockerServer
(
f
.
RemoteRuntimeEndpoint
,
ds
)
server
:=
dockerremote
.
NewDockerServer
(
f
.
RemoteRuntimeEndpoint
,
ds
)
return
server
.
Start
(
stopCh
)
if
err
:=
server
.
Start
();
err
!=
nil
{
return
err
}
<-
stopCh
return
nil
}
}
pkg/kubelet/dockershim/docker_service.go
View file @
bc0264fb
...
@@ -85,7 +85,7 @@ const (
...
@@ -85,7 +85,7 @@ const (
type
CRIService
interface
{
type
CRIService
interface
{
runtimeapi
.
RuntimeServiceServer
runtimeapi
.
RuntimeServiceServer
runtimeapi
.
ImageServiceServer
runtimeapi
.
ImageServiceServer
Start
(
<-
chan
struct
{}
)
error
Start
()
error
}
}
// DockerService is an interface that embeds the new RuntimeService and
// DockerService is an interface that embeds the new RuntimeService and
...
@@ -400,17 +400,11 @@ func (ds *dockerService) GetPodPortMappings(podSandboxID string) ([]*hostport.Po
...
@@ -400,17 +400,11 @@ func (ds *dockerService) GetPodPortMappings(podSandboxID string) ([]*hostport.Po
}
}
// Start initializes and starts components in dockerService.
// Start initializes and starts components in dockerService.
func
(
ds
*
dockerService
)
Start
(
stopCh
<-
chan
struct
{}
)
error
{
func
(
ds
*
dockerService
)
Start
()
error
{
// Initialize the legacy cleanup flag.
// Initialize the legacy cleanup flag.
if
ds
.
startLocalStreamingServer
{
if
ds
.
startLocalStreamingServer
{
go
func
()
{
go
func
()
{
<-
stopCh
if
err
:=
ds
.
streamingServer
.
Start
(
true
);
err
!=
nil
{
if
err
:=
ds
.
streamingServer
.
Stop
();
err
!=
nil
{
glog
.
Errorf
(
"Failed to stop streaming server: %v"
,
err
)
}
}()
go
func
()
{
if
err
:=
ds
.
streamingServer
.
Start
(
true
);
err
!=
nil
&&
err
!=
http
.
ErrServerClosed
{
glog
.
Fatalf
(
"Streaming server stopped unexpectedly: %v"
,
err
)
glog
.
Fatalf
(
"Streaming server stopped unexpectedly: %v"
,
err
)
}
}
}()
}()
...
...
pkg/kubelet/dockershim/remote/docker_server.go
View file @
bc0264fb
...
@@ -49,9 +49,9 @@ func NewDockerServer(endpoint string, s dockershim.CRIService) *DockerServer {
...
@@ -49,9 +49,9 @@ func NewDockerServer(endpoint string, s dockershim.CRIService) *DockerServer {
}
}
// Start starts the dockershim grpc server.
// Start starts the dockershim grpc server.
func
(
s
*
DockerServer
)
Start
(
stopCh
<-
chan
struct
{}
)
error
{
func
(
s
*
DockerServer
)
Start
()
error
{
// Start the internal service.
// Start the internal service.
if
err
:=
s
.
service
.
Start
(
stopCh
);
err
!=
nil
{
if
err
:=
s
.
service
.
Start
();
err
!=
nil
{
glog
.
Errorf
(
"Unable to start docker service"
)
glog
.
Errorf
(
"Unable to start docker service"
)
return
err
return
err
}
}
...
@@ -70,18 +70,8 @@ func (s *DockerServer) Start(stopCh <-chan struct{}) error {
...
@@ -70,18 +70,8 @@ func (s *DockerServer) Start(stopCh <-chan struct{}) error {
runtimeapi
.
RegisterImageServiceServer
(
s
.
server
,
s
.
service
)
runtimeapi
.
RegisterImageServiceServer
(
s
.
server
,
s
.
service
)
go
func
()
{
go
func
()
{
if
err
:=
s
.
server
.
Serve
(
l
);
err
!=
nil
{
if
err
:=
s
.
server
.
Serve
(
l
);
err
!=
nil
{
glog
.
Error
f
(
"Failed to serve connections: %v"
,
err
)
glog
.
Fatal
f
(
"Failed to serve connections: %v"
,
err
)
}
}
}()
}()
go
func
()
{
<-
stopCh
s
.
Stop
()
}()
return
nil
return
nil
}
}
// Stop stops the dockershim grpc server.
func
(
s
*
DockerServer
)
Stop
()
{
glog
.
V
(
2
)
.
Infof
(
"Stop docker server"
)
s
.
server
.
Stop
()
}
pkg/kubelet/kubelet.go
View file @
bc0264fb
...
@@ -221,8 +221,7 @@ type Builder func(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
...
@@ -221,8 +221,7 @@ type Builder func(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
nodeLabels
map
[
string
]
string
,
nodeLabels
map
[
string
]
string
,
seccompProfileRoot
string
,
seccompProfileRoot
string
,
bootstrapCheckpointPath
string
,
bootstrapCheckpointPath
string
,
nodeStatusMaxImages
int32
,
nodeStatusMaxImages
int32
)
(
Bootstrap
,
error
)
stopCh
<-
chan
struct
{})
(
Bootstrap
,
error
)
// Dependencies is a bin for things we might consider "injected dependencies" -- objects constructed
// Dependencies is a bin for things we might consider "injected dependencies" -- objects constructed
// at runtime that are necessary for running the Kubelet. This is a temporary solution for grouping
// at runtime that are necessary for running the Kubelet. This is a temporary solution for grouping
...
@@ -348,8 +347,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
...
@@ -348,8 +347,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
nodeLabels
map
[
string
]
string
,
nodeLabels
map
[
string
]
string
,
seccompProfileRoot
string
,
seccompProfileRoot
string
,
bootstrapCheckpointPath
string
,
bootstrapCheckpointPath
string
,
nodeStatusMaxImages
int32
,
nodeStatusMaxImages
int32
)
(
*
Kubelet
,
error
)
{
stopCh
<-
chan
struct
{})
(
*
Kubelet
,
error
)
{
if
rootDirectory
==
""
{
if
rootDirectory
==
""
{
return
nil
,
fmt
.
Errorf
(
"invalid root directory %q"
,
rootDirectory
)
return
nil
,
fmt
.
Errorf
(
"invalid root directory %q"
,
rootDirectory
)
}
}
...
@@ -630,7 +628,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
...
@@ -630,7 +628,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
remoteImageEndpoint
)
remoteImageEndpoint
)
glog
.
V
(
2
)
.
Infof
(
"Starting the GRPC server for the docker CRI shim."
)
glog
.
V
(
2
)
.
Infof
(
"Starting the GRPC server for the docker CRI shim."
)
server
:=
dockerremote
.
NewDockerServer
(
remoteRuntimeEndpoint
,
ds
)
server
:=
dockerremote
.
NewDockerServer
(
remoteRuntimeEndpoint
,
ds
)
if
err
:=
server
.
Start
(
stopCh
);
err
!=
nil
{
if
err
:=
server
.
Start
();
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
pkg/kubemark/BUILD
View file @
bc0264fb
...
@@ -46,7 +46,6 @@ go_library(
...
@@ -46,7 +46,6 @@ go_library(
"//vendor/k8s.io/apimachinery/pkg/fields:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/fields:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//vendor/k8s.io/client-go/informers:go_default_library",
"//vendor/k8s.io/client-go/informers:go_default_library",
"//vendor/k8s.io/client-go/informers/core/v1:go_default_library",
"//vendor/k8s.io/client-go/informers/core/v1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
...
...
pkg/kubemark/hollow_kubelet.go
View file @
bc0264fb
...
@@ -20,7 +20,6 @@ import (
...
@@ -20,7 +20,6 @@ import (
"time"
"time"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
clientset
"k8s.io/client-go/kubernetes"
clientset
"k8s.io/client-go/kubernetes"
kubeletapp
"k8s.io/kubernetes/cmd/kubelet/app"
kubeletapp
"k8s.io/kubernetes/cmd/kubelet/app"
"k8s.io/kubernetes/cmd/kubelet/app/options"
"k8s.io/kubernetes/cmd/kubelet/app/options"
...
@@ -90,7 +89,7 @@ func NewHollowKubelet(
...
@@ -90,7 +89,7 @@ func NewHollowKubelet(
// Starts this HollowKubelet and blocks.
// Starts this HollowKubelet and blocks.
func
(
hk
*
HollowKubelet
)
Run
()
{
func
(
hk
*
HollowKubelet
)
Run
()
{
if
err
:=
kubeletapp
.
RunKubelet
(
hk
.
KubeletFlags
,
hk
.
KubeletConfiguration
,
hk
.
KubeletDeps
,
false
,
wait
.
NeverStop
);
err
!=
nil
{
if
err
:=
kubeletapp
.
RunKubelet
(
hk
.
KubeletFlags
,
hk
.
KubeletConfiguration
,
hk
.
KubeletDeps
,
false
);
err
!=
nil
{
glog
.
Fatalf
(
"Failed to run HollowKubelet: %v. Exiting."
,
err
)
glog
.
Fatalf
(
"Failed to run HollowKubelet: %v. Exiting."
,
err
)
}
}
select
{}
select
{}
...
...
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