Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Kube OVN
Commits
270c825c
Commit
270c825c
authored
5 years ago
by
ckji
Browse files
Options
Download
Email Patches
Plain Diff
fix node's annottaions overwrited incorrectly
fix #376
parent
92c1d913
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/controller/node.go
+8
-10
pkg/controller/node.go
with
8 additions
and
10 deletions
+8
-10
pkg/controller/node.go
+
8
-
10
View file @
270c825c
...
...
@@ -233,20 +233,18 @@ func (c *Controller) handleAddNode(key string) error {
"path": "/metadata/annotations",
"value": %s
}]`
payload
:=
map
[
string
]
string
{
util
.
IpAddressAnnotation
:
ip
,
util
.
MacAddressAnnotation
:
mac
,
util
.
CidrAnnotation
:
subnet
.
Spec
.
CIDRBlock
,
util
.
GatewayAnnotation
:
subnet
.
Spec
.
Gateway
,
util
.
LogicalSwitchAnnotation
:
c
.
config
.
NodeSwitch
,
util
.
AllocatedAnnotation
:
"true"
,
util
.
PortNameAnnotation
:
fmt
.
Sprintf
(
"node-%s"
,
key
),
}
raw
,
_
:=
json
.
Marshal
(
payload
)
op
:=
"replace"
if
len
(
node
.
Annotations
)
==
0
{
op
=
"add"
}
node
.
Annotations
[
util
.
IpAddressAnnotation
]
=
ip
node
.
Annotations
[
util
.
MacAddressAnnotation
]
=
mac
node
.
Annotations
[
util
.
CidrAnnotation
]
=
subnet
.
Spec
.
CIDRBlock
node
.
Annotations
[
util
.
GatewayAnnotation
]
=
subnet
.
Spec
.
Gateway
node
.
Annotations
[
util
.
LogicalSwitchAnnotation
]
=
c
.
config
.
NodeSwitch
node
.
Annotations
[
util
.
AllocatedAnnotation
]
=
"true"
node
.
Annotations
[
util
.
PortNameAnnotation
]
=
fmt
.
Sprintf
(
"node-%s"
,
key
)
raw
,
_
:=
json
.
Marshal
(
node
.
Annotations
)
patchPayload
:=
fmt
.
Sprintf
(
patchPayloadTemplate
,
op
,
raw
)
_
,
err
=
c
.
config
.
KubeClient
.
CoreV1
()
.
Nodes
()
.
Patch
(
key
,
types
.
JSONPatchType
,
[]
byte
(
patchPayload
))
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help