Skip to content

Commit

Permalink
Fixes (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelawyu authored Oct 10, 2023
1 parent 2fbf045 commit 569b43a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/controllers/clusterresourceplacement/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,9 @@ func (r *Reconciler) getOrCreateClusterSchedulingPolicySnapshot(ctx context.Cont
if crp.Spec.Policy != nil &&
crp.Spec.Policy.PlacementType == fleetv1beta1.PickNPlacementType &&
crp.Spec.Policy.NumberOfClusters != nil {
latestPolicySnapshot.Annotations = map[string]string{
fleetv1beta1.NumberOfClustersAnnotation: strconv.Itoa(int(*crp.Spec.Policy.NumberOfClusters)),
}
// Note that all policy snapshots should have the CRP generation annotation set already,
// so the Annotations field will not be nil.
latestPolicySnapshot.Annotations[fleetv1beta1.NumberOfClustersAnnotation] = strconv.Itoa(int(*crp.Spec.Policy.NumberOfClusters))
}

if err := r.Client.Create(ctx, latestPolicySnapshot); err != nil {
Expand Down
3 changes: 3 additions & 0 deletions pkg/controllers/clusterresourceplacement/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ func TestGetOrCreateClusterSchedulingPolicySnapshot(t *testing.T) {
},
},
Annotations: map[string]string{
fleetv1beta1.CRPGenerationAnnotation: strconv.Itoa(crpGeneration),
fleetv1beta1.NumberOfClustersAnnotation: strconv.Itoa(3),
},
},
Expand Down Expand Up @@ -400,6 +401,7 @@ func TestGetOrCreateClusterSchedulingPolicySnapshot(t *testing.T) {
},
},
Annotations: map[string]string{
fleetv1beta1.CRPGenerationAnnotation: strconv.Itoa(crpGeneration),
fleetv1beta1.NumberOfClustersAnnotation: strconv.Itoa(3),
},
},
Expand Down Expand Up @@ -459,6 +461,7 @@ func TestGetOrCreateClusterSchedulingPolicySnapshot(t *testing.T) {
},
},
Annotations: map[string]string{
fleetv1beta1.CRPGenerationAnnotation: strconv.Itoa(crpGeneration),
fleetv1beta1.NumberOfClustersAnnotation: strconv.Itoa(3),
},
},
Expand Down

0 comments on commit 569b43a

Please sign in to comment.