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

Fix permission issue when copying cni plugins onto host path #24891

Merged
merged 1 commit into from
May 4, 2023

Conversation

JohnJAS
Copy link

@JohnJAS JohnJAS commented Apr 14, 2023

Fix permission issue when copying cni plugins onto host path.

The root cause is that the init container 'install-cni-binaries' didn't have securityContext.privileged settings inside the yaml like other init containers do. It leads to that it failed to copy cni binaries onto the hostpath which has no root permisison.

Fixes: #24889

Signed-off-by: Joseph Sheng jiajun.sheng@microfocus.com

@JohnJAS JohnJAS requested review from a team as code owners April 14, 2023 08:00
@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 Apr 14, 2023
@github-actions github-actions bot added the kind/community-contribution This was a contribution made by a community member. label Apr 14, 2023
@tommyp1ckles
Copy link
Contributor

Think the change makes sense

CC @squeed I'm looking at your last change here: e1a4621. Was the intention that this works without the privileged init container?

@tommyp1ckles
Copy link
Contributor

As well, thanks for the contribution!

Copy link
Member

@gandro gandro left a comment

Choose a reason for hiding this comment

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

Thanks!

@gandro gandro added the release-note/misc This PR makes changes that have no direct user impact. label Apr 17, 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 Apr 17, 2023
@gandro gandro added release-note/bug This PR fixes an issue in a previous release of Cilium. needs-backport/1.13 This PR / issue needs backporting to the v1.13 branch and removed release-note/misc This PR makes changes that have no direct user impact. labels Apr 17, 2023
@squeed
Copy link
Contributor

squeed commented Apr 18, 2023

I'm surprised this is necessary - @JohnJAS, what sort of issues did you have? Why was the privileged flag required?

@JohnJAS JohnJAS closed this Apr 20, 2023
@JohnJAS JohnJAS reopened this Apr 20, 2023
@JohnJAS
Copy link
Author

JohnJAS commented Apr 20, 2023

I'm surprised this is necessary - @JohnJAS, what sort of issues did you have? Why was the privileged flag required?

@squeed If cilium agent pod was started as root user, the root user inside container could not directly copy stuffs to the cni folder on hostpath which was not owned by root user. A root user inside a container is not equal to the root user on the host machine. It needs privileged in this case.
And another init contianer mount-cgroup has the same issue but it has the privileged flag to handle this case.

securityContext:
{{- if .Values.securityContext.privileged }}
privileged: true

IMO, if mount-cgroup container has the privileged flag, the same as install-cni-binaries .

Please refer to more details in #24889.

@squeed
Copy link
Contributor

squeed commented Apr 20, 2023

Huh. "works on my machine", but clearly this fixes a real issue. LGTM.

@gandro
Copy link
Member

gandro commented Apr 26, 2023

/test

1 similar comment
@JohnJAS
Copy link
Author

JohnJAS commented May 4, 2023

/test

@JohnJAS
Copy link
Author

JohnJAS commented May 4, 2023

hi @gandro, i found that the CI test failed due to the connection timed out, but i think it was not related to the code change.
Err:1 http://azure.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libnss-systemd amd64 249.11-0ubuntu3.9 Could not connect to azure.archive.ubuntu.com:80 (52.147.219.192), connection timed out
I commented \test but it didn't trigger another CI test. What else should I do for this PR?

@gandro
Copy link
Member

gandro commented May 4, 2023

I commented \test but it didn't trigger another CI test. What else should I do for this PR?

At the moment, only contributors with the commit bit can trigger the tests. Feel free to ping me or @cilium/tophat if you require the tests to be re-run.

i found that the CI test failed due to the connection timed out, but i think it was not related to the code change.

There are multiple different test failures. Many of them have Cilium in a CrashLoopBackoff. Just looking at "Suite-k8s-1.25.K8sDatapathConfig Transparent encryption DirectRouting Check connectivity with transparent encryption and direct routing with bpf_host", the reason for the crash is:

level=fatal msg="auto-direct-node-routes cannot be used with tunneling. Packets must be routed through the tunnel device." subsys=daemon

This is fortunately an unrelated issue:

We recently renamed that flag and the test driver code is using the new flag, where as you branch does not yet understand it. Could you rebase your PR on main to pull in the recent changes? After that, we can re-run CI again and triage the failures again.

Signed-off-by: Joseph Sheng <jiajun.sheng@microfocus.com>
@JohnJAS
Copy link
Author

JohnJAS commented May 4, 2023

@gandro it's done, thanks for the reply ;-)

@gandro
Copy link
Member

gandro commented May 4, 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 May 4, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from main in 1.13.3 May 4, 2023
@joestringer joestringer merged commit 00ec56d into cilium:main May 4, 2023
55 of 57 checks passed
@YutaroHayakawa YutaroHayakawa mentioned this pull request May 10, 2023
14 tasks
@YutaroHayakawa YutaroHayakawa added backport-pending/1.13 The backport for Cilium 1.13.x for this PR is in progress. and removed needs-backport/1.13 This PR / issue needs backporting to the v1.13 branch labels May 10, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from main to Backport pending to v1.13 in 1.13.3 May 10, 2023
@julianwiedmann julianwiedmann added backport-done/1.13 The backport for Cilium 1.13.x for this PR is done. and removed backport-pending/1.13 The backport for Cilium 1.13.x for this PR is in progress. labels Jul 10, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.13 to Backport done to v1.13 in 1.13.3 Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-done/1.13 The backport for Cilium 1.13.x for this PR is done. 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/bug This PR fixes an issue in a previous release of Cilium.
Projects
No open projects
1.13.3
Backport done to v1.13
Development

Successfully merging this pull request may close these issues.

cilium init container failed to copy cni onto hostpath due to permission denied
7 participants