
org.cdk8s.plus31.PodScheduling Maven / Gradle / Ivy
package org.cdk8s.plus31;
/**
* Controls the pod scheduling strategy.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.104.0 (build e79254c)", date = "2024-10-12T12:14:17.431Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = org.cdk8s.plus31.$Module.class, fqn = "cdk8s-plus-31.PodScheduling")
public class PodScheduling extends software.amazon.jsii.JsiiObject {
protected PodScheduling(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected PodScheduling(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param instance This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public PodScheduling(final @org.jetbrains.annotations.NotNull org.cdk8s.plus31.AbstractPod instance) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(instance, "instance is required") });
}
/**
* 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.
*
* @param node This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public void assign(final @org.jetbrains.annotations.NotNull org.cdk8s.plus31.NamedNode node) {
software.amazon.jsii.Kernel.call(this, "assign", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(node, "node is required") });
}
/**
* 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.
*
* @see https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity
* @param node This parameter is required.
* @param options
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public void attract(final @org.jetbrains.annotations.NotNull org.cdk8s.plus31.LabeledNode node, final @org.jetbrains.annotations.Nullable org.cdk8s.plus31.PodSchedulingAttractOptions options) {
software.amazon.jsii.Kernel.call(this, "attract", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(node, "node is required"), options });
}
/**
* 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.
*
* @see https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity
* @param node This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public void attract(final @org.jetbrains.annotations.NotNull org.cdk8s.plus31.LabeledNode node) {
software.amazon.jsii.Kernel.call(this, "attract", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(node, "node is required") });
}
/**
* 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.
*
* @see https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity
* @param selector This parameter is required.
* @param options
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public void colocate(final @org.jetbrains.annotations.NotNull org.cdk8s.plus31.IPodSelector selector, final @org.jetbrains.annotations.Nullable org.cdk8s.plus31.PodSchedulingColocateOptions options) {
software.amazon.jsii.Kernel.call(this, "colocate", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(selector, "selector is required"), 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.
*
* @see https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity
* @param selector This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public void colocate(final @org.jetbrains.annotations.NotNull org.cdk8s.plus31.IPodSelector selector) {
software.amazon.jsii.Kernel.call(this, "colocate", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(selector, "selector is required") });
}
/**
* 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.
*
* @see https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity
* @param selector This parameter is required.
* @param options
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public void separate(final @org.jetbrains.annotations.NotNull org.cdk8s.plus31.IPodSelector selector, final @org.jetbrains.annotations.Nullable org.cdk8s.plus31.PodSchedulingSeparateOptions options) {
software.amazon.jsii.Kernel.call(this, "separate", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(selector, "selector is required"), 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.
*
* @see https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity
* @param selector This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public void separate(final @org.jetbrains.annotations.NotNull org.cdk8s.plus31.IPodSelector selector) {
software.amazon.jsii.Kernel.call(this, "separate", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(selector, "selector is required") });
}
/**
* 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.
*
* @see https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/
* @param node This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public void tolerate(final @org.jetbrains.annotations.NotNull org.cdk8s.plus31.TaintedNode node) {
software.amazon.jsii.Kernel.call(this, "tolerate", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(node, "node is required") });
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
protected @org.jetbrains.annotations.NotNull org.cdk8s.plus31.AbstractPod getInstance() {
return software.amazon.jsii.Kernel.get(this, "instance", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus31.AbstractPod.class));
}
}