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

feat: optional bpf mount #24161

Merged
merged 1 commit into from Mar 7, 2023
Merged

Conversation

frezbo
Copy link
Contributor

@frezbo frezbo commented Mar 3, 2023

On distributions that already mount the bpffs filesystem at /sys/fs/bpf this is a good way to optionally disable the bpf mount init container and have no pods running with securityContext.privilged and also reduced the number of init containers that needs to be run.

This option was previously used when containerRuntime.integration=crio
helm value was set, since this is not just only specific to crio,
deprecate the containerRuntime.integration=crio option to skip
mounting bpffs filesystem in favour of bpf.autoMount.enabled which
is similar to how cgroupv2 mounts are disabled (cgroup.autoMount.enabled).

Eg: On Talos both cgroupv2 and bpffs filesystems are already mounted and using a values yaml like below helps reduce the number of init containers by a factor of two.

partial-values.yaml

cgroup:
  autoMount:
    enabled: false
  hostRoot: /sys/fs/cgroup
bpf:
  autoMount:
    enabled: false

@frezbo frezbo requested review from a team as code owners March 3, 2023 16:30
@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 Mar 3, 2023
@github-actions github-actions bot added the kind/community-contribution This was a contribution made by a community member. label Mar 3, 2023
Copy link
Member

@aanm aanm left a comment

Choose a reason for hiding this comment

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

@frezbo Thank you for the PR. Have you checked all other places that have the comment CRI-O already mounts the BPF filesystem in the install/kubernetes/cilium/templates/cilium-agent/daemonset.yaml file? Might make sense to also add the bpf.autoMount.enabled there.

@aanm aanm self-requested a review March 3, 2023 19:16
@aanm aanm added the release-note/minor This PR changes functionality that users may find relevant to operating Cilium. label Mar 3, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Mar 3, 2023
@frezbo
Copy link
Contributor Author

frezbo commented Mar 3, 2023

@frezbo Thank you for the PR. Have you checked all other places that have the comment CRI-O already mounts the BPF filesystem in the install/kubernetes/cilium/templates/cilium-agent/daemonset.yaml file? Might make sense to also add the bpf.autoMount.enabled there.

I can update that too, good point

@frezbo
Copy link
Contributor Author

frezbo commented Mar 3, 2023

@aanm quick question, should i move from containerRuntime.integration and use bpf.autoMount.enabled instead and update the release notes or keep both?

@frezbo
Copy link
Contributor Author

frezbo commented Mar 3, 2023

I've tested with the mount paths and the init container removed and all cilium connectivity test passes.

@aanm
Copy link
Member

aanm commented Mar 3, 2023

@aanm quick question, should i move from containerRuntime.integration and use bpf.autoMount.enabled instead and update the release notes or keep both?

@frezbo I would suggest to keep both and mark the containerRuntime.integration as deprecated because AFAIK the only reason why it's used is for the bpf mounting points.

@frezbo frezbo requested a review from a team as a code owner March 4, 2023 07:33
@frezbo frezbo requested a review from qmonnet March 4, 2023 07:33
@frezbo
Copy link
Contributor Author

frezbo commented Mar 4, 2023

I've updated the PR and also removed some old references to un-used containerRuntime.integration values and removed the un-used containerRuntime.socketPath option. Also updated the upgrade notes to mention bpf.autoMount.enabled will be the default going forward and the old containerRuntime.integration will be deprecated. I hope this clears things up.

@aanm
Copy link
Member

aanm commented Mar 6, 2023

/test

Job 'Cilium-PR-K8s-1.26-kernel-net-next' failed:

Click to show.

Test Name

K8sDatapathConfig MonitorAggregation Checks that monitor aggregation flags send notifications

Failure Output

FAIL: Error creating resource /home/jenkins/workspace/Cilium-PR-K8s-1.26-kernel-net-next/src/github.com/cilium/cilium/test/k8s/manifests/l3-policy-demo.yaml: Cannot retrieve "cilium-bd9rl"'s policy revision: cannot get policy revision: ""

If it is a flake and a GitHub issue doesn't already exist to track it, comment /mlh new-flake Cilium-PR-K8s-1.26-kernel-net-next so I can create one.

Copy link
Member

@kaworu kaworu left a comment

Choose a reason for hiding this comment

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

Hi @frezbo and thanks for the PR! Patch LGTM but doc update seems missing.

Documentation/operations/upgrade.rst Show resolved Hide resolved
Copy link
Member

@qmonnet qmonnet left a comment

Choose a reason for hiding this comment

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

Please also provide context for the deprecation in the commit description. As it stands, without reading the discussion in the PR, the change looks unrelated to the autoMount addition and it's hard to understand why it's part of the commit.

@frezbo
Copy link
Contributor Author

frezbo commented Mar 6, 2023

Updated the extra documentation and commit message.

Copy link
Member

@qmonnet qmonnet left a comment

Choose a reason for hiding this comment

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

Looks good, thank you!

@qmonnet qmonnet requested a review from kaworu March 7, 2023 10:34
Copy link
Member

@kaworu kaworu left a comment

Choose a reason for hiding this comment

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

Thank you @frezbo, patch LGTM besides @qmonnet's comment.

@kaworu kaworu added area/documentation Impacts the documentation, including textual changes, sphinx, or other doc generation code. area/helm Impacts helm charts and user deployment experience labels Mar 7, 2023
On distributions that already mount the `bpffs` filesystem at
`/sys/fs/bpf` this is a good way to optionally disable the bpf mount
init container and have no pods running with `securityContext.privilged`
and also reduced the number of init containers that needs to be run.

This option was previously used when `containerRuntime.integration=crio`
helm value was set, since this is not just only specific to crio,
deprecate the `containerRuntime.integration=crio` option to skip
mounting `bpffs` filesystem in favour of `bpf.autoMount.enabled` which
is similar to how `cgroupv2` mounts are disabled (`cgroup.autoMount.enabled`).

Eg: On [Talos](https://www.talos.dev/) both `cgroupv2` and `bpffs`
filesystems are already mounted and using a values yaml like below helps
reduce the number of init containers by a factor of two.

`partial-values.yaml`

```yaml
cgroup:
  autoMount:
    enabled: false
  hostRoot: /sys/fs/cgroup
bpf:
  autoMount:
    enabled: false
```

Signed-off-by: Noel Georgi <git@frezbo.dev>
Copy link
Member

@qmonnet qmonnet left a comment

Choose a reason for hiding this comment

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

Perfect, thanks a lot!

@qmonnet
Copy link
Member

qmonnet commented Mar 7, 2023

/test

@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 Mar 7, 2023
@borkmann borkmann merged commit 4274616 into cilium:master Mar 7, 2023
sayboras added a commit that referenced this pull request Apr 13, 2024
Relates: #24161
Signed-off-by: Tam Mach <tam.mach@cilium.io>
sayboras added a commit that referenced this pull request Apr 13, 2024
Relates: #24161
Signed-off-by: Tam Mach <tam.mach@cilium.io>
sayboras added a commit that referenced this pull request Apr 13, 2024
Relates: #24161
Signed-off-by: Tam Mach <tam.mach@cilium.io>
github-merge-queue bot pushed a commit that referenced this pull request Apr 16, 2024
Relates: #24161
Signed-off-by: Tam Mach <tam.mach@cilium.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Impacts the documentation, including textual changes, sphinx, or other doc generation code. area/helm Impacts helm charts and user deployment experience kind/community-contribution This was a contribution made by a community member. 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.

None yet

6 participants