-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Check conntrack module presence instead of kernel version #10662
Check conntrack module presence instead of kernel version #10662
Conversation
Hi @VannTen. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
# Ensure IPVS required kernel module is picked based on Linux Kernel version | ||
# in reference to: https://github.com/kubernetes/kubernetes/blob/master/pkg/proxy/ipvs/README.md#run-kube-proxy-in-ipvs-mode | ||
conntrack_module: "{{ ansible_kernel is version_compare('4.19', '>=') | ternary('nf_conntrack', 'nf_conntrack_ipv4') }}" | ||
conntrack_modules: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits: I think it would be nice to have a small comment explaining that only the first sucessful module will be loaded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah actually there is one word misspelled
roles/kubernetes/node/defaults/main.yml:252:64: "sucessfully" is a misspelling of "successfully"
state: present | ||
persistent: present |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it only persist it when the modprobe is a success?
I would assume so, but it's undocumented. Gonna check.
|
Indeed, it only adds it if successful $ ANSIBLE_STDOUT_CALLBACK=debug ansible-playbook -i localhost playbook.yml -b
[WARNING]: Unable to parse /home/max/client/upstream/localhost as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [localhost] ******************************************************************************************************************************************************************************
TASK [community.general.modprobe] *************************************************************************************************************************************************************
failed: [localhost] (item=nf_conntrack_ipv4) => {
"ansible_loop_var": "item",
"changed": false,
"item": "nf_conntrack_ipv4",
"name": "nf_conntrack_ipv4",
"params": "",
"rc": 1,
"state": "present"
}
STDERR:
modprobe: FATAL: Module nf_conntrack_ipv4 not found in directory /lib/modules/6.6.2-arch1-1
MSG:
modprobe: FATAL: Module nf_conntrack_ipv4 not found in directory /lib/modules/6.6.2-arch1-1
changed: [localhost] => (item=nf_conntrack)
...ignoring
PLAY RECAP ************************************************************************************************************************************************************************************
localhost : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=1
[max@desktop ~/client/upstream] (master *%>)$ cat /etc/mod
modprobe.d/ modulefiles/ modules-load.d/
[max@desktop ~/client/upstream] (master *%>)$ cat /etc/modules-load.d/
gnutls.conf nf_conntrack.conf
[max@desktop ~/client/upstream] (master *%>)$ cat /etc/modules-load.d/nf_conntrack.conf
nf_conntrack # playbook.yml
- hosts: localhost
gather_facts: no
tasks:
- community.general.modprobe:
name: "{{ item }}"
state: present
persistent: present
register: modprobe_conntrack_module
ignore_errors: true # noqa ignore-errors
loop:
- nf_conntrack_ipv4
- nf_conntrack
when:
- "(modprobe_conntrack_module|default({'rc': 1})).rc != 0" # loop until first success |
63e845b
to
ea9a96c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great thank you for this very nice cleanup 🤝
/lgtm
/ok-to-test
Depending on kernel distributor, the kernel version might not be a correct indicator of the conntrack module use. Instead, we check both (and use the first found).
ea9a96c
to
93fd438
Compare
/lgtm |
/assign @mzaian |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @VannTen
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: MrFreezeex, mzaian, VannTen The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…-sigs#10662) * Try both conntrack modules instead of checking kernel version Depending on kernel distributor, the kernel version might not be a correct indicator of the conntrack module use. Instead, we check both (and use the first found). * Use modproble.persistent rather than manual persistence
What type of PR is this?
/kind bug
What this PR does / why we need it:
Depending on kernel distributor, the kernel version might not be a
correct indicator of the conntrack module use.
Instead, we check both (and use the first found).
This is a case on a RedHat 8 host I use, with kernel 4.18, where modprobe nf_conntrack succeds and modprobe nf_conntrack_ipv4 fail
Special notes for your reviewer:
The "loop until first success" trick is from https://stackoverflow.com/a/63996744
Follow-up of #10625
Does this PR introduce a user-facing change?: