security context
This commit is contained in:
parent
dde00b7606
commit
f7e0148ea0
@ -281,6 +281,12 @@ class ClusterInfo:
|
||||
env=envs,
|
||||
ports=[client.V1ContainerPort(container_port=port)],
|
||||
volume_mounts=volume_mounts,
|
||||
security_context=client.V1SecurityContext(
|
||||
privileged=self.spec.get_privileged(),
|
||||
capabilities=client.V1Capabilities(
|
||||
add=self.spec.get_capabilities()
|
||||
) if self.spec.get_capabilities() else None
|
||||
),
|
||||
resources=to_k8s_resource_requirements(resources),
|
||||
)
|
||||
containers.append(container)
|
||||
|
@ -112,3 +112,9 @@ class Spec:
|
||||
|
||||
def get_labels(self):
|
||||
return self.obj.get("labels", {})
|
||||
|
||||
def get_privileged(self):
|
||||
return "true" == str(self.obj.get("security", {}).get("privileged", "false")).lower()
|
||||
|
||||
def get_capabilities(self):
|
||||
return self.obj.get("security", {}).get("capabilities", [])
|
Loading…
Reference in New Issue
Block a user