Skip to content
Docs Try Aspire

PodAffinityTermV1

Class sealed net10.0
📦 Aspire.Hosting.Kubernetes v13.1.2-preview.1.26125.13
Represents a term used to define pod affinity/anti-affinity requirements in Kubernetes. The PodAffinityTermV1 specifies conditions such as label selectors, namespace selectors, and topology keys that determine the placement of pods in relation to other pods in a cluster.
namespace Aspire.Hosting.Kubernetes.Resources;
public sealed class PodAffinityTermV1
{
// ...
}
View all constructors
LabelSelectorget; set
Gets or sets the label selector used to filter Kubernetes resources based on their labels. The label selector enables dynamic selection of a specific set of objects by matching labels or expressions that satisfy the requirements.
MatchLabelKeysget
List<string>
A list of label keys that should match for the associated Kubernetes resource. This property specifies a set of labels that must be present and match among a group of resources when certain constraints, such as affinity or anti-affinity rules, are applied.
MismatchLabelKeysget
List<string>
Represents a list of label keys that must NOT be matched by the target resources. This property is used as part of the label-based selection mechanism to exclude resources that have specific labels from being selected.
Namespacesget
List<string>
The Namespaces property represents a list of strings that define the specific namespaces within which the label selector or namespace selector should apply. This property is particularly useful when specifying criteria for selecting pods or other Kubernetes resources constrained to particular namespaces.
NamespaceSelectorget; set
Gets or sets the namespace selector used to identify namespaces to which the label selector applies. This property specifies a label-based filter that restricts the namespaces considered by the associated label selector.
TopologyKeyget; set
string
Specifies the key for the node's topology on which matching should occur. The value of this property is used to categorize nodes in a cluster based on specific characteristics, such as region or zone. This is commonly used in Kubernetes for pod affinity and anti-affinity rules to determine how pods are scheduled across nodes.
View all properties