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
bb856c67
Unverified
Commit
bb856c67
authored
Jan 19, 2022
by
Roberto Bonafiglia
Committed by
GitHub
Jan 19, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4952 from rbrtbnfgl/ipv6-nat
Add IPv6 NAT
parents
a094dee7
8eded274
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
2 deletions
+18
-2
config.go
pkg/agent/config/config.go
+1
-0
flannel.go
pkg/agent/flannel/flannel.go
+7
-1
setup.go
pkg/agent/flannel/setup.go
+1
-1
server.go
pkg/cli/cmds/server.go
+6
-0
server.go
pkg/cli/server/server.go
+1
-0
types.go
pkg/daemons/config/types.go
+2
-0
No files found.
pkg/agent/config/config.go
View file @
bb856c67
...
...
@@ -411,6 +411,7 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
SELinux
:
envInfo
.
EnableSELinux
,
ContainerRuntimeEndpoint
:
envInfo
.
ContainerRuntimeEndpoint
,
FlannelBackend
:
controlConfig
.
FlannelBackend
,
FlannelIPv6Masq
:
controlConfig
.
FlannelIPv6Masq
,
ServerHTTPSPort
:
controlConfig
.
HTTPSPort
,
Token
:
info
.
String
(),
}
...
...
pkg/agent/flannel/flannel.go
View file @
bb856c67
...
...
@@ -39,7 +39,7 @@ const (
subnetFile
=
"/run/flannel/subnet.env"
)
func
flannel
(
ctx
context
.
Context
,
flannelIface
*
net
.
Interface
,
flannelConf
,
kubeConfigFile
string
,
netMode
int
)
error
{
func
flannel
(
ctx
context
.
Context
,
flannelIface
*
net
.
Interface
,
flannelConf
,
kubeConfigFile
string
,
flannelIPv6Masq
bool
,
netMode
int
)
error
{
extIface
,
err
:=
LookupExtInterface
(
flannelIface
,
netMode
)
if
err
!=
nil
{
return
err
...
...
@@ -71,6 +71,12 @@ func flannel(ctx context.Context, flannelIface *net.Interface, flannelConf, kube
go
network
.
SetupAndEnsureIPTables
(
network
.
MasqRules
(
config
.
Network
,
bn
.
Lease
()),
60
)
go
network
.
SetupAndEnsureIPTables
(
network
.
ForwardRules
(
config
.
Network
.
String
()),
50
)
if
flannelIPv6Masq
&&
config
.
IPv6Network
.
String
()
!=
emptyIPv6Network
{
logrus
.
Debugf
(
"Creating IPv6 masquerading iptables rules for %s network"
,
config
.
IPv6Network
.
String
())
go
network
.
SetupAndEnsureIP6Tables
(
network
.
MasqIP6Rules
(
config
.
IPv6Network
,
bn
.
Lease
()),
60
)
go
network
.
SetupAndEnsureIP6Tables
(
network
.
ForwardRules
(
config
.
IPv6Network
.
String
()),
50
)
}
if
err
:=
WriteSubnetFile
(
subnetFile
,
config
.
Network
,
config
.
IPv6Network
,
true
,
bn
);
err
!=
nil
{
// Continue, even though it failed.
logrus
.
Warningf
(
"Failed to write flannel subnet file: %s"
,
err
)
...
...
pkg/agent/flannel/setup.go
View file @
bb856c67
...
...
@@ -99,7 +99,7 @@ func Run(ctx context.Context, nodeConfig *config.Node, nodes typedcorev1.NodeInt
return
errors
.
Wrap
(
err
,
"failed to check netMode for flannel"
)
}
go
func
()
{
err
:=
flannel
(
ctx
,
nodeConfig
.
FlannelIface
,
nodeConfig
.
FlannelConfFile
,
nodeConfig
.
AgentConfig
.
KubeConfigKubelet
,
netMode
)
err
:=
flannel
(
ctx
,
nodeConfig
.
FlannelIface
,
nodeConfig
.
FlannelConfFile
,
nodeConfig
.
AgentConfig
.
KubeConfigKubelet
,
n
odeConfig
.
FlannelIPv6Masq
,
n
etMode
)
if
err
!=
nil
&&
!
errors
.
Is
(
err
,
context
.
Canceled
)
{
logrus
.
Fatalf
(
"flannel exited: %v"
,
err
)
}
...
...
pkg/cli/cmds/server.go
View file @
bb856c67
...
...
@@ -62,6 +62,7 @@ type Server struct {
DisableScheduler
bool
ServerURL
string
FlannelBackend
string
FlannelIPv6Masq
bool
DefaultLocalStoragePath
string
DisableCCM
bool
DisableNPC
bool
...
...
@@ -205,6 +206,11 @@ var ServerFlags = []cli.Flag{
Destination
:
&
ServerConfig
.
FlannelBackend
,
Value
:
"vxlan"
,
},
cli
.
BoolFlag
{
Name
:
"flannel-ipv6-masq"
,
Usage
:
"(networking) Enable IPv6 masquerading for pod"
,
Destination
:
&
ServerConfig
.
FlannelIPv6Masq
,
},
ServerToken
,
cli
.
StringFlag
{
Name
:
"token-file"
,
...
...
pkg/cli/server/server.go
View file @
bb856c67
...
...
@@ -131,6 +131,7 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
serverConfig
.
ControlConfig
.
AdvertiseIP
=
cfg
.
AdvertiseIP
serverConfig
.
ControlConfig
.
AdvertisePort
=
cfg
.
AdvertisePort
serverConfig
.
ControlConfig
.
FlannelBackend
=
cfg
.
FlannelBackend
serverConfig
.
ControlConfig
.
FlannelIPv6Masq
=
cfg
.
FlannelIPv6Masq
serverConfig
.
ControlConfig
.
ExtraCloudControllerArgs
=
cfg
.
ExtraCloudControllerArgs
serverConfig
.
ControlConfig
.
DisableCCM
=
cfg
.
DisableCCM
serverConfig
.
ControlConfig
.
DisableNPC
=
cfg
.
DisableNPC
...
...
pkg/daemons/config/types.go
View file @
bb856c67
...
...
@@ -34,6 +34,7 @@ type Node struct {
FlannelConfFile
string
FlannelConfOverride
bool
FlannelIface
*
net
.
Interface
FlannelIPv6Masq
bool
Containerd
Containerd
Images
string
AgentConfig
Agent
...
...
@@ -116,6 +117,7 @@ type CriticalControlArgs struct {
DisableNPC
bool
DisableServiceLB
bool
FlannelBackend
string
FlannelIPv6Masq
bool
NoCoreDNS
bool
ServiceIPRange
*
net
.
IPNet
ServiceIPRanges
[]
*
net
.
IPNet
...
...
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