Skip to content

Commit 4884bda

Browse files
authored
chore: backport changes from kubefleet 07/09/2025 (#1157)
2 parents 296dd06 + 3458653 commit 4884bda

File tree

56 files changed

+2000
-1022
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2000
-1022
lines changed

.github/.copilot/breadcrumbs/2025-06-24-0900-rollout-controller-binding-interface-refactor.md

Lines changed: 511 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/codespell.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Harden Runner
15-
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
15+
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
1616
with:
1717
egress-policy: audit
1818

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ e2e-tests-v1alpha1: create-kind-cluster run-e2e-v1alpha1
217217

218218
.PHONY: e2e-tests
219219
e2e-tests: setup-clusters
220-
cd ./test/e2e && ginkgo --label-filter="!custom" -v -p .
220+
cd ./test/e2e && ginkgo --timeout=70m --label-filter="!custom" -v -p .
221221

222222
e2e-tests-custom: setup-clusters
223223
cd ./test/e2e && ginkgo --label-filter="custom" -v -p .

apis/placement/v1beta1/binding_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import (
2020
"k8s.io/apimachinery/pkg/api/meta"
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
"sigs.k8s.io/controller-runtime/pkg/client"
23+
24+
"go.goms.io/fleet/apis"
2325
)
2426

2527
const (
@@ -52,7 +54,7 @@ type BindingStatusGetterSetter interface {
5254
// A BindingObj offers an abstract way to work with fleet binding objects.
5355
// +kubebuilder:object:generate=false
5456
type BindingObj interface {
55-
client.Object
57+
apis.ConditionedObj
5658
BindingSpecGetterSetter
5759
BindingStatusGetterSetter
5860
}

apis/placement/v1beta1/clusterresourceplacement_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import (
2222
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2323
"k8s.io/apimachinery/pkg/util/intstr"
2424
"sigs.k8s.io/controller-runtime/pkg/client"
25+
26+
"go.goms.io/fleet/apis"
2527
)
2628

2729
const (
@@ -58,7 +60,7 @@ type PlacementStatusGetterSetter interface {
5860
// PlacementObj offers the functionality to work with fleet placement object.
5961
// +kubebuilder:object:generate=false
6062
type PlacementObj interface {
61-
client.Object
63+
apis.ConditionedObj
6264
PlacementSpecGetterSetter
6365
PlacementStatusGetterSetter
6466
}

apis/placement/v1beta1/policysnapshot_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import (
2020
"k8s.io/apimachinery/pkg/api/meta"
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
"sigs.k8s.io/controller-runtime/pkg/client"
23+
24+
"go.goms.io/fleet/apis"
2325
)
2426

2527
const (
@@ -57,7 +59,7 @@ type PolicySnapshotStatusGetterSetter interface {
5759
// A PolicySnapshotObj offers an abstract way to work with a fleet policy snapshot object.
5860
// +kubebuilder:object:generate=false
5961
type PolicySnapshotObj interface {
60-
client.Object
62+
apis.ConditionedObj
6163
PolicySnapshotSpecGetterSetter
6264
PolicySnapshotStatusGetterSetter
6365
}

apis/placement/v1beta1/resourcesnapshot_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import (
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
"k8s.io/apimachinery/pkg/runtime"
2323
"sigs.k8s.io/controller-runtime/pkg/client"
24+
25+
"go.goms.io/fleet/apis"
2426
)
2527

2628
const (
@@ -74,7 +76,7 @@ type ResourceSnapshotStatusGetterSetter interface {
7476
// A ResourceSnapshotObj offers an abstract way to work with a resource snapshot object.
7577
// +kubebuilder:object:generate=false
7678
type ResourceSnapshotObj interface {
77-
client.Object
79+
apis.ConditionedObj
7880
ResourceSnapshotSpecGetterSetter
7981
ResourceSnapshotStatusGetterSetter
8082
}

pkg/controllers/clusterresourceplacement/controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func (r *Reconciler) handleUpdate(ctx context.Context, crp *fleetv1beta1.Cluster
185185
scheduleCondition := metav1.Condition{
186186
Status: metav1.ConditionFalse,
187187
Type: string(fleetv1beta1.ClusterResourcePlacementScheduledConditionType),
188-
Reason: InvalidResourceSelectorsReason,
188+
Reason: condition.InvalidResourceSelectorsReason,
189189
Message: fmt.Sprintf("The resource selectors are invalid: %v", err),
190190
ObservedGeneration: crp.Generation,
191191
}
@@ -1194,7 +1194,7 @@ func buildScheduledCondition(crp *fleetv1beta1.ClusterResourcePlacement, latestS
11941194
return metav1.Condition{
11951195
Status: metav1.ConditionUnknown,
11961196
Type: string(fleetv1beta1.ClusterResourcePlacementScheduledConditionType),
1197-
Reason: SchedulingUnknownReason,
1197+
Reason: condition.SchedulingUnknownReason,
11981198
Message: "Scheduling has not completed",
11991199
ObservedGeneration: crp.Generation,
12001200
}

pkg/controllers/clusterresourceplacement/controller_integration_test.go

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,9 @@ func checkClusterResourceSnapshot() *placementv1beta1.ClusterResourceSnapshot {
333333
}
334334

335335
func updateClusterSchedulingPolicySnapshotStatus(status metav1.ConditionStatus, clustersSelected bool) *placementv1beta1.ClusterSchedulingPolicySnapshot {
336-
reason := ResourceScheduleSucceededReason
336+
reason := condition.ResourceScheduleSucceededReason
337337
if status == metav1.ConditionFalse {
338-
reason = ResourceScheduleFailedReason
338+
reason = condition.ResourceScheduleFailedReason
339339
}
340340

341341
// Update scheduling condition
@@ -422,7 +422,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
422422
{
423423
Status: metav1.ConditionUnknown,
424424
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
425-
Reason: SchedulingUnknownReason,
425+
Reason: condition.SchedulingUnknownReason,
426426
},
427427
},
428428
},
@@ -461,7 +461,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
461461
{
462462
Status: metav1.ConditionTrue,
463463
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
464-
Reason: ResourceScheduleSucceededReason,
464+
Reason: condition.ResourceScheduleSucceededReason,
465465
},
466466
},
467467
},
@@ -479,7 +479,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
479479
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
480480
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
481481
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
482-
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
482+
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
483483
},
484484
Gauge: &prometheusclientmodel.Gauge{
485485
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
@@ -518,7 +518,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
518518
{
519519
Status: metav1.ConditionFalse,
520520
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
521-
Reason: ResourceScheduleFailedReason,
521+
Reason: condition.ResourceScheduleFailedReason,
522522
},
523523
},
524524
},
@@ -535,7 +535,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
535535
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
536536
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
537537
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
538-
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
538+
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
539539
},
540540
Gauge: &prometheusclientmodel.Gauge{
541541
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
@@ -547,7 +547,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
547547
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
548548
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
549549
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionFalse))},
550-
{Name: ptr.To("reason"), Value: ptr.To(ResourceScheduleFailedReason)},
550+
{Name: ptr.To("reason"), Value: ptr.To(condition.ResourceScheduleFailedReason)},
551551
},
552552
Gauge: &prometheusclientmodel.Gauge{
553553
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
@@ -577,7 +577,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
577577
{
578578
Status: metav1.ConditionTrue,
579579
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
580-
Reason: ResourceScheduleSucceededReason,
580+
Reason: condition.ResourceScheduleSucceededReason,
581581
},
582582
{
583583
Status: metav1.ConditionUnknown,
@@ -643,7 +643,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
643643
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
644644
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
645645
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
646-
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
646+
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
647647
},
648648
Gauge: &prometheusclientmodel.Gauge{
649649
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
@@ -672,7 +672,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
672672
{
673673
Status: metav1.ConditionTrue,
674674
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
675-
Reason: ResourceScheduleSucceededReason,
675+
Reason: condition.ResourceScheduleSucceededReason,
676676
},
677677
{
678678
Status: metav1.ConditionTrue,
@@ -787,7 +787,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
787787
{
788788
Status: metav1.ConditionTrue,
789789
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
790-
Reason: ResourceScheduleSucceededReason,
790+
Reason: condition.ResourceScheduleSucceededReason,
791791
},
792792
{
793793
Status: metav1.ConditionUnknown,
@@ -851,7 +851,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
851851
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
852852
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
853853
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
854-
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
854+
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
855855
},
856856
Gauge: &prometheusclientmodel.Gauge{
857857
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
@@ -880,7 +880,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
880880
{
881881
Status: metav1.ConditionTrue,
882882
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
883-
Reason: ResourceScheduleSucceededReason,
883+
Reason: condition.ResourceScheduleSucceededReason,
884884
},
885885
{
886886
Status: metav1.ConditionTrue,
@@ -993,7 +993,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
993993
{
994994
Status: metav1.ConditionUnknown,
995995
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
996-
Reason: SchedulingUnknownReason,
996+
Reason: condition.SchedulingUnknownReason,
997997
ObservedGeneration: 2,
998998
},
999999
{
@@ -1028,7 +1028,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
10281028
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
10291029
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
10301030
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
1031-
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
1031+
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
10321032
},
10331033
Gauge: &prometheusclientmodel.Gauge{
10341034
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
@@ -1047,7 +1047,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
10471047
{
10481048
Status: metav1.ConditionTrue,
10491049
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
1050-
Reason: ResourceScheduleSucceededReason,
1050+
Reason: condition.ResourceScheduleSucceededReason,
10511051
ObservedGeneration: 2,
10521052
},
10531053
{
@@ -1181,7 +1181,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
11811181
{
11821182
Status: metav1.ConditionTrue,
11831183
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
1184-
Reason: ResourceScheduleSucceededReason,
1184+
Reason: condition.ResourceScheduleSucceededReason,
11851185
},
11861186
{
11871187
Status: metav1.ConditionTrue,
@@ -1270,7 +1270,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
12701270
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
12711271
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
12721272
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
1273-
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
1273+
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
12741274
},
12751275
Gauge: &prometheusclientmodel.Gauge{
12761276
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
@@ -1439,7 +1439,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
14391439
{
14401440
Status: metav1.ConditionUnknown,
14411441
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
1442-
Reason: SchedulingUnknownReason,
1442+
Reason: condition.SchedulingUnknownReason,
14431443
},
14441444
},
14451445
},
@@ -1480,7 +1480,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
14801480
{
14811481
Status: metav1.ConditionTrue,
14821482
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
1483-
Reason: ResourceScheduleSucceededReason,
1483+
Reason: condition.ResourceScheduleSucceededReason,
14841484
},
14851485
{
14861486
Status: metav1.ConditionTrue,
@@ -1564,7 +1564,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
15641564
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
15651565
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
15661566
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
1567-
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
1567+
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
15681568
},
15691569
Gauge: &prometheusclientmodel.Gauge{
15701570
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
@@ -1663,7 +1663,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
16631663
{
16641664
Status: metav1.ConditionTrue,
16651665
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
1666-
Reason: ResourceScheduleSucceededReason,
1666+
Reason: condition.ResourceScheduleSucceededReason,
16671667
},
16681668
{
16691669
Status: metav1.ConditionTrue,
@@ -1747,7 +1747,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
17471747
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
17481748
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
17491749
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
1750-
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
1750+
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
17511751
},
17521752
Gauge: &prometheusclientmodel.Gauge{
17531753
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
@@ -1791,7 +1791,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
17911791
{
17921792
Status: metav1.ConditionTrue,
17931793
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
1794-
Reason: ResourceScheduleSucceededReason,
1794+
Reason: condition.ResourceScheduleSucceededReason,
17951795
},
17961796
{
17971797
Status: metav1.ConditionTrue,
@@ -1943,7 +1943,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
19431943
{
19441944
Status: metav1.ConditionFalse,
19451945
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
1946-
Reason: InvalidResourceSelectorsReason,
1946+
Reason: condition.InvalidResourceSelectorsReason,
19471947
},
19481948
},
19491949
},
@@ -1958,7 +1958,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
19581958
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
19591959
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
19601960
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionFalse))},
1961-
{Name: ptr.To("reason"), Value: ptr.To(InvalidResourceSelectorsReason)},
1961+
{Name: ptr.To("reason"), Value: ptr.To(condition.InvalidResourceSelectorsReason)},
19621962
},
19631963
Gauge: &prometheusclientmodel.Gauge{
19641964
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
@@ -2017,7 +2017,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
20172017
{
20182018
Status: metav1.ConditionUnknown,
20192019
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
2020-
Reason: SchedulingUnknownReason,
2020+
Reason: condition.SchedulingUnknownReason,
20212021
},
20222022
},
20232023
},
@@ -2040,7 +2040,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
20402040
{Name: ptr.To("generation"), Value: ptr.To(strconv.FormatInt(gotCRP.Generation, 10))},
20412041
{Name: ptr.To("conditionType"), Value: ptr.To(string(placementv1beta1.ClusterResourcePlacementScheduledConditionType))},
20422042
{Name: ptr.To("status"), Value: ptr.To(string(corev1.ConditionUnknown))},
2043-
{Name: ptr.To("reason"), Value: ptr.To(SchedulingUnknownReason)},
2043+
{Name: ptr.To("reason"), Value: ptr.To(condition.SchedulingUnknownReason)},
20442044
},
20452045
Gauge: &prometheusclientmodel.Gauge{
20462046
Value: ptr.To(float64(time.Now().UnixNano()) / 1e9),
@@ -2064,7 +2064,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() {
20642064
{
20652065
Status: metav1.ConditionTrue,
20662066
Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType),
2067-
Reason: ResourceScheduleSucceededReason,
2067+
Reason: condition.ResourceScheduleSucceededReason,
20682068
},
20692069
{
20702070
Status: metav1.ConditionUnknown,

0 commit comments

Comments
 (0)