-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: executor/pns containerid prefix fix #4555
Conversation
Signed-off-by: Lennart Kindermann <lennart.kindermann@cloudseeds.de>
Signed-off-by: Lennart Kindermann <lennart.kindermann@cloudseeds.de>
Signed-off-by: Lennart Kindermann <lennart.kindermann@cloudseeds.de>
Signed-off-by: Lennart Kindermann <lennart.kindermann@cloudseeds.de>
Signed-off-by: Lennart Kindermann <lennart.kindermann@cloudseeds.de>
|
||
// remove possible "*-" prefix | ||
// e.g. crio-7a92a067289f6197148912be1c15f20f0330c7f3c541473d3b9c4043ca137b42.scope | ||
parts := strings.Split(containerID, "-") |
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.
this could panic in len(parts) == 0
?
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.
strings.Split()
always returns a slice of length ≥ 1, as even the empty string, split on any "split char" would result in []string{""}
.
Please refer to the documentation where it says:
If s does not contain sep and sep is not empty, Split returns a slice of length 1 whose only element is s.
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.
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.
My bad - I actually meant line 435 - but I don't think it can panic on closer inspecting
Please sync with master. |
…s-cgroups Signed-off-by: Lennart Kindermann <lennart.kindermann@cloudseeds.de>
Signed-off-by: Lennart Kindermann <lennart.kindermann@cloudseeds.de> Signed-off-by: Paul Brabban <paul.brabban@gmail.com>
Signed-off-by: Lennart Kindermann <lennart.kindermann@cloudseeds.de> Signed-off-by: Alex Capras <alexcapras@gmail.com>
Checklist:
In several environments, where docker is used and the kubelet and docker are managed by systemd, the cgroup line has a
docker-
prefix. Here is a table of the possible combinations and the resulting cgroup lines.This PR fixes the behaviour and removes all possible "*-" prefixes, like "docker-*" in systemd controlled docker/kubelet environments.
Failing example before the fix: