Class V1SecurityContext
java.lang.Object
io.kubernetes.client.openapi.models.V1SecurityContext
@Generated(value="org.openapitools.codegen.languages.JavaClientCodegen",
date="2024-02-02T17:56:12.287571Z[Etc/UTC]")
public class V1SecurityContext
extends Object
SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext. When both are set, the values in SecurityContext take precedence.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallowPrivilegeEscalation
(Boolean allowPrivilegeEscalation) capabilities
(V1Capabilities capabilities) boolean
static V1SecurityContext
Create an instance of V1SecurityContext given an JSON stringAllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process.Get capabilitiesRun container in privileged mode.procMount denotes the type of proc mount to use for the containers.Whether this container has a read-only root filesystem.The GID to run the entrypoint of the container process.Indicates that the container must run as a non-root user.The UID to run the entrypoint of the container process.Get seccompProfileGet seLinuxOptionsGet windowsOptionsint
hashCode()
privileged
(Boolean privileged) readOnlyRootFilesystem
(Boolean readOnlyRootFilesystem) runAsGroup
(Long runAsGroup) runAsNonRoot
(Boolean runAsNonRoot) seccompProfile
(V1SeccompProfile seccompProfile) seLinuxOptions
(V1SELinuxOptions seLinuxOptions) void
setAllowPrivilegeEscalation
(Boolean allowPrivilegeEscalation) void
setCapabilities
(V1Capabilities capabilities) void
setPrivileged
(Boolean privileged) void
setProcMount
(String procMount) void
setReadOnlyRootFilesystem
(Boolean readOnlyRootFilesystem) void
setRunAsGroup
(Long runAsGroup) void
setRunAsNonRoot
(Boolean runAsNonRoot) void
setRunAsUser
(Long runAsUser) void
setSeccompProfile
(V1SeccompProfile seccompProfile) void
setSeLinuxOptions
(V1SELinuxOptions seLinuxOptions) void
setWindowsOptions
(V1WindowsSecurityContextOptions windowsOptions) toJson()
Convert an instance of V1SecurityContext to an JSON stringtoString()
static void
validateJsonObject
(com.google.gson.JsonObject jsonObj) Validates the JSON Object and throws an exception if issues foundwindowsOptions
(V1WindowsSecurityContextOptions windowsOptions)
-
Field Details
-
SERIALIZED_NAME_ALLOW_PRIVILEGE_ESCALATION
- See Also:
-
SERIALIZED_NAME_CAPABILITIES
- See Also:
-
SERIALIZED_NAME_PRIVILEGED
- See Also:
-
SERIALIZED_NAME_PROC_MOUNT
- See Also:
-
SERIALIZED_NAME_READ_ONLY_ROOT_FILESYSTEM
- See Also:
-
SERIALIZED_NAME_RUN_AS_GROUP
- See Also:
-
SERIALIZED_NAME_RUN_AS_NON_ROOT
- See Also:
-
SERIALIZED_NAME_RUN_AS_USER
- See Also:
-
SERIALIZED_NAME_SE_LINUX_OPTIONS
- See Also:
-
SERIALIZED_NAME_SECCOMP_PROFILE
- See Also:
-
SERIALIZED_NAME_WINDOWS_OPTIONS
- See Also:
-
openapiFields
-
openapiRequiredFields
-
-
Constructor Details
-
V1SecurityContext
public V1SecurityContext()
-
-
Method Details
-
allowPrivilegeEscalation
-
getAllowPrivilegeEscalation
AllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN Note that this field cannot be set when spec.os.name is windows.- Returns:
- allowPrivilegeEscalation
-
setAllowPrivilegeEscalation
-
capabilities
-
getCapabilities
Get capabilities- Returns:
- capabilities
-
setCapabilities
-
privileged
-
getPrivileged
Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false. Note that this field cannot be set when spec.os.name is windows.- Returns:
- privileged
-
setPrivileged
-
procMount
-
getProcMount
procMount denotes the type of proc mount to use for the containers. The default is DefaultProcMount which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows.- Returns:
- procMount
-
setProcMount
-
readOnlyRootFilesystem
-
getReadOnlyRootFilesystem
Whether this container has a read-only root filesystem. Default is false. Note that this field cannot be set when spec.os.name is windows.- Returns:
- readOnlyRootFilesystem
-
setReadOnlyRootFilesystem
-
runAsGroup
-
getRunAsGroup
The GID to run the entrypoint of the container process. Uses runtime default if unset. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows.- Returns:
- runAsGroup
-
setRunAsGroup
-
runAsNonRoot
-
getRunAsNonRoot
Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.- Returns:
- runAsNonRoot
-
setRunAsNonRoot
-
runAsUser
-
getRunAsUser
The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence. Note that this field cannot be set when spec.os.name is windows.- Returns:
- runAsUser
-
setRunAsUser
-
seLinuxOptions
-
getSeLinuxOptions
Get seLinuxOptions- Returns:
- seLinuxOptions
-
setSeLinuxOptions
-
seccompProfile
-
getSeccompProfile
Get seccompProfile- Returns:
- seccompProfile
-
setSeccompProfile
-
windowsOptions
-
getWindowsOptions
Get windowsOptions- Returns:
- windowsOptions
-
setWindowsOptions
-
equals
-
hashCode
public int hashCode() -
toString
-
validateJsonObject
Validates the JSON Object and throws an exception if issues found- Parameters:
jsonObj
- JSON Object- Throws:
IOException
- if the JSON Object is invalid with respect to V1SecurityContext
-
fromJson
Create an instance of V1SecurityContext given an JSON string- Parameters:
jsonString
- JSON string- Returns:
- An instance of V1SecurityContext
- Throws:
IOException
- if the JSON string is invalid with respect to V1SecurityContext
-
toJson
Convert an instance of V1SecurityContext to an JSON string- Returns:
- JSON string
-