Class Container.Builder
- java.lang.Object
-
- org.cdk8s.plus20.Container.Builder
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Container.Builderargs(List<String> args)Arguments to the entrypoint.Containerbuild()Container.Buildercommand(List<String> command)Entrypoint array.static Container.Buildercreate()Container.Builderenv(Map<String,? extends EnvValue> env)List of environment variables to set in the container.Container.Builderimage(String image)Docker image name.Container.BuilderimagePullPolicy(ImagePullPolicy imagePullPolicy)Image pull policy for this container.Container.Builderliveness(Probe liveness)Periodic probe of container liveness.Container.Buildername(String name)Name of the container specified as a DNS_LABEL.Container.Builderport(Number port)Number of port to expose on the pod's IP address.Container.Builderreadiness(Probe readiness)Determines when the container is ready to serve traffic.Container.Builderstartup(Probe startup)StartupProbe indicates that the Pod has successfully initialized.Container.BuildervolumeMounts(List<? extends VolumeMount> volumeMounts)Pod volumes to mount into the container's filesystem.Container.BuilderworkingDir(String workingDir)Container's working directory.
-
-
-
Method Detail
-
create
@Stability(Stable) public static Container.Builder create()
- Returns:
- a new instance of
Container.Builder.
-
image
@Stability(Stable) public Container.Builder image(String image)
Docker image name.- Parameters:
image- Docker image name. This parameter is required.- Returns:
this
-
args
@Stability(Stable) public Container.Builder args(List<String> args)
Arguments to the entrypoint. The docker image's CMD is used if `command` 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.
Default: []
- Parameters:
args- Arguments to the entrypoint. The docker image's CMD is used if `command` is not provided. This parameter is required.- Returns:
this
-
command
@Stability(Stable) public Container.Builder command(List<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
Default: - The docker image's ENTRYPOINT.
- Parameters:
command- Entrypoint array. This parameter is required.- Returns:
this
-
env
@Stability(Stable) public Container.Builder env(Map<String,? extends EnvValue> env)
List of environment variables to set in the container.Cannot be updated.
Default: - No environment variables.
- Parameters:
env- List of environment variables to set in the container. This parameter is required.- Returns:
this
-
imagePullPolicy
@Stability(Stable) public Container.Builder imagePullPolicy(ImagePullPolicy imagePullPolicy)
Image pull policy for this container.Default: ImagePullPolicy.ALWAYS
- Parameters:
imagePullPolicy- Image pull policy for this container. This parameter is required.- Returns:
this
-
liveness
@Stability(Stable) public Container.Builder liveness(Probe liveness)
Periodic probe of container liveness.Container will be restarted if the probe fails.
Default: - no liveness probe is defined
- Parameters:
liveness- Periodic probe of container liveness. This parameter is required.- Returns:
this
-
name
@Stability(Stable) public Container.Builder name(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.
Default: 'main'
- Parameters:
name- Name of the container specified as a DNS_LABEL. This parameter is required.- Returns:
this
-
port
@Stability(Stable) public Container.Builder port(Number port)
Number of port to expose on the pod's IP address.This must be a valid port number, 0 < x < 65536.
Default: - No port is exposed.
- Parameters:
port- Number of port to expose on the pod's IP address. This parameter is required.- Returns:
this
-
readiness
@Stability(Stable) public Container.Builder readiness(Probe readiness)
Determines when the container is ready to serve traffic.Default: - no readiness probe is defined
- Parameters:
readiness- Determines when the container is ready to serve traffic. This parameter is required.- Returns:
this
-
startup
@Stability(Stable) public Container.Builder startup(Probe startup)
StartupProbe indicates that the Pod has successfully initialized.If specified, no other probes are executed until this completes successfully
Default: - no startup probe is defined.
- Parameters:
startup- StartupProbe indicates that the Pod has successfully initialized. This parameter is required.- Returns:
this
-
volumeMounts
@Stability(Stable) public Container.Builder volumeMounts(List<? extends VolumeMount> volumeMounts)
Pod volumes to mount into the container's filesystem.Cannot be updated.
- Parameters:
volumeMounts- Pod volumes to mount into the container's filesystem. This parameter is required.- Returns:
this
-
workingDir
@Stability(Stable) public Container.Builder workingDir(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.
Default: - The container runtime's default.
- Parameters:
workingDir- Container's working directory. This parameter is required.- Returns:
this
-
-