Class EphemeralContainer
- java.lang.Object
-
- com.marcnuri.yakc.model.io.k8s.api.core.v1.EphemeralContainer
-
- All Implemented Interfaces:
com.marcnuri.yakc.model.Model
public class EphemeralContainer extends java.lang.Object implements com.marcnuri.yakc.model.Model
An EphemeralContainer is a container that may be added temporarily to an existing pod for user-initiated activities such as debugging. Ephemeral containers have no resource or scheduling guarantees, and they will not be restarted when they exit or when a pod is removed or restarted. If an ephemeral container causes a pod to exceed its resource allocation, the pod may be evicted. Ephemeral containers may not be added by directly updating the pod spec. They must be added via the pod's ephemeralcontainers subresource, and they will appear in the pod spec once added. This is an alpha feature enabled by the EphemeralContainers feature flag.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EphemeralContainer.Builder
-
Constructor Summary
Constructors Constructor Description EphemeralContainer()
EphemeralContainer(java.util.List<java.lang.String> args, java.util.List<java.lang.String> command, java.util.List<EnvVar> env, java.util.List<EnvFromSource> envFrom, java.lang.String image, java.lang.String imagePullPolicy, Lifecycle lifecycle, Probe livenessProbe, @NonNull java.lang.String name, java.util.List<ContainerPort> ports, Probe readinessProbe, ResourceRequirements resources, SecurityContext securityContext, Probe startupProbe, java.lang.Boolean stdin, java.lang.Boolean stdinOnce, java.lang.String targetContainerName, java.lang.String terminationMessagePath, java.lang.String terminationMessagePolicy, java.lang.Boolean tty, java.util.List<VolumeDevice> volumeDevices, java.util.List<VolumeMount> volumeMounts, java.lang.String workingDir)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EphemeralContainer.Builder
builder()
protected boolean
canEqual(java.lang.Object other)
boolean
equals(java.lang.Object o)
java.util.List<java.lang.String>
getArgs()
Arguments to the entrypoint.java.util.List<java.lang.String>
getCommand()
Entrypoint array.java.util.List<EnvVar>
getEnv()
List of environment variables to set in the container.java.util.List<EnvFromSource>
getEnvFrom()
List of sources to populate environment variables in the container.java.lang.String
getImage()
Docker image name.java.lang.String
getImagePullPolicy()
Image pull policy.Lifecycle
getLifecycle()
Probe
getLivenessProbe()
@NonNull java.lang.String
getName()
Name of the ephemeral container specified as a DNS_LABEL.java.util.List<ContainerPort>
getPorts()
Ports are not allowed for ephemeral containers.Probe
getReadinessProbe()
ResourceRequirements
getResources()
SecurityContext
getSecurityContext()
Probe
getStartupProbe()
java.lang.Boolean
getStdin()
Whether this container should allocate a buffer for stdin in the container runtime.java.lang.Boolean
getStdinOnce()
Whether the container runtime should close the stdin channel after it has been opened by a single attach.java.lang.String
getTargetContainerName()
If set, the name of the container from PodSpec that this ephemeral container targets.java.lang.String
getTerminationMessagePath()
Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem.java.lang.String
getTerminationMessagePolicy()
Indicate how the termination message should be populated.java.lang.Boolean
getTty()
Whether this container should allocate a TTY for itself, also requires 'stdin' to be true.java.util.List<VolumeDevice>
getVolumeDevices()
volumeDevices is the list of block devices to be used by the container.java.util.List<VolumeMount>
getVolumeMounts()
Pod volumes to mount into the container's filesystem.java.lang.String
getWorkingDir()
Container's working directory.int
hashCode()
void
setArgs(java.util.List<java.lang.String> args)
Arguments to the entrypoint.void
setCommand(java.util.List<java.lang.String> command)
Entrypoint array.void
setEnv(java.util.List<EnvVar> env)
List of environment variables to set in the container.void
setEnvFrom(java.util.List<EnvFromSource> envFrom)
List of sources to populate environment variables in the container.void
setImage(java.lang.String image)
Docker image name.void
setImagePullPolicy(java.lang.String imagePullPolicy)
Image pull policy.void
setLifecycle(Lifecycle lifecycle)
void
setLivenessProbe(Probe livenessProbe)
void
setName(@NonNull java.lang.String name)
Name of the ephemeral container specified as a DNS_LABEL.void
setPorts(java.util.List<ContainerPort> ports)
Ports are not allowed for ephemeral containers.void
setReadinessProbe(Probe readinessProbe)
void
setResources(ResourceRequirements resources)
void
setSecurityContext(SecurityContext securityContext)
void
setStartupProbe(Probe startupProbe)
void
setStdin(java.lang.Boolean stdin)
Whether this container should allocate a buffer for stdin in the container runtime.void
setStdinOnce(java.lang.Boolean stdinOnce)
Whether the container runtime should close the stdin channel after it has been opened by a single attach.void
setTargetContainerName(java.lang.String targetContainerName)
If set, the name of the container from PodSpec that this ephemeral container targets.void
setTerminationMessagePath(java.lang.String terminationMessagePath)
Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem.void
setTerminationMessagePolicy(java.lang.String terminationMessagePolicy)
Indicate how the termination message should be populated.void
setTty(java.lang.Boolean tty)
Whether this container should allocate a TTY for itself, also requires 'stdin' to be true.void
setVolumeDevices(java.util.List<VolumeDevice> volumeDevices)
volumeDevices is the list of block devices to be used by the container.void
setVolumeMounts(java.util.List<VolumeMount> volumeMounts)
Pod volumes to mount into the container's filesystem.void
setWorkingDir(java.lang.String workingDir)
Container's working directory.EphemeralContainer.Builder
toBuilder()
java.lang.String
toString()
-
-
-
Constructor Detail
-
EphemeralContainer
public EphemeralContainer(java.util.List<java.lang.String> args, java.util.List<java.lang.String> command, java.util.List<EnvVar> env, java.util.List<EnvFromSource> envFrom, java.lang.String image, java.lang.String imagePullPolicy, Lifecycle lifecycle, Probe livenessProbe, @NonNull @NonNull java.lang.String name, java.util.List<ContainerPort> ports, Probe readinessProbe, ResourceRequirements resources, SecurityContext securityContext, Probe startupProbe, java.lang.Boolean stdin, java.lang.Boolean stdinOnce, java.lang.String targetContainerName, java.lang.String terminationMessagePath, java.lang.String terminationMessagePolicy, java.lang.Boolean tty, java.util.List<VolumeDevice> volumeDevices, java.util.List<VolumeMount> volumeMounts, java.lang.String workingDir)
-
EphemeralContainer
public EphemeralContainer()
-
-
Method Detail
-
builder
public static EphemeralContainer.Builder builder()
-
toBuilder
public EphemeralContainer.Builder toBuilder()
-
getArgs
public java.util.List<java.lang.String> getArgs()
Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
-
getCommand
public java.util.List<java.lang.String> getCommand()
Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
-
getEnv
public java.util.List<EnvVar> getEnv()
List of environment variables to set in the container. Cannot be updated.
-
getEnvFrom
public java.util.List<EnvFromSource> getEnvFrom()
List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.
-
getImage
public java.lang.String getImage()
Docker image name. More info: https://kubernetes.io/docs/concepts/containers/images
-
getImagePullPolicy
public java.lang.String getImagePullPolicy()
Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images
-
getLifecycle
public Lifecycle getLifecycle()
-
getLivenessProbe
public Probe getLivenessProbe()
-
getName
@NonNull public @NonNull java.lang.String getName()
Name of the ephemeral container specified as a DNS_LABEL. This name must be unique among all containers, init containers and ephemeral containers.
-
getPorts
public java.util.List<ContainerPort> getPorts()
Ports are not allowed for ephemeral containers.
-
getReadinessProbe
public Probe getReadinessProbe()
-
getResources
public ResourceRequirements getResources()
-
getSecurityContext
public SecurityContext getSecurityContext()
-
getStartupProbe
public Probe getStartupProbe()
-
getStdin
public java.lang.Boolean getStdin()
Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.
-
getStdinOnce
public java.lang.Boolean getStdinOnce()
Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false
-
getTargetContainerName
public java.lang.String getTargetContainerName()
If set, the name of the container from PodSpec that this ephemeral container targets. The ephemeral container will be run in the namespaces (IPC, PID, etc) of this container. If not set then the ephemeral container is run in whatever namespaces are shared for the pod. Note that the container runtime must support this feature.
-
getTerminationMessagePath
public java.lang.String getTerminationMessagePath()
Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.
-
getTerminationMessagePolicy
public java.lang.String getTerminationMessagePolicy()
Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.
-
getTty
public java.lang.Boolean getTty()
Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.
-
getVolumeDevices
public java.util.List<VolumeDevice> getVolumeDevices()
volumeDevices is the list of block devices to be used by the container.
-
getVolumeMounts
public java.util.List<VolumeMount> getVolumeMounts()
Pod volumes to mount into the container's filesystem. Cannot be updated.
-
getWorkingDir
public java.lang.String getWorkingDir()
Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.
-
setArgs
public void setArgs(java.util.List<java.lang.String> args)
Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
-
setCommand
public void setCommand(java.util.List<java.lang.String> command)
Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
-
setEnv
public void setEnv(java.util.List<EnvVar> env)
List of environment variables to set in the container. Cannot be updated.
-
setEnvFrom
public void setEnvFrom(java.util.List<EnvFromSource> envFrom)
List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.
-
setImage
public void setImage(java.lang.String image)
Docker image name. More info: https://kubernetes.io/docs/concepts/containers/images
-
setImagePullPolicy
public void setImagePullPolicy(java.lang.String imagePullPolicy)
Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images
-
setLifecycle
public void setLifecycle(Lifecycle lifecycle)
-
setLivenessProbe
public void setLivenessProbe(Probe livenessProbe)
-
setName
public void setName(@NonNull @NonNull java.lang.String name)
Name of the ephemeral container specified as a DNS_LABEL. This name must be unique among all containers, init containers and ephemeral containers.
-
setPorts
public void setPorts(java.util.List<ContainerPort> ports)
Ports are not allowed for ephemeral containers.
-
setReadinessProbe
public void setReadinessProbe(Probe readinessProbe)
-
setResources
public void setResources(ResourceRequirements resources)
-
setSecurityContext
public void setSecurityContext(SecurityContext securityContext)
-
setStartupProbe
public void setStartupProbe(Probe startupProbe)
-
setStdin
public void setStdin(java.lang.Boolean stdin)
Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.
-
setStdinOnce
public void setStdinOnce(java.lang.Boolean stdinOnce)
Whether the container runtime should close the stdin channel after it has been opened by a single attach. When stdin is true the stdin stream will remain open across multiple attach sessions. If stdinOnce is set to true, stdin is opened on container start, is empty until the first client attaches to stdin, and then remains open and accepts data until the client disconnects, at which time stdin is closed and remains closed until the container is restarted. If this flag is false, a container processes that reads from stdin will never receive an EOF. Default is false
-
setTargetContainerName
public void setTargetContainerName(java.lang.String targetContainerName)
If set, the name of the container from PodSpec that this ephemeral container targets. The ephemeral container will be run in the namespaces (IPC, PID, etc) of this container. If not set then the ephemeral container is run in whatever namespaces are shared for the pod. Note that the container runtime must support this feature.
-
setTerminationMessagePath
public void setTerminationMessagePath(java.lang.String terminationMessagePath)
Optional: Path at which the file to which the container's termination message will be written is mounted into the container's filesystem. Message written is intended to be brief final status, such as an assertion failure message. Will be truncated by the node if greater than 4096 bytes. The total message length across all containers will be limited to 12kb. Defaults to /dev/termination-log. Cannot be updated.
-
setTerminationMessagePolicy
public void setTerminationMessagePolicy(java.lang.String terminationMessagePolicy)
Indicate how the termination message should be populated. File will use the contents of terminationMessagePath to populate the container status message on both success and failure. FallbackToLogsOnError will use the last chunk of container log output if the termination message file is empty and the container exited with an error. The log output is limited to 2048 bytes or 80 lines, whichever is smaller. Defaults to File. Cannot be updated.
-
setTty
public void setTty(java.lang.Boolean tty)
Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.
-
setVolumeDevices
public void setVolumeDevices(java.util.List<VolumeDevice> volumeDevices)
volumeDevices is the list of block devices to be used by the container.
-
setVolumeMounts
public void setVolumeMounts(java.util.List<VolumeMount> volumeMounts)
Pod volumes to mount into the container's filesystem. Cannot be updated.
-
setWorkingDir
public void setWorkingDir(java.lang.String workingDir)
Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
canEqual
protected boolean canEqual(java.lang.Object other)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-