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

Swap misidentified due to trailing newline in file #1751

Closed
linuxdaemon opened this issue Jun 30, 2024 · 3 comments · Fixed by #1781
Closed

Swap misidentified due to trailing newline in file #1751

linuxdaemon opened this issue Jun 30, 2024 · 3 comments · Fixed by #1781
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@linuxdaemon
Copy link

What happened:

While deploying NFD 0.16.0 on a k8s 1.30.2 node (Ubuntu 22.04), I noticed it assigned memory-swap=true despite swap not being enabled on this system.

What you expected to happen:

I expected NFD to recognize that no swap device is registered

How to reproduce it (as minimally and precisely as possible):

As far as I can tell, the issue is that /proc/swaps ends in a newline character \n, while the testdata has no such trailing newline. So any system which has /proc/swaps with a trailing newline will be misidentified.

Anything else we need to know?:

This system is a VM which was initially created with swap which was then removed as part of the k8s provisioning process. /proc/swaps contains only the header line and a single \n character now.

Environment:

  • Kubernetes version (use kubectl version): v1.30.2
  • Cloud provider or hardware configuration: VM on local proxmox instance
  • OS (e.g: cat /etc/os-release): Ubuntu 22.04
  • Kernel (e.g. uname -a): 5.15.0-113-generic
  • Install tools:
    • Cluster created with kubeadm version: &version.Info{Major:"1", Minor:"30", GitVersion:"v1.30.2", GitCommit:"39683505b630ff2121012f3c5b16215a1449d5ed", GitTreeState:"clean", BuildDate:"2024-06-11T20:27:59Z", GoVersion:"go1.22.4", Compiler:"gc", Platform:"linux/amd64"}
    • Helm: Terraform provider version 2.14.0

I believe the fix is as simple as ignoring empty lines when checking number of lines in the file, though I won't have time to open a PR until next weekend at the earliest, so someone else is welcome to take this on as well.

@linuxdaemon linuxdaemon added the kind/bug Categorizes issue or PR as related to a bug. label Jun 30, 2024
@marquiz
Copy link
Contributor

marquiz commented Jul 8, 2024

Thanks @linuxdaemon for reporting this issue.

ping @kannon92 @TessaIO

@TessaIO
Copy link
Member

TessaIO commented Jul 8, 2024

I will look into this ASAP!

@TessaIO
Copy link
Member

TessaIO commented Jul 8, 2024

/assign

@marquiz marquiz mentioned this issue Jul 12, 2024
15 tasks
nrdufour pushed a commit to nrdufour/home-ops that referenced this issue Jul 17, 2024
…480)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [node-feature-discovery](https://github.com/kubernetes-sigs/node-feature-discovery) | patch | `0.16.2` -> `0.16.3` |

---

### Release Notes

<details>
<summary>kubernetes-sigs/node-feature-discovery (node-feature-discovery)</summary>

### [`v0.16.3`](https://github.com/kubernetes-sigs/node-feature-discovery/releases/tag/v0.16.3)

[Compare Source](kubernetes-sigs/node-feature-discovery@v0.16.2...v0.16.3)

Fix detection of swap in some scenarios ([#&#8203;1751](kubernetes-sigs/node-feature-discovery#1751)) and add Helm parameter to set the revisionHistoryLimit of nfd-master and nfd-gc ([#&#8203;1759](kubernetes-sigs/node-feature-discovery#1759)).

**Full Changelog**: kubernetes-sigs/node-feature-discovery@v0.16.2...v0.16.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzIuMCIsInVwZGF0ZWRJblZlciI6IjM3LjQzMi4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://git.internal/nrdufour/home-ops/pulls/480
Co-authored-by: Renovate <renovate@ptinem.casa>
Co-committed-by: Renovate <renovate@ptinem.casa>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
3 participants