Class DaemonSet

  • All Implemented Interfaces:
    IPodSpec, IPodTemplate, IResource, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

    @Generated(value="jsii-pacmak/1.57.0 (build f614666)",
               date="2022-04-26T09:02:10.451Z")
    @Stability(Stable)
    public class DaemonSet
    extends Resource
    implements IPodTemplate
    A DaemonSet ensures that all (or some) Nodes run a copy of a Pod.

    As nodes are added to the cluster, Pods are added to them. As nodes are removed from the cluster, those Pods are garbage collected. Deleting a DaemonSet will clean up the Pods it created.

    Some typical uses of a DaemonSet are:

    • running a cluster storage daemon on every node
    • running a logs collection daemon on every node
    • running a node monitoring daemon on every node

    In a simple case, one DaemonSet, covering all nodes, would be used for each type of daemon. A more complex setup might use multiple DaemonSets for a single type of daemon, but with different flags and/or different memory and cpu requests for different hardware types.

    • Constructor Detail

      • DaemonSet

        protected DaemonSet​(software.amazon.jsii.JsiiObjectRef objRef)
      • DaemonSet

        protected DaemonSet​(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
      • DaemonSet

        @Stability(Stable)
        public DaemonSet​(@NotNull
                         software.constructs.Construct scope,
                         @NotNull
                         String id,
                         @Nullable
                         DaemonSetProps props)
        Parameters:
        scope - This parameter is required.
        id - This parameter is required.
        props -
      • DaemonSet

        @Stability(Stable)
        public DaemonSet​(@NotNull
                         software.constructs.Construct scope,
                         @NotNull
                         String id)
        Parameters:
        scope - This parameter is required.
        id - This parameter is required.
    • Method Detail

      • addContainer

        @Stability(Stable)
        @NotNull
        public Container addContainer​(@NotNull
                                      ContainerProps cont)
        Add a container to the pod.

        Specified by:
        addContainer in interface IPodSpec
        Parameters:
        cont - This parameter is required.
      • addHostAlias

        @Stability(Stable)
        public void addHostAlias​(@NotNull
                                 HostAlias hostAlias)
        Parameters:
        hostAlias - This parameter is required.
      • addInitContainer

        @Stability(Stable)
        @NotNull
        public Container addInitContainer​(@NotNull
                                          ContainerProps cont)
        Add an init container to the pod.

        Specified by:
        addInitContainer in interface IPodSpec
        Parameters:
        cont - This parameter is required.
      • addVolume

        @Stability(Stable)
        public void addVolume​(@NotNull
                              Volume vol)
        Add a volume to the pod.

        Specified by:
        addVolume in interface IPodSpec
        Parameters:
        vol - This parameter is required.
      • selectByLabel

        @Stability(Stable)
        public void selectByLabel​(@NotNull
                                  String key,
                                  @NotNull
                                  String value)
        Configure a label selector to this daemon set.

        Parameters:
        key - This parameter is required.
        value - This parameter is required.
      • getApiObject

        @Stability(Stable)
        @NotNull
        protected org.cdk8s.ApiObject getApiObject()
        The underlying cdk8s API object.

        Specified by:
        getApiObject in class Resource
        See Also:
        base.Resource.apiObject
      • getContainers

        @Stability(Stable)
        @NotNull
        public List<Container> getContainers()
        The containers belonging to the pod.

        Use addContainer to add containers.

        Specified by:
        getContainers in interface IPodSpec
      • getDns

        @Stability(Stable)
        @NotNull
        public PodDns getDns()
        The pod's DNS settings.
        Specified by:
        getDns in interface IPodSpec
      • getHostAliases

        @Stability(Stable)
        @NotNull
        public List<HostAlias> getHostAliases()
        An optional list of hosts and IPs that will be injected into the pod's hosts file if specified.

        This is only valid for non-hostNetwork pods.

        Specified by:
        getHostAliases in interface IPodSpec
      • getInitContainers

        @Stability(Stable)
        @NotNull
        public List<Container> getInitContainers()
        The init containers belonging to the pod.

        Use addInitContainer to add init containers.

        Specified by:
        getInitContainers in interface IPodSpec
      • getLabelSelector

        @Stability(Stable)
        @NotNull
        public Map<String,​String> getLabelSelector()
        The labels this daemon set will match against in order to select pods.

        Returns a a copy. Use selectByLabel() to add labels.

      • getMinReadySeconds

        @Stability(Stable)
        @NotNull
        public Number getMinReadySeconds()
      • getPodMetadata

        @Stability(Stable)
        @NotNull
        public org.cdk8s.ApiObjectMetadataDefinition getPodMetadata()
        Provides read/write access to the underlying pod metadata of the resource.
        Specified by:
        getPodMetadata in interface IPodTemplate
      • getVolumes

        @Stability(Stable)
        @NotNull
        public List<Volume> getVolumes()
        The volumes associated with this pod.

        Use addVolume to add volumes.

        Specified by:
        getVolumes in interface IPodSpec
      • getRestartPolicy

        @Stability(Stable)
        @Nullable
        public RestartPolicy getRestartPolicy()
        Restart policy for all containers within the pod.
        Specified by:
        getRestartPolicy in interface IPodSpec