-
Notifications
You must be signed in to change notification settings - Fork 14
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
Use regex for all containers in pod cgroup #75
Use regex for all containers in pod cgroup #75
Conversation
.golangci.yml
Outdated
@@ -169,3 +169,13 @@ issues: | |||
exclude-use-default: false | |||
max-issues-per-linter: 0 | |||
max-same-issues: 0 | |||
exclude-rules: |
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.
Could you add .golangci.yml
into .templateingore?
d00f555
to
d79c5eb
Compare
|
||
func podCgroupDirPath(containerCgroupDirPath string) string { | ||
split := strings.Split(containerCgroupDirPath, string(filepath.Separator)) | ||
split[len(split)-1] = "*" // any container match |
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.
Why do we need to replace here?
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.
For kubernetes we have such cgroup path for the container:
.../pod-id/container-id
so if we want select all containers in pod, it should be:
.../pod-id/*
main.go
Outdated
func podCgroupDirPath(containerCgroupDirPath string) string { | ||
split := strings.Split(containerCgroupDirPath, string(filepath.Separator)) | ||
split[len(split)-1] = "*" // any container match | ||
return strings.Join(split, string(filepath.Separator)) |
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.
return strings.Join(split, string(filepath.Separator)) | |
return path.Join(split...) |
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.
Fixed.
Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>
d79c5eb
to
7a25b2a
Compare
This PR syncs files with https://github.com/networkservicemesh/cmd-template Revision: https://github.com/networkservicemesh/cmd-template/commits/35cd28e6f6ab4047b0ad0ca35035403e1e8d400d commit 35cd28e6f6ab4047b0ad0ca35035403e1e8d400d Author: Denis Tingaikin <49399980+denis-tingaikin@users.noreply.github.com> Date: Wed Jun 2 22:05:05 2021 +0700 fix: Make consistent sha from 'docker-push-ghcr' and 'update deployments-k8s repository (#75) Signed-off-by: denis-tingajkin <denis.tingajkin@xored.com> Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
Issue
If we pass only sidecar container cgroup, forwarder can't add permissions to the client container.
Solution
Pass regex describing all containers in pod.