Class PodScheduling

  • All Implemented Interfaces:
    software.amazon.jsii.JsiiSerializable
    Direct Known Subclasses:
    WorkloadScheduling

    @Generated(value="jsii-pacmak/1.72.0 (build 4b8828b)",
               date="2022-12-10T02:31:41.503Z")
    @Stability(Stable)
    public class PodScheduling
    extends software.amazon.jsii.JsiiObject
    Controls the pod scheduling strategy.
    • Constructor Detail

      • PodScheduling

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

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

        @Stability(Stable)
        public PodScheduling​(@NotNull
                             AbstractPod instance)
        Parameters:
        instance - This parameter is required.
    • Method Detail

      • assign

        @Stability(Stable)
        public void assign​(@NotNull
                           NamedNode node)
        Assign this pod a specific node by name.

        The scheduler ignores the Pod, and the kubelet on the named node tries to place the Pod on that node. Overrules any affinity rules of the pod.

        Some limitations of static assignment are:

        • If the named node does not exist, the Pod will not run, and in some cases may be automatically deleted.
        • If the named node does not have the resources to accommodate the Pod, the Pod will fail and its reason will indicate why, for example OutOfmemory or OutOfcpu.
        • Node names in cloud environments are not always predictable or stable.

        Will throw is the pod is already assigned to named node.

        Under the hood, this method utilizes the nodeName property.

        Parameters:
        node - This parameter is required.
      • attract

        @Stability(Stable)
        public void attract​(@NotNull
                            LabeledNode node)
        Attract this pod to a node matched by selectors. You can select a node by using `Node.labeled()`.

        Attracting to multiple nodes (i.e invoking this method multiple times) acts as an OR condition, meaning the pod will be assigned to either one of the nodes.

        Under the hood, this method utilizes the nodeAffinity property.

        Parameters:
        node - This parameter is required.
        See Also:
        https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity
      • colocate

        @Stability(Stable)
        public void colocate​(@NotNull
                             IPodSelector selector,
                             @Nullable
                             PodSchedulingColocateOptions options)
        Co-locate this pod with a scheduling selection.

        A selection can be one of:

        • An instance of a Pod.
        • An instance of a Workload (e.g Deployment, StatefulSet).
        • An un-managed pod that can be selected via Pods.select().

        Co-locating with multiple selections ((i.e invoking this method multiple times)) acts as an AND condition. meaning the pod will be assigned to a node that satisfies all selections (i.e runs at least one pod that satisifies each selection).

        Under the hood, this method utilizes the podAffinity property.

        Parameters:
        selector - This parameter is required.
        options -
        See Also:
        https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity
      • colocate

        @Stability(Stable)
        public void colocate​(@NotNull
                             IPodSelector selector)
        Co-locate this pod with a scheduling selection.

        A selection can be one of:

        • An instance of a Pod.
        • An instance of a Workload (e.g Deployment, StatefulSet).
        • An un-managed pod that can be selected via Pods.select().

        Co-locating with multiple selections ((i.e invoking this method multiple times)) acts as an AND condition. meaning the pod will be assigned to a node that satisfies all selections (i.e runs at least one pod that satisifies each selection).

        Under the hood, this method utilizes the podAffinity property.

        Parameters:
        selector - This parameter is required.
        See Also:
        https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity
      • separate

        @Stability(Stable)
        public void separate​(@NotNull
                             IPodSelector selector,
                             @Nullable
                             PodSchedulingSeparateOptions options)
        Seperate this pod from a scheduling selection.

        A selection can be one of:

        • An instance of a Pod.
        • An instance of a Workload (e.g Deployment, StatefulSet).
        • An un-managed pod that can be selected via Pods.select().

        Seperating from multiple selections acts as an AND condition. meaning the pod will not be assigned to a node that satisfies all selections (i.e runs at least one pod that satisifies each selection).

        Under the hood, this method utilizes the podAntiAffinity property.

        Parameters:
        selector - This parameter is required.
        options -
        See Also:
        https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity
      • separate

        @Stability(Stable)
        public void separate​(@NotNull
                             IPodSelector selector)
        Seperate this pod from a scheduling selection.

        A selection can be one of:

        • An instance of a Pod.
        • An instance of a Workload (e.g Deployment, StatefulSet).
        • An un-managed pod that can be selected via Pods.select().

        Seperating from multiple selections acts as an AND condition. meaning the pod will not be assigned to a node that satisfies all selections (i.e runs at least one pod that satisifies each selection).

        Under the hood, this method utilizes the podAntiAffinity property.

        Parameters:
        selector - This parameter is required.
        See Also:
        https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity
      • tolerate

        @Stability(Stable)
        public void tolerate​(@NotNull
                             TaintedNode node)
        Allow this pod to tolerate taints matching these tolerations.

        You can put multiple taints on the same node and multiple tolerations on the same pod. The way Kubernetes processes multiple taints and tolerations is like a filter: start with all of a node's taints, then ignore the ones for which the pod has a matching toleration; the remaining un-ignored taints have the indicated effects on the pod. In particular:

        • if there is at least one un-ignored taint with effect NoSchedule then Kubernetes will not schedule the pod onto that node
        • if there is no un-ignored taint with effect NoSchedule but there is at least one un-ignored taint with effect PreferNoSchedule then Kubernetes will try to not schedule the pod onto the node
        • if there is at least one un-ignored taint with effect NoExecute then the pod will be evicted from the node (if it is already running on the node), and will not be scheduled onto the node (if it is not yet running on the node).

        Under the hood, this method utilizes the tolerations property.

        Parameters:
        node - This parameter is required.
        See Also:
        https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/
      • getInstance

        @Stability(Stable)
        @NotNull
        protected AbstractPod getInstance()