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

Skip non-calico ipsets #8387

Merged
merged 5 commits into from
Jan 15, 2024
Merged

Skip non-calico ipsets #8387

merged 5 commits into from
Jan 15, 2024

Conversation

mazdakn
Copy link
Member

@mazdakn mazdakn commented Jan 3, 2024

Description

Skip non calico IP sets to prevent hitting unsupported protocol version for ipsets created by other components likes kube proxy. The idea is to run ipset list -name to get the list of ipsets, and get more details for calico ipsets by running ipset list [name] instead of running ipset list to get all information for all ipsets including non-calico ones.

Related issues/PRs

Fixes #8372

Todos

  • Tests
  • Documentation
  • Release note

Release Note

Felix now avoids accessing non-Calico IP sets. This reduces the scope for IP set compatibility errors when another app has created an IP set that Calico's version of IP set can't parse.

Reminder for the reviewer

Make sure that this PR has the correct labels and milestone set.

Every PR needs one docs-* label.

  • docs-pr-required: This change requires a change to the documentation that has not been completed yet.
  • docs-completed: This change has all necessary documentation completed.
  • docs-not-required: This change has no user-facing impact and requires no docs.

Every PR needs one release-note-* label.

  • release-note-required: This PR has user-facing changes. Most PRs should have this label.
  • release-note-not-required: This PR has no user-facing changes.

Other optional labels:

  • cherry-pick-candidate: This PR should be cherry-picked to an earlier release. For bug fixes only.
  • needs-operator-pr: This PR is related to install and requires a corresponding change to the operator.

@mazdakn mazdakn added release-note-required Change has user-facing impact (no matter how small) docs-not-required Docs not required for this change labels Jan 3, 2024
@mazdakn mazdakn requested a review from a team as a code owner January 3, 2024 21:16
@marvin-tigera marvin-tigera added this to the Calico v3.28.0 milestone Jan 3, 2024
@mazdakn mazdakn requested a review from fasaxc January 3, 2024 22:44
@mazdakn mazdakn changed the title bump ipset protocol version [WIP] bump ipset protocol version Jan 4, 2024
@mazdakn mazdakn force-pushed the bump-ipset branch 2 times, most recently from 476f9c1 to 9ca2843 Compare January 10, 2024 23:27
@mazdakn mazdakn changed the title [WIP] bump ipset protocol version Skip non-calico ipsets Jan 10, 2024
@mazdakn mazdakn added release-note-not-required Change has no user-facing impact and removed release-note-required Change has user-facing impact (no matter how small) labels Jan 10, 2024
Copy link
Member

@fasaxc fasaxc left a comment

Choose a reason for hiding this comment

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

Thanks, generally looking good; a few comments inline; mainly on naming/style suggestions.

Is there any sane way that we could write an FV test for this? How easy is it to get hold of a newer ipset binary to create a "bad" IP set? Could we do

docker run <some off the shelf image> -net=<felix container> ipset create foo bar

perhaps?

felix/ipsets/ipsets.go Outdated Show resolved Hide resolved
felix/ipsets/ipsets.go Outdated Show resolved Hide resolved
felix/ipsets/ipsets.go Outdated Show resolved Hide resolved
felix/ipsets/ipsets.go Outdated Show resolved Hide resolved
felix/ipsets/ipsets.go Outdated Show resolved Hide resolved
felix/ipsets/ipsets.go Outdated Show resolved Hide resolved
felix/ipsets/ipsets.go Outdated Show resolved Hide resolved
felix/ipsets/ipsets.go Outdated Show resolved Hide resolved
felix/ipsets/ipsets.go Outdated Show resolved Hide resolved
felix/ipsets/ipsets_test.go Show resolved Hide resolved
@mazdakn
Copy link
Member Author

mazdakn commented Jan 12, 2024

@fasaxc adding a test to check this reliably depends on the host's kernel version:

[root@felix-0-61811-4-felixfv /]# ipset create test hash:ip bitmask 24
ipset v7.19: Argument `bitmask' is supported in the kernel module of the set type hash:ip starting from the revision 6 and you have installed revision 5 only. Your kernel is behind your ipset utility.
Try `ipset help' for more information.
[root@felix-0-61811-4-felixfv /]# uname -r
5.15.0-91-generic

So if we add a test to verify the error and also its fix, it would run differently based on the host. Unless we skip the test based on kernel version. In that case, I prefer to add the test in another PR since it would need more work. WDYT?

@mazdakn mazdakn requested a review from fasaxc January 12, 2024 19:30
@mazdakn mazdakn linked an issue Jan 12, 2024 that may be closed by this pull request
Copy link
Member

@fasaxc fasaxc left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for taking my style comments on board; code looks really clean (to me!) now. Let's not add the extra test; sounds like it's too fiddly to do given the kernel limits.

One nit-level comment but I don't need to see it again.

@fasaxc fasaxc added release-note-required Change has user-facing impact (no matter how small) and removed release-note-not-required Change has no user-facing impact labels Jan 15, 2024
@mazdakn mazdakn merged commit b2cde56 into projectcalico:master Jan 15, 2024
2 checks passed
@mazdakn mazdakn deleted the bump-ipset branch January 15, 2024 19:12
mazdakn added a commit to mazdakn/calico that referenced this pull request Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-completed PR has been cherry-picked docs-not-required Docs not required for this change release-note-required Change has user-facing impact (no matter how small)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calico incompatible ipset protocol version (again)
3 participants