Skip to content

Commit

Permalink
feat: support placement field in the override
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiying-lin committed Dec 12, 2024
1 parent 9a3cd78 commit 8d6bb98
Show file tree
Hide file tree
Showing 2 changed files with 404 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/utils/overrider/overrider.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ func FetchAllMatchingOverridesForResourceSnapshot(
filteredCRO := make([]*placementv1alpha1.ClusterResourceOverrideSnapshot, 0, len(croList.Items))
filteredRO := make([]*placementv1alpha1.ResourceOverrideSnapshot, 0, len(roList.Items))
for i := range croList.Items {
placementInOverride := croList.Items[i].Spec.OverrideSpec.Placement
if placementInOverride != nil && placementInOverride.Name != crp {
klog.V(2).InfoS("Skipping this override which was created for another placement", "clusterResourceOverride", klog.KObj(&croList.Items[i]), "placementInOverride", placementInOverride, "clusterResourcePlacement", crp)
continue
}

for _, selector := range croList.Items[i].Spec.OverrideSpec.ClusterResourceSelectors {
croKey := placementv1beta1.ResourceIdentifier{
Group: selector.Group,
Expand All @@ -118,6 +124,12 @@ func FetchAllMatchingOverridesForResourceSnapshot(
}
}
for i := range roList.Items {
placementInOverride := roList.Items[i].Spec.OverrideSpec.Placement
if placementInOverride != nil && placementInOverride.Name != crp {
klog.V(2).InfoS("Skipping this override which was created for another placement", "resourceOverride", klog.KObj(&roList.Items[i]), "placementInOverride", placementInOverride, "clusterResourcePlacement", crp)
continue
}

for _, selector := range roList.Items[i].Spec.OverrideSpec.ResourceSelectors {
roKey := placementv1beta1.ResourceIdentifier{
Group: selector.Group,
Expand Down
Loading

0 comments on commit 8d6bb98

Please sign in to comment.