本文整理匯總了Python中kubernetes.client.V1SecurityContext方法的典型用法代碼示例。如果您正苦於以下問題:Python client.V1SecurityContext方法的具體用法?Python client.V1SecurityContext怎麽用?Python client.V1SecurityContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類kubernetes.client
的用法示例。
在下文中一共展示了client.V1SecurityContext方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_security_context
# 需要導入模塊: from kubernetes import client [as 別名]
# 或者: from kubernetes.client import V1SecurityContext [as 別名]
def get_security_context(self) -> Optional[V1SecurityContext]:
cap_add = self.config_dict.get("cap_add", None)
if cap_add is None:
return None
return V1SecurityContext(capabilities=V1Capabilities(add=cap_add))
示例2: test_get_security_context_with_cap_add
# 需要導入模塊: from kubernetes import client [as 別名]
# 或者: from kubernetes.client import V1SecurityContext [as 別名]
def test_get_security_context_with_cap_add(self):
self.deployment.config_dict["cap_add"] = ["SETGID"]
expected_security_context = V1SecurityContext(
capabilities=V1Capabilities(add=["SETGID"])
)
assert self.deployment.get_security_context() == expected_security_context