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

Only drop capabilities that are not added #3972

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion paasta_tools/kubernetes_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,16 @@ def get_security_context(self) -> Optional[V1SecurityContext]:
return V1SecurityContext(capabilities=V1Capabilities(drop=CAPS_DROP))
else:
return V1SecurityContext(
capabilities=V1Capabilities(add=cap_add, drop=CAPS_DROP)
# XXX: we should probably generally work in sets, but V1Capabilities is typed as accepting
# lists of string only
capabilities=V1Capabilities(
add=cap_add,
# NOTE: this is necessary as containerd differs in behavior from dockershim: in dockershim
# dropped capabilities were overriden if the same capability was added - but in containerd
# the dropped capabilities appear to have higher priority.
# (or maybe this is a k8s behavior change?)
drop=list(set(CAPS_DROP) - set(cap_add)),
)
)

def get_kubernetes_containers(
Expand Down
Loading