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
24415254
Unverified
Commit
24415254
authored
Aug 24, 2016
by
Alexander Brand
Committed by
Paulo Pires
Oct 31, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes to kubelet to support win containers
parent
09285864
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
104 additions
and
10 deletions
+104
-10
defaults.go
pkg/apis/componentconfig/v1alpha1/defaults.go
+1
-1
container_manager_stub.go
pkg/kubelet/cm/container_manager_stub.go
+2
-2
container_manager_windows.go
pkg/kubelet/cm/container_manager_windows.go
+26
-0
docker_manager.go
pkg/kubelet/dockertools/docker_manager.go
+0
-0
docker_manager_linux.go
pkg/kubelet/dockertools/docker_manager_linux.go
+24
-0
docker_manager_windows.go
pkg/kubelet/dockertools/docker_manager_windows.go
+33
-0
kubelet_pods.go
pkg/kubelet/kubelet_pods.go
+7
-4
volume.go
pkg/volume/volume.go
+11
-3
No files found.
pkg/apis/componentconfig/v1alpha1/defaults.go
View file @
24415254
...
...
@@ -196,7 +196,7 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) {
if
obj
.
DockerExecHandlerName
==
""
{
obj
.
DockerExecHandlerName
=
"native"
}
if
obj
.
DockerEndpoint
==
""
{
if
obj
.
DockerEndpoint
==
""
&&
runtime
.
GOOS
!=
"windows"
{
obj
.
DockerEndpoint
=
"unix:///var/run/docker.sock"
}
if
obj
.
EventBurst
==
0
{
...
...
pkg/kubelet/cm/container_manager_stub.go
View file @
24415254
// +build !linux
/*
Copyright 2015 The Kubernetes Authors.
...
...
@@ -25,6 +23,8 @@ import (
type
containerManagerStub
struct
{}
var
_
ContainerManager
=
&
containerManagerStub
{}
func
(
cm
*
containerManagerStub
)
Start
(
_
*
api
.
Node
)
error
{
glog
.
V
(
2
)
.
Infof
(
"Starting stub container manager"
)
return
nil
...
...
pkg/kubelet/cm/container_manager_windows.go
0 → 100644
View file @
24415254
/*
Copyright 2015 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
cm
import
(
"k8s.io/kubernetes/pkg/kubelet/cadvisor"
"k8s.io/kubernetes/pkg/util/mount"
)
func
NewContainerManager
(
mountUtil
mount
.
Interface
,
cadvisorInterface
cadvisor
.
Interface
,
nodeConfig
NodeConfig
)
(
ContainerManager
,
error
)
{
return
NewStubContainerManager
(),
nil
}
pkg/kubelet/dockertools/docker_manager.go
View file @
24415254
This diff is collapsed.
Click to expand it.
pkg/kubelet/dockertools/docker_manager_linux.go
0 → 100644
View file @
24415254
package
dockertools
import
dockertypes
"github.com/docker/engine-api/types"
func
getContainerIP
(
container
*
dockertypes
.
ContainerJSON
)
string
{
result
:=
""
if
container
.
NetworkSettings
!=
nil
{
result
=
container
.
NetworkSettings
.
IPAddress
// Fall back to IPv6 address if no IPv4 address is present
if
result
==
""
{
result
=
container
.
NetworkSettings
.
GlobalIPv6Address
}
}
return
result
}
// We don't want to override the networking mode on Linux.
func
getNetworkingMode
()
string
{
return
""
}
// Returns true if the container name matches the infrastructure's container name
func
containerProvidesPodIP
(
name
*
KubeletContainerName
)
bool
{
return
name
.
ContainerName
==
PodInfraContainerName
}
pkg/kubelet/dockertools/docker_manager_windows.go
0 → 100644
View file @
24415254
package
dockertools
import
(
"os"
dockertypes
"github.com/docker/engine-api/types"
)
func
getContainerIP
(
container
*
dockertypes
.
ContainerJSON
)
string
{
if
container
.
NetworkSettings
!=
nil
{
for
_
,
network
:=
range
container
.
NetworkSettings
.
Networks
{
if
network
.
IPAddress
!=
""
{
return
network
.
IPAddress
}
}
}
return
""
}
func
getNetworkingMode
()
string
{
// Allow override via env variable. Otherwise, use a default "kubenet" network
netMode
:=
os
.
Getenv
(
"CONTAINER_NETWORK"
)
if
netMode
==
""
{
netMode
=
"kubenet"
}
return
netMode
}
// Infrastructure containers are not supported on Windows. For this reason, we
// make sure to not grab the infra container's IP for the pod.
func
containerProvidesPodIP
(
name
*
KubeletContainerName
)
bool
{
return
name
.
ContainerName
!=
PodInfraContainerName
}
pkg/kubelet/kubelet_pods.go
View file @
24415254
...
...
@@ -25,6 +25,7 @@ import (
"os"
"path"
"path/filepath"
"runtime"
"sort"
"strings"
...
...
@@ -261,16 +262,18 @@ func (kl *Kubelet) GenerateRunContainerOptions(pod *api.Pod, container *api.Cont
}
}
opts
.
Mounts
,
err
=
makeMounts
(
pod
,
kl
.
getPodDir
(
pod
.
UID
),
container
,
hostname
,
hostDomainName
,
podIP
,
volumes
)
if
err
!=
nil
{
return
nil
,
err
if
runtime
.
GOOS
!=
"windows"
{
opts
.
Mounts
,
err
=
makeMounts
(
pod
,
kl
.
getPodDir
(
pod
.
UID
),
container
,
hostname
,
hostDomainName
,
podIP
,
volumes
)
if
err
!=
nil
{
return
nil
,
err
}
}
opts
.
Envs
,
err
=
kl
.
makeEnvironmentVariables
(
pod
,
container
,
podIP
)
if
err
!=
nil
{
return
nil
,
err
}
if
len
(
container
.
TerminationMessagePath
)
!=
0
{
if
len
(
container
.
TerminationMessagePath
)
!=
0
&&
runtime
.
GOOS
!=
"windows"
{
p
:=
kl
.
getPodContainerDir
(
pod
.
UID
,
container
.
Name
)
if
err
:=
os
.
MkdirAll
(
p
,
0750
);
err
!=
nil
{
glog
.
Errorf
(
"Error on creating %q: %v"
,
p
,
err
)
...
...
pkg/volume/volume.go
View file @
24415254
...
...
@@ -21,6 +21,7 @@ import (
"io/ioutil"
"os"
"path"
"runtime"
"time"
"k8s.io/kubernetes/pkg/api"
...
...
@@ -214,15 +215,22 @@ func RenameDirectory(oldPath, newName string) (string, error) {
if
err
!=
nil
{
return
""
,
err
}
// os.Rename call fails on windows (https://github.com/golang/go/issues/14527)
// Replacing with copyFolder to the newPath and deleting the oldPath directory
// err = os.Rename(oldPath, newPath)
err
=
copyFolder
(
oldPath
,
newPath
)
if
runtime
.
GOOS
==
"windows"
{
err
=
copyFolder
(
oldPath
,
newPath
)
if
err
!=
nil
{
return
""
,
err
}
os
.
RemoveAll
(
oldPath
)
return
newPath
,
nil
}
err
=
os
.
Rename
(
oldPath
,
newPath
)
if
err
!=
nil
{
return
""
,
err
}
os
.
RemoveAll
(
oldPath
)
return
newPath
,
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