Class Container.Builder
- java.lang.Object
-
- com.marcnuri.yakc.model.io.k8s.api.core.v1.Container.Builder
-
- Enclosing class:
- Container
public static class Container.Builder extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Container.Builder
addToArgs(java.lang.String addToArgs)
Container.Builder
addToCommand(java.lang.String addToCommand)
Container.Builder
addToEnv(EnvVar addToEnv)
Container.Builder
addToEnvFrom(EnvFromSource addToEnvFrom)
Container.Builder
addToPorts(ContainerPort addToPorts)
Container.Builder
addToResizePolicy(ContainerResizePolicy addToResizePolicy)
Container.Builder
addToVolumeDevices(VolumeDevice addToVolumeDevices)
Container.Builder
addToVolumeMounts(VolumeMount addToVolumeMounts)
Container.Builder
args(java.util.Collection<? extends java.lang.String> args)
Container
build()
Container.Builder
clearArgs()
Container.Builder
clearCommand()
Container.Builder
clearEnv()
Container.Builder
clearEnvFrom()
Container.Builder
clearPorts()
Container.Builder
clearResizePolicy()
Container.Builder
clearVolumeDevices()
Container.Builder
clearVolumeMounts()
Container.Builder
command(java.util.Collection<? extends java.lang.String> command)
Container.Builder
env(java.util.Collection<? extends EnvVar> env)
Container.Builder
envFrom(java.util.Collection<? extends EnvFromSource> envFrom)
Container.Builder
image(java.lang.String image)
Container image name.Container.Builder
imagePullPolicy(java.lang.String imagePullPolicy)
Image pull policy.Container.Builder
lifecycle(Lifecycle lifecycle)
Container.Builder
livenessProbe(Probe livenessProbe)
Container.Builder
name(@NonNull java.lang.String name)
Name of the container specified as a DNS_LABEL.Container.Builder
ports(java.util.Collection<? extends ContainerPort> ports)
Container.Builder
readinessProbe(Probe readinessProbe)
Container.Builder
resizePolicy(java.util.Collection<? extends ContainerResizePolicy> resizePolicy)
Container.Builder
resources(ResourceRequirements resources)
Container.Builder
restartPolicy(java.lang.String restartPolicy)
RestartPolicy defines the restart behavior of individual containers in a pod.Container.Builder
securityContext(SecurityContext securityContext)
Container.Builder
startupProbe(Probe startupProbe)
Container.Builder
stdin(java.lang.Boolean stdin)
Whether this container should allocate a buffer for stdin in the container runtime.Container.Builder
stdinOnce(java.lang.Boolean stdinOnce)
Whether the container runtime should close the stdin channel after it has been opened by a single attach.Container.Builder
terminationMessagePath(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.Container.Builder
terminationMessagePolicy(java.lang.String terminationMessagePolicy)
Indicate how the termination message should be populated.java.lang.String
toString()
Container.Builder
tty(java.lang.Boolean tty)
Whether this container should allocate a TTY for itself, also requires 'stdin' to be true.Container.Builder
volumeDevices(java.util.Collection<? extends VolumeDevice> volumeDevices)
Container.Builder
volumeMounts(java.util.Collection<? extends VolumeMount> volumeMounts)
Container.Builder
workingDir(java.lang.String workingDir)
Container's working directory.
-
-
-
Method Detail
-
addToArgs
public Container.Builder addToArgs(java.lang.String addToArgs)
-
args
public Container.Builder args(java.util.Collection<? extends java.lang.String> args)
-
clearArgs
public Container.Builder clearArgs()
-
addToCommand
public Container.Builder addToCommand(java.lang.String addToCommand)
-
command
public Container.Builder command(java.util.Collection<? extends java.lang.String> command)
-
clearCommand
public Container.Builder clearCommand()
-
addToEnv
public Container.Builder addToEnv(EnvVar addToEnv)
-
env
public Container.Builder env(java.util.Collection<? extends EnvVar> env)
-
clearEnv
public Container.Builder clearEnv()
-
addToEnvFrom
public Container.Builder addToEnvFrom(EnvFromSource addToEnvFrom)
-
envFrom
public Container.Builder envFrom(java.util.Collection<? extends EnvFromSource> envFrom)
-
clearEnvFrom
public Container.Builder clearEnvFrom()
-
image
public Container.Builder image(java.lang.String image)
Container image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.- Returns:
this
.
-
imagePullPolicy
public Container.Builder imagePullPolicy(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- Returns:
this
.
-
lifecycle
public Container.Builder lifecycle(Lifecycle lifecycle)
- Returns:
this
.
-
livenessProbe
public Container.Builder livenessProbe(Probe livenessProbe)
- Returns:
this
.
-
name
public Container.Builder name(@NonNull @NonNull java.lang.String name)
Name of the container specified as a DNS_LABEL. Each container in a pod must have a unique name (DNS_LABEL). Cannot be updated.- Returns:
this
.
-
addToPorts
public Container.Builder addToPorts(ContainerPort addToPorts)
-
ports
public Container.Builder ports(java.util.Collection<? extends ContainerPort> ports)
-
clearPorts
public Container.Builder clearPorts()
-
readinessProbe
public Container.Builder readinessProbe(Probe readinessProbe)
- Returns:
this
.
-
addToResizePolicy
public Container.Builder addToResizePolicy(ContainerResizePolicy addToResizePolicy)
-
resizePolicy
public Container.Builder resizePolicy(java.util.Collection<? extends ContainerResizePolicy> resizePolicy)
-
clearResizePolicy
public Container.Builder clearResizePolicy()
-
resources
public Container.Builder resources(ResourceRequirements resources)
- Returns:
this
.
-
restartPolicy
public Container.Builder restartPolicy(java.lang.String restartPolicy)
RestartPolicy defines the restart behavior of individual containers in a pod. This field may only be set for init containers, and the only allowed value is "Always". For non-init containers or when this field is not specified, the restart behavior is defined by the Pod's restart policy and the container type. Setting the RestartPolicy as "Always" for the init container will have the following effect: this init container will be continually restarted on exit until all regular containers have terminated. Once all regular containers have completed, all init containers with restartPolicy "Always" will be shut down. This lifecycle differs from normal init containers and is often referred to as a "sidecar" container. Although this init container still starts in the init container sequence, it does not wait for the container to complete before proceeding to the next init container. Instead, the next init container starts immediately after this init container is started, or after any startupProbe has successfully completed.- Returns:
this
.
-
securityContext
public Container.Builder securityContext(SecurityContext securityContext)
- Returns:
this
.
-
startupProbe
public Container.Builder startupProbe(Probe startupProbe)
- Returns:
this
.
-
stdin
public Container.Builder stdin(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.- Returns:
this
.
-
stdinOnce
public Container.Builder stdinOnce(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- Returns:
this
.
-
terminationMessagePath
public Container.Builder terminationMessagePath(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.- Returns:
this
.
-
terminationMessagePolicy
public Container.Builder terminationMessagePolicy(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.- Returns:
this
.
-
tty
public Container.Builder tty(java.lang.Boolean tty)
Whether this container should allocate a TTY for itself, also requires 'stdin' to be true. Default is false.- Returns:
this
.
-
addToVolumeDevices
public Container.Builder addToVolumeDevices(VolumeDevice addToVolumeDevices)
-
volumeDevices
public Container.Builder volumeDevices(java.util.Collection<? extends VolumeDevice> volumeDevices)
-
clearVolumeDevices
public Container.Builder clearVolumeDevices()
-
addToVolumeMounts
public Container.Builder addToVolumeMounts(VolumeMount addToVolumeMounts)
-
volumeMounts
public Container.Builder volumeMounts(java.util.Collection<? extends VolumeMount> volumeMounts)
-
clearVolumeMounts
public Container.Builder clearVolumeMounts()
-
workingDir
public Container.Builder workingDir(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.- Returns:
this
.
-
build
public Container build()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-