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
10b6f405
Commit
10b6f405
authored
Jun 07, 2018
by
Pengfei Ni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Fix Windows CNI for the sandbox case"
This reverts commit
49e762ab
.
parent
c2e3d052
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
28 deletions
+43
-28
docker_sandbox.go
pkg/kubelet/dockershim/docker_sandbox.go
+1
-2
helpers_linux.go
pkg/kubelet/dockershim/helpers_linux.go
+1
-1
helpers_unsupported.go
pkg/kubelet/dockershim/helpers_unsupported.go
+1
-1
helpers_windows.go
pkg/kubelet/dockershim/helpers_windows.go
+40
-24
No files found.
pkg/kubelet/dockershim/docker_sandbox.go
View file @
10b6f405
...
...
@@ -412,9 +412,8 @@ func (ds *dockerService) PodSandboxStatus(ctx context.Context, req *runtimeapi.P
var
IP
string
// TODO: Remove this when sandbox is available on windows
// Currently windows supports both sandbox and non-sandbox cases.
// This is a workaround for windows, where sandbox is not in use, and pod IP is determined through containers belonging to the Pod.
if
IP
=
ds
.
determinePodIPBySandboxID
(
podSandboxID
,
r
);
IP
==
""
{
if
IP
=
ds
.
determinePodIPBySandboxID
(
podSandboxID
);
IP
==
""
{
IP
=
ds
.
getIP
(
podSandboxID
,
r
)
}
...
...
pkg/kubelet/dockershim/helpers_linux.go
View file @
10b6f405
...
...
@@ -136,7 +136,7 @@ func (ds *dockerService) updateCreateConfig(
return
nil
}
func
(
ds
*
dockerService
)
determinePodIPBySandboxID
(
uid
string
,
sandbox
*
dockertypes
.
ContainerJSON
)
string
{
func
(
ds
*
dockerService
)
determinePodIPBySandboxID
(
uid
string
)
string
{
return
""
}
...
...
pkg/kubelet/dockershim/helpers_unsupported.go
View file @
10b6f405
...
...
@@ -45,7 +45,7 @@ func (ds *dockerService) updateCreateConfig(
return
nil
}
func
(
ds
*
dockerService
)
determinePodIPBySandboxID
(
uid
string
,
sandbox
*
dockertypes
.
ContainerJSON
)
string
{
func
(
ds
*
dockerService
)
determinePodIPBySandboxID
(
uid
string
)
string
{
glog
.
Warningf
(
"determinePodIPBySandboxID is unsupported in this build"
)
return
""
}
...
...
pkg/kubelet/dockershim/helpers_windows.go
View file @
10b6f405
...
...
@@ -97,28 +97,7 @@ func applyWindowsContainerSecurityContext(wsc *runtimeapi.WindowsContainerSecuri
}
}
func
(
ds
*
dockerService
)
determinePodIPBySandboxID
(
sandboxID
string
,
sandbox
*
dockertypes
.
ContainerJSON
)
string
{
// Versions and feature support
// ============================
// Windows version >= Windows Server, Version 1709, Supports both sandbox and non-sandbox case
// Windows version == Windows Server 2016 Support only non-sandbox case
// Windows version < Windows Server 2016 is Not Supported
// Sandbox support in Windows mandates CNI Plugin.
// Presence of CONTAINER_NETWORK flag is considered as non-Sandbox cases here
// Hyper-V isolated containers are also considered as non-Sandbox cases
// Todo: Add a kernel version check for more validation
// Hyper-V only supports one container per Pod yet and the container will have a different
// IP address from sandbox. Retrieve the IP from the containers as this is a non-Sandbox case.
// TODO(feiskyer): remove this workaround after Hyper-V supports multiple containers per Pod.
if
networkMode
:=
os
.
Getenv
(
"CONTAINER_NETWORK"
);
networkMode
==
""
&&
sandbox
.
HostConfig
.
Isolation
!=
kubeletapis
.
HypervIsolationValue
{
// Sandbox case, fetch the IP from the sandbox container.
return
ds
.
getIP
(
sandboxID
,
sandbox
)
}
// Non-Sandbox case, fetch the IP from the containers within the Pod.
func
(
ds
*
dockerService
)
determinePodIPBySandboxID
(
sandboxID
string
)
string
{
opts
:=
dockertypes
.
ContainerListOptions
{
All
:
true
,
Filters
:
dockerfilters
.
NewArgs
(),
...
...
@@ -138,8 +117,45 @@ func (ds *dockerService) determinePodIPBySandboxID(sandboxID string, sandbox *do
continue
}
if
containerIP
:=
ds
.
getIP
(
c
.
ID
,
r
);
containerIP
!=
""
{
return
containerIP
// Versions and feature support
// ============================
// Windows version == Windows Server, Version 1709,, Supports both sandbox and non-sandbox case
// Windows version == Windows Server 2016 Support only non-sandbox case
// Windows version < Windows Server 2016 is Not Supported
// Sandbox support in Windows mandates CNI Plugin.
// Presence of CONTAINER_NETWORK flag is considered as non-Sandbox cases here
// Todo: Add a kernel version check for more validation
if
networkMode
:=
os
.
Getenv
(
"CONTAINER_NETWORK"
);
networkMode
==
""
{
// On Windows, every container that is created in a Sandbox, needs to invoke CNI plugin again for adding the Network,
// with the shared container name as NetNS info,
// This is passed down to the platform to replicate some necessary information to the new container
//
// This place is chosen as a hack for now, since ds.getIP would end up calling CNI's addToNetwork
// That is why addToNetwork is required to be idempotent
// Instead of relying on this call, an explicit call to addToNetwork should be
// done immediately after ContainerCreation, in case of Windows only. TBD Issue # to handle this
if
r
.
HostConfig
.
Isolation
==
kubeletapis
.
HypervIsolationValue
{
// Hyper-V only supports one container per Pod yet and the container will have a different
// IP address from sandbox. Return the first non-sandbox container IP as POD IP.
// TODO(feiskyer): remove this workaround after Hyper-V supports multiple containers per Pod.
if
containerIP
:=
ds
.
getIP
(
c
.
ID
,
r
);
containerIP
!=
""
{
return
containerIP
}
}
else
{
// Do not return any IP, so that we would continue and get the IP of the Sandbox
ds
.
getIP
(
sandboxID
,
r
)
}
}
else
{
// ds.getIP will call the CNI plugin to fetch the IP
if
containerIP
:=
ds
.
getIP
(
c
.
ID
,
r
);
containerIP
!=
""
{
return
containerIP
}
}
}
...
...
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