Class Container.Builder

  • Enclosing class:
    Container

    public static class Container.Builder
    extends java.lang.Object
    • Method Detail

      • args

        public Container.Builder args​(java.util.Collection<? extends java.lang.String> args)
      • addToCommand

        public Container.Builder addToCommand​(java.lang.String addToCommand)
      • command

        public Container.Builder command​(java.util.Collection<? extends java.lang.String> command)
      • 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.
      • 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.
      • 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.
      • 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.
      • 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.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object