Skip to content

daemon: Restore health IPs from local ciliumnode resource - #30383

Merged
julianwiedmann merged 1 commit into
cilium:mainfrom
ctripcloud:restore-health-ips-from-k8s-resource
Jan 29, 2024
Merged

julianwiedmann merged 1 commit into
cilium:mainfrom
ctripcloud:restore-health-ips-from-k8s-resource

Conversation

@haozhangami

@haozhangami haozhangami commented Jan 23, 2024 •

Copy link
Copy Markdown
Contributor

Currently, although health IPs are recorded in the ciliumnode resource, cilium will allocate a new health IP when the cilium agent restarts. In addition, it will cause unnecessary node update events.

This patch obtains health IPs from ciliumnode and restores them. If the restoration fails, a new health IP is allocated.

Restore health IPs from local ciliumnode resource

@haozhangami
haozhangami requested review from a team as code owners January 23, 2024 16:04
@maintainer-s-little-helper maintainer-s-little-helper Bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Jan 23, 2024
@github-actions github-actions Bot added the kind/community-contribution This was a contribution made by a community member. label Jan 23, 2024
@haozhangami
haozhangami force-pushed the restore-health-ips-from-k8s-resource branch from 19a3cb9 to bb8ab0d Compare January 24, 2024 06:49

@derailed derailed left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haozhangami Thank you for this update!

Comment thread daemon/cmd/ipam.go Resolved
Comment thread daemon/cmd/ipam.go Resolved
Comment thread daemon/k8s/init.go Resolved
@haozhangami
haozhangami force-pushed the restore-health-ips-from-k8s-resource branch 2 times, most recently from 69c2870 to f83ba65 Compare January 25, 2024 08:40

@giorio94 giorio94 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @haozhangami for your PR!

Looks a valuable improvement to me. Unfortunately, it appears that the restoration logic doesn't work as intended. I've left a few more details about the reasons in the inline comments, as well as a bunch of additional suggestions.

Comment thread pkg/option/config.go Resolved
Comment thread daemon/k8s/init.go Resolved
Comment thread daemon/cmd/ipam.go Resolved
Comment thread daemon/cmd/ipam.go Resolved
Comment thread daemon/cmd/ipam.go Resolved
@giorio94 giorio94 added kind/enhancement This would improve or streamline existing functionality. release-note/minor This PR changes functionality that users may find relevant to operating Cilium. area/agent Cilium agent related. labels Jan 25, 2024
@maintainer-s-little-helper maintainer-s-little-helper Bot removed dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. labels Jan 25, 2024
@haozhangami
haozhangami force-pushed the restore-health-ips-from-k8s-resource branch from f83ba65 to c631d9e Compare January 26, 2024 07:15
@haozhangami haozhangami changed the title daemon: Restore health IPs from k8s resource daemon: Restore health IPs from local ciliumnode resource Jan 26, 2024
@haozhangami
haozhangami force-pushed the restore-health-ips-from-k8s-resource branch from c631d9e to 8de201c Compare January 26, 2024 07:52
@giorio94
giorio94 requested review from a team and gandro and removed request for a team January 26, 2024 10:11

@giorio94 giorio94 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've performed a few tests with both Kubernetes and ClusterPool IPAM modes and confirmed that this actually fixes the Health IP bouncing as expected.

Code changes look overall good to me. I've left one more comment inline (the last) concerning the handling of IP families change. Besides that, just a couple of possible additional clean-ups.

Finally, I've requested a review from the sig-ipam team to also get their feedback given that this PR touches IPAM-related logic.

Comment thread daemon/cmd/ipam.go Resolved
Comment thread daemon/cmd/ipam.go Resolved
Comment thread daemon/cmd/local_node_sync.go Resolved
@haozhangami
haozhangami force-pushed the restore-health-ips-from-k8s-resource branch 2 times, most recently from c04b92f to b820708 Compare January 26, 2024 13:55
@haozhangami
haozhangami requested a review from giorio94 January 26, 2024 14:25

@giorio94 giorio94 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Just one final comment which I overlooked earlier.

Comment thread daemon/cmd/local_node_sync.go Resolved
@haozhangami
haozhangami force-pushed the restore-health-ips-from-k8s-resource branch from b820708 to afc0fdc Compare January 26, 2024 16:07
Currently, although health IPs are recorded in the ciliumnode
resource, cilium will allocate a new health IP when the cilium
agent restarts. In addition, it will cause unnecessary node update
events.

This patch obtains health IPs from ciliumnode and restores them.
If the restoration fails, a new health IP is allocated.

Signed-off-by: Hao Zhang <[email protected]>
@haozhangami
haozhangami force-pushed the restore-health-ips-from-k8s-resource branch from afc0fdc to 8a23e15 Compare January 26, 2024 16:09
@giorio94

Copy link
Copy Markdown
Member

/test

@derailed derailed left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haozhangami Thank you for the updates!

@gandro gandro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thank you!

@maintainer-s-little-helper maintainer-s-little-helper Bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Jan 29, 2024
@julianwiedmann
julianwiedmann added this pull request to the merge queue Jan 29, 2024
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jan 29, 2024
@julianwiedmann
julianwiedmann added this pull request to the merge queue Jan 29, 2024
Merged via the queue into cilium:main with commit 023818c Jan 29, 2024
jaffcheng pushed a commit to ctripcloud/cilium that referenced this pull request Apr 9, 2024
The latest cilium version will restore health IPs from the local
ciliumnode resource. This patch can be removed when we upgrade
to the new version.

backport cilium#30383

Ref: issue#1908
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent Cilium agent related. kind/community-contribution This was a contribution made by a community member. kind/enhancement This would improve or streamline existing functionality. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/minor This PR changes functionality that users may find relevant to operating Cilium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants