Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure iface.FirstPublicAddress isn't a secondary IP #5393

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

juanluisvaladas
Copy link
Contributor

@juanluisvaladas juanluisvaladas commented Dec 31, 2024

Description

This fixes only the automatic address detection for etcd. If a user configures them manually it doesn't attempt to prevent the error.

Fixes #4664

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

  • Manual test
  • Auto test added

Checklist:

  • My code follows the style guidelines of this project
  • My commit messages are signed-off
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@juanluisvaladas juanluisvaladas requested review from a team as code owners December 31, 2024 16:37
@juanluisvaladas juanluisvaladas marked this pull request as draft January 7, 2025 12:58
Copy link
Contributor

github-actions bot commented Jan 7, 2025

This pull request has merge conflicts that need to be resolved.

@juanluisvaladas juanluisvaladas added this to the 1.32 milestone Jan 7, 2025
@juanluisvaladas juanluisvaladas marked this pull request as ready for review January 7, 2025 22:53
@juanluisvaladas juanluisvaladas marked this pull request as draft January 7, 2025 23:01
@juanluisvaladas
Copy link
Contributor Author

On one of my previous attempts I noticed a few things I didn't like in the check-backup inttest. I don't think these are worth a full PR so I decided to sneak these here, but it can be dropped as it's not really the intent of this PR.

@juanluisvaladas juanluisvaladas marked this pull request as ready for review January 8, 2025 11:31
Copy link
Member

@twz123 twz123 left a comment

Choose a reason for hiding this comment

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

I think the title "Prevent CPLB VIPs to be etcd's peer address" is a bit misleading. That's the issue that's getting fixed, but I think a more technical title might be a better fit for the PR. Something that mentions that we're now disregarding secondary IPs when detecting IP addresses.

internal/pkg/iface/iface_linux.go Show resolved Hide resolved
internal/pkg/iface/iface_linux.go Show resolved Hide resolved
inttest/backup/backup_test.go Outdated Show resolved Hide resolved
@juanluisvaladas juanluisvaladas changed the title Prevent CPLB VIPs to be etcd's peer address Ensure iface.FirstPublicAddress isn't a secondary IP Jan 8, 2025
juanluisvaladas and others added 2 commits January 8, 2025 16:19
Only for linux

Co-authored-by: Tom Wieczorek <twz123@users.noreply.github.com>
Signed-off-by: Juan-Luis de Sousa-Valadas Castaño <jvaladas@mirantis.com>
Add -d to make things easier to troubleshoot, remove redundant checks,
fix typos and make some checks slightly shorter.

Signed-off-by: Juan-Luis de Sousa-Valadas Castaño <jvaladas@mirantis.com>
if ipnet, ok := a.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
if ipnet.IP.To4() != nil {
return ipnet.IP.String(), nil
if a != nil && !a.IP.IsLoopback() {
Copy link
Member

Choose a reason for hiding this comment

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

The nil check cloud theoretically be removed, because both sequence implementations won't yield nil values.

Copy link
Contributor Author

@juanluisvaladas juanluisvaladas Jan 8, 2025

Choose a reason for hiding this comment

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

Good point, since this is blocking #5397 (once this merges, there will be a conflict) and it's approved I'll sneak it into #5397.
This way I avoid having this reviewed again...

@juanluisvaladas juanluisvaladas merged commit 0a8fafb into k0sproject:main Jan 8, 2025
92 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CPLB continue to add CPLB IP as etcd.peerAddress
2 participants