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
205ccc7e
Unverified
Commit
205ccc7e
authored
Sep 29, 2022
by
Manuel Buil
Committed by
GitHub
Sep 29, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6189 from manuelbuil/flannel-external-ip1.24
[Release 1.24] Add flannel-external-ip when there is a k3s node-external-ip
parents
a8e0c66d
0be4ef92
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
flannel.go
pkg/agent/flannel/flannel.go
+7
-1
run.go
pkg/agent/run.go
+9
-0
No files found.
pkg/agent/flannel/flannel.go
View file @
205ccc7e
...
@@ -40,13 +40,19 @@ const (
...
@@ -40,13 +40,19 @@ const (
subnetFile
=
"/run/flannel/subnet.env"
subnetFile
=
"/run/flannel/subnet.env"
)
)
var
(
FlannelBaseAnnotation
=
"flannel.alpha.coreos.com"
FlannelExternalIPv4Annotation
=
FlannelBaseAnnotation
+
"/public-ip-overwrite"
FlannelExternalIPv6Annotation
=
FlannelBaseAnnotation
+
"/public-ipv6-overwrite"
)
func
flannel
(
ctx
context
.
Context
,
flannelIface
*
net
.
Interface
,
flannelConf
,
kubeConfigFile
string
,
flannelIPv6Masq
bool
,
netMode
int
)
error
{
func
flannel
(
ctx
context
.
Context
,
flannelIface
*
net
.
Interface
,
flannelConf
,
kubeConfigFile
string
,
flannelIPv6Masq
bool
,
netMode
int
)
error
{
extIface
,
err
:=
LookupExtInterface
(
flannelIface
,
netMode
)
extIface
,
err
:=
LookupExtInterface
(
flannelIface
,
netMode
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
sm
,
err
:=
kube
.
NewSubnetManager
(
ctx
,
""
,
kubeConfigFile
,
"flannel.alpha.coreos.com"
,
flannelConf
,
false
)
sm
,
err
:=
kube
.
NewSubnetManager
(
ctx
,
""
,
kubeConfigFile
,
FlannelBaseAnnotation
,
flannelConf
,
false
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
pkg/agent/run.go
View file @
205ccc7e
...
@@ -399,6 +399,7 @@ func updateLegacyAddressLabels(agentConfig *daemonconfig.Agent, nodeLabels map[s
...
@@ -399,6 +399,7 @@ func updateLegacyAddressLabels(agentConfig *daemonconfig.Agent, nodeLabels map[s
return
nil
,
false
return
nil
,
false
}
}
// updateAddressAnnotations updates the node annotations with important information about IP addresses of the node
func
updateAddressAnnotations
(
agentConfig
*
daemonconfig
.
Agent
,
nodeAnnotations
map
[
string
]
string
)
(
map
[
string
]
string
,
bool
)
{
func
updateAddressAnnotations
(
agentConfig
*
daemonconfig
.
Agent
,
nodeAnnotations
map
[
string
]
string
)
(
map
[
string
]
string
,
bool
)
{
result
:=
map
[
string
]
string
{
result
:=
map
[
string
]
string
{
cp
.
InternalIPKey
:
util
.
JoinIPs
(
agentConfig
.
NodeIPs
),
cp
.
InternalIPKey
:
util
.
JoinIPs
(
agentConfig
.
NodeIPs
),
...
@@ -407,6 +408,14 @@ func updateAddressAnnotations(agentConfig *daemonconfig.Agent, nodeAnnotations m
...
@@ -407,6 +408,14 @@ func updateAddressAnnotations(agentConfig *daemonconfig.Agent, nodeAnnotations m
if
agentConfig
.
NodeExternalIP
!=
""
{
if
agentConfig
.
NodeExternalIP
!=
""
{
result
[
cp
.
ExternalIPKey
]
=
util
.
JoinIPs
(
agentConfig
.
NodeExternalIPs
)
result
[
cp
.
ExternalIPKey
]
=
util
.
JoinIPs
(
agentConfig
.
NodeExternalIPs
)
for
_
,
ipAddress
:=
range
agentConfig
.
NodeExternalIPs
{
if
utilsnet
.
IsIPv4
(
ipAddress
)
{
result
[
flannel
.
FlannelExternalIPv4Annotation
]
=
ipAddress
.
String
()
}
if
utilsnet
.
IsIPv6
(
ipAddress
)
{
result
[
flannel
.
FlannelExternalIPv6Annotation
]
=
ipAddress
.
String
()
}
}
}
}
result
=
labels
.
Merge
(
nodeAnnotations
,
result
)
result
=
labels
.
Merge
(
nodeAnnotations
,
result
)
...
...
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