@@ -269,6 +269,55 @@ type Affinity struct {
269269 // ClusterAffinity contains cluster affinity scheduling rules for the selected resources.
270270 // +kubebuilder:validation:Optional
271271 ClusterAffinity * ClusterAffinity `json:"clusterAffinity,omitempty"`
272+
273+ // PlacementAffinity contains placement affinity scheduling rules (e.g. co-locate this placement in the same cluster, region, etc. as some other placement(s)).
274+ // +kubebuilder:validation:Optional
275+ PlacementAffinity * PlacementAffinity `json:"placementAffinity,omitempty"`
276+ }
277+
278+ type PlacementAffinity struct {
279+ // If the affinity requirements specified by this field are not met at
280+ // scheduling time, the placement will not be scheduled onto the cluster.
281+ // If the affinity requirements specified by this field cease to be met
282+ // at some point during placement execution (e.g. due to a placement label update), the
283+ // system won't evict the placement from its cluster.
284+ // When there are multiple elements, the lists of clusters corresponding to each
285+ // placementAffinityTerm are intersected, i.e. all terms must be satisfied.
286+ // +kubebuilder:validation:Optional
287+ RequiredDuringSchedulingIgnoredDuringExecution []PlacementAffinityTerm `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty"`
288+ }
289+
290+ type PlacementAffinityTerm struct {
291+ // LabelSelector is a label query over all the joined placements.
292+ // If it's null, this term matches with no placements.
293+ LabelSelector * metav1.LabelSelector `json:"labelSelector,omitempty"`
294+ // namespaces specifies a static list of namespace names that the term applies to.
295+ // The term is applied to the union of the namespaces listed in this field
296+ // and the ones selected by namespaceSelector.
297+ // null or empty namespaces list and null namespaceSelector means "this placement's namespace".
298+ // The field is ignored when affinityScope is cluster.
299+ // +kubebuilder:validation:Optional
300+ Namespaces []string `json:"namespaces,omitempty"`
301+ // This placement should be co-located (affinity) with the placements matching the
302+ // labelSelector (in the specified namespaces), where co-located is defined as
303+ // running on a cluster whose value of the label with key topologyKey matches that
304+ // of any cluster on which any of the selected placements is running.
305+ // +kubebuilder:validation:Required
306+ TopologyKey string `json:"topologyKey"`
307+ // A label query over the set of namespaces that the term applies to.
308+ // The term is applied to the union of the namespaces selected by this field
309+ // and the ones listed in the namespaces field.
310+ // null selector and null or empty namespaces list means "this placement's namespace".
311+ // An empty selector ({}) matches all namespaces.
312+ // The field is ignored when affinityScope is cluster.
313+ // +kubebuilder:validation:Optional
314+ NamespaceSelector * metav1.LabelSelector `json:"namespaceSelector,omitempty"`
315+ // AffinityScope defines which resources the affinity rules apply to.
316+ // For example, when set to "Cluster", the affinity rules apply to the cluster scoped placements.
317+ // +kubebuilder:validation:Enum=Cluster;Namespaced
318+ // It defaults to the same scope of the current placement.
319+ // +kubebuilder:validation:Optional
320+ AffinityScope ResourceScope `json:"affinityScope,omitempty"`
272321}
273322
274323// ClusterAffinity contains cluster affinity scheduling rules for the selected resources.
0 commit comments