Skip to content

Commit 243f387

Browse files
feat: Backport changes from KubeFleet (09/08/2025) (#1187)
2 parents 104eae9 + 3476b1b commit 243f387

Some content is hidden

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

53 files changed

+12562
-568
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ go build ./pkg/controllers/rollout/ ./pkg/utils/binding/ ./pkg/utils/controller/
328328
5. **Import Updates for Helper Function Usage**:
329329
```go
330330
// Added import for placement key type
331-
"github.com/kubefleet-dev/kubefleet/pkg/scheduler/queue"
331+
"go.goms.io/fleet/pkg/scheduler/queue"
332332
```
333333

334334
5. **Field Access Pattern Updates**:

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
if: needs.detect-noop.outputs.noop != 'true'
3636
steps:
3737
- name: Set up Go
38-
uses: actions/setup-go@v5
38+
uses: actions/setup-go@v6
3939
with:
4040
go-version: ${{ env.GO_VERSION }}
4141

@@ -65,7 +65,7 @@ jobs:
6565
if: needs.detect-noop.outputs.noop != 'true'
6666
steps:
6767
- name: Set up Go
68-
uses: actions/setup-go@v5
68+
uses: actions/setup-go@v6
6969
with:
7070
go-version: ${{ env.GO_VERSION }}
7171

@@ -120,7 +120,7 @@ jobs:
120120
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
121121
122122
- name: Set up Go
123-
uses: actions/setup-go@v5
123+
uses: actions/setup-go@v6
124124
with:
125125
go-version: ${{ env.GO_VERSION }}
126126

.github/workflows/code-lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
steps:
4040
- name: Setup Go
41-
uses: actions/setup-go@v5
41+
uses: actions/setup-go@v6
4242
with:
4343
go-version: ${{ env.GO_VERSION }}
4444

@@ -59,7 +59,7 @@ jobs:
5959

6060
steps:
6161
- name: Set up Go ${{ env.GO_VERSION }}
62-
uses: actions/setup-go@v5
62+
uses: actions/setup-go@v6
6363
with:
6464
go-version: ${{ env.GO_VERSION }}
6565

.github/workflows/trivy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
runs-on: ubuntu-latest #Latest tag points to the latest LTS release of Ubuntu per docker hub
4040
steps:
4141
- name: Set up Go ${{ env.GO_VERSION }}
42-
uses: actions/setup-go@v5
42+
uses: actions/setup-go@v6
4343
with:
4444
go-version: ${{ env.GO_VERSION }}
4545

.github/workflows/upgrade.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
if: needs.detect-noop.outputs.noop != 'true'
4040
steps:
4141
- name: Set up Go
42-
uses: actions/setup-go@v5
42+
uses: actions/setup-go@v6
4343
with:
4444
go-version: ${{ env.GO_VERSION }}
4545

@@ -122,7 +122,7 @@ jobs:
122122
if: needs.detect-noop.outputs.noop != 'true'
123123
steps:
124124
- name: Set up Go
125-
uses: actions/setup-go@v5
125+
uses: actions/setup-go@v6
126126
with:
127127
go-version: ${{ env.GO_VERSION }}
128128

@@ -205,7 +205,7 @@ jobs:
205205
if: needs.detect-noop.outputs.noop != 'true'
206206
steps:
207207
- name: Set up Go
208-
uses: actions/setup-go@v5
208+
uses: actions/setup-go@v6
209209
with:
210210
go-version: ${{ env.GO_VERSION }}
211211

apis/placement/v1beta1/commons.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ const (
5555
ResourceEnvelopeKind = "ResourceEnvelope"
5656
// ClusterResourceEnvelopeKind is the kind of the ClusterResourceEnvelope.
5757
ClusterResourceEnvelopeKind = "ClusterResourceEnvelope"
58+
// ClusterResourcePlacementStatusKind is the kind of the ClusterResourcePlacementStatus.
59+
ClusterResourcePlacementStatusKind = "ClusterResourcePlacementStatus"
5860
)
5961

6062
const (

cmd/hubagent/workload/setup.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import (
3838
"go.goms.io/fleet/pkg/controllers/bindingwatcher"
3939
"go.goms.io/fleet/pkg/controllers/clusterinventory/clusterprofile"
4040
"go.goms.io/fleet/pkg/controllers/clusterresourceplacementeviction"
41+
"go.goms.io/fleet/pkg/controllers/clusterresourceplacementstatuswatcher"
4142
"go.goms.io/fleet/pkg/controllers/memberclusterplacement"
4243
"go.goms.io/fleet/pkg/controllers/overrider"
4344
"go.goms.io/fleet/pkg/controllers/placement"
@@ -96,6 +97,7 @@ var (
9697
placementv1beta1.GroupVersion.WithKind(placementv1beta1.ClusterResourceOverrideSnapshotKind),
9798
placementv1beta1.GroupVersion.WithKind(placementv1beta1.ResourceOverrideKind),
9899
placementv1beta1.GroupVersion.WithKind(placementv1beta1.ResourceOverrideSnapshotKind),
100+
placementv1beta1.GroupVersion.WithKind(placementv1beta1.ClusterResourcePlacementStatusKind),
99101
}
100102

101103
// There's a prerequisite that v1Beta1RequiredGVKs must be installed too.
@@ -222,6 +224,15 @@ func SetupControllers(ctx context.Context, wg *sync.WaitGroup, mgr ctrl.Manager,
222224
return err
223225
}
224226

227+
klog.Info("Setting up clusterResourcePlacementStatus watcher")
228+
if err := (&clusterresourceplacementstatuswatcher.Reconciler{
229+
Client: mgr.GetClient(),
230+
PlacementController: clusterResourcePlacementControllerV1Beta1,
231+
}).SetupWithManager(mgr); err != nil {
232+
klog.ErrorS(err, "Unable to set up the clusterResourcePlacementStatus watcher")
233+
return err
234+
}
235+
225236
klog.Info("Setting up clusterSchedulingPolicySnapshot watcher")
226237
if err := (&schedulingpolicysnapshot.Reconciler{
227238
Client: mgr.GetClient(),

examples/test-crp9.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: placement.kubernetes-fleet.io/v1beta1
2+
kind: ClusterResourcePlacement
3+
metadata:
4+
name: crp-9
5+
spec:
6+
resourceSelectors:
7+
- group: ""
8+
kind: Namespace
9+
name: test-ns
10+
version: v1
11+
policy:
12+
placementType: PickAll
13+
strategy:
14+
type: RollingUpdate
15+
statusReportingScope: NamespaceAccessible

pkg/controllers/bindingwatcher/suite_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"flag"
2121
"path/filepath"
2222
"testing"
23+
"time"
2324

2425
. "github.com/onsi/ginkgo/v2"
2526
. "github.com/onsi/gomega"
@@ -122,6 +123,14 @@ var _ = BeforeSuite(func() {
122123
err = mgr.Start(ctx)
123124
Expect(err).Should(Succeed(), "failed to run manager")
124125
}()
126+
127+
// Note (chenyu1): for the binding watcher integration tests, must wait for the cache to sync
128+
// before moving onto the test stage, otherwise some Update events might not be caught properly.
129+
//
130+
// This is wrapped in an Eventually block as the manager might not have started yet.
131+
Eventually(func() bool {
132+
return mgr.GetCache().WaitForCacheSync(ctx)
133+
}, time.Second*10, time.Second*2).To(BeTrue(), "failed to wait for cache to sync")
125134
})
126135

127136
var _ = AfterSuite(func() {

pkg/controllers/bindingwatcher/watcher_integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const (
4040
testReason1 = "testReason1"
4141
testReason2 = "testReason2"
4242

43-
eventuallyTimeout = time.Second * 20
43+
eventuallyTimeout = time.Second * 10
4444
consistentlyDuration = time.Second * 10
4545
interval = time.Millisecond * 250
4646
)

0 commit comments

Comments
 (0)