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

Use regex for all containers in pod cgroup #75

Merged
merged 1 commit into from
Dec 9, 2020

Conversation

Bolodya1997
Copy link

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.

.golangci.yml Outdated
@@ -169,3 +169,13 @@ issues:
exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0
exclude-rules:
Copy link
Member

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?


func podCgroupDirPath(containerCgroupDirPath string) string {
split := strings.Split(containerCgroupDirPath, string(filepath.Separator))
split[len(split)-1] = "*" // any container match
Copy link
Member

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?

Copy link
Author

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))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return strings.Join(split, string(filepath.Separator))
return path.Join(split...)

Copy link
Author

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>
@denis-tingaikin denis-tingaikin merged commit 5b75a6a into networkservicemesh:master Dec 9, 2020
nsmbot pushed a commit that referenced this pull request Jun 2, 2021
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants