Enum ContainerRestartPolicy

  • All Implemented Interfaces:
    Serializable, Comparable<ContainerRestartPolicy>

    @Generated(value="jsii-pacmak/1.102.0 (build e354887)",
               date="2024-08-03T12:13:25.506Z")
    @Stability(Stable)
    public enum ContainerRestartPolicy
    extends Enum<ContainerRestartPolicy>
    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.

    See Also:
    https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/
    • Enum Constant Detail

      • ALWAYS

        @Stability(Stable)
        public static final ContainerRestartPolicy ALWAYS
        If an init container is created with its restartPolicy set to Always, it will start and remain running during the entire life of the Pod.

        For regular containers, this is ignored by Kubernetes.

    • Method Detail

      • values

        public static ContainerRestartPolicy[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (ContainerRestartPolicy c : ContainerRestartPolicy.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ContainerRestartPolicy valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null