Class Container.Builder

  • All Implemented Interfaces:
    software.amazon.jsii.Builder<Container>
    Enclosing class:
    Container

    @Stability(Stable)
    public static final class Container.Builder
    extends Object
    implements software.amazon.jsii.Builder<Container>
    A fluent builder for Container.
    • Method Detail

      • 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
        See Also:
        https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
      • 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
      • envFrom

        @Stability(Stable)
        public Container.Builder envFrom​(List<? extends EnvFrom> envFrom)
        List of sources to populate environment variables in the container.

        When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by the envVariables property with a duplicate key will take precedence.

        Default: - No sources.

        Parameters:
        envFrom - List of sources to populate environment variables in the container. This parameter is required.
        Returns:
        this
      • envVariables

        @Stability(Stable)
        public Container.Builder envVariables​(Map<String,​? extends EnvValue> envVariables)
        Environment variables to set in the container.

        Default: - No environment variables.

        Parameters:
        envVariables - 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
      • lifecycle

        @Stability(Stable)
        public Container.Builder lifecycle​(ContainerLifecycle lifecycle)
        Describes actions that the management system should take in response to container lifecycle events.

        Parameters:
        lifecycle - Describes actions that the management system should take in response to container lifecycle events. 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(Deprecated)
        @Deprecated
        public Container.Builder port​(Number port)
        Deprecated.
        - use `portNumber`.
        Parameters:
        port - This parameter is required.
        Returns:
        this
      • portNumber

        @Stability(Stable)
        public Container.Builder portNumber​(Number portNumber)
        Number of port to expose on the pod's IP address.

        This must be a valid port number, 0 < x < 65536.

        This is a convinience property if all you need a single TCP numbered port. In case more advanced configuartion is required, use the ports property.

        This port is added to the list of ports mentioned in the ports property.

        Default: - Only the ports mentiond in the `ports` property are exposed.

        Parameters:
        portNumber - Number of port to expose on the pod's IP address. This parameter is required.
        Returns:
        this
      • ports

        @Stability(Stable)
        public Container.Builder ports​(List<? extends ContainerPort> ports)
        List of ports to expose from this container.

        Default: - Only the port mentioned in the `portNumber` property is exposed.

        Parameters:
        ports - List of ports to expose from this container. 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
      • securityContext

        @Stability(Stable)
        public Container.Builder securityContext​(ContainerSecurityContextProps securityContext)
        SecurityContext defines the security options the container should be run with.

        If set, the fields override equivalent fields of the pod's security context.

        Default: ensureNonRoot: true privileged: false readOnlyRootFilesystem: true allowPrivilegeEscalation: false user: 25000 group: 26000

        Parameters:
        securityContext - SecurityContext defines the security options the container should be run with. This parameter is required.
        Returns:
        this
        See Also:
        https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
      • 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: - If a port is provided, then knocks on that port to determine when the container is ready for readiness and liveness probe checks. Otherwise, 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
      • build

        @Stability(Stable)
        public Container build()
        Specified by:
        build in interface software.amazon.jsii.Builder<Container>