Skip to content

Commit 78daf0d

Browse files
qiujian16claude
andauthored
fix: skip GC for ManifestWorks managed by ManifestWorkReplicaSet (#1299)
Skip garbage collection for ManifestWorks that have the ManifestWorkReplicaSet controller label, as these should be managed exclusively by the ManifestWorkReplicaSet controller. Changes: - Fix logic bug in controller to properly check for ReplicaSet label - Add unit tests for label-based GC skip behavior - Add integration test to verify GC skip for ReplicaSet-managed works 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Jian Qiu <jqiu@redhat.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent c4ced95 commit 78daf0d

File tree

65 files changed

+4588
-127
lines changed

Some content is hidden

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

65 files changed

+4588
-127
lines changed

deploy/cluster-manager/olm-catalog/latest/manifests/cluster-manager.clusterserviceversion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ metadata:
5959
categories: Integration & Delivery,OpenShift Optional
6060
certified: "false"
6161
containerImage: quay.io/open-cluster-management/registration-operator:latest
62-
createdAt: "2025-11-26T02:38:33Z"
62+
createdAt: "2025-12-15T05:30:24Z"
6363
description: Manages the installation and upgrade of the ClusterManager.
6464
operators.operatorframework.io/builder: operator-sdk-v1.32.0
6565
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3

deploy/klusterlet/olm-catalog/latest/manifests/klusterlet.clusterserviceversion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ metadata:
3131
categories: Integration & Delivery,OpenShift Optional
3232
certified: "false"
3333
containerImage: quay.io/open-cluster-management/registration-operator:latest
34-
createdAt: "2025-11-26T02:38:33Z"
34+
createdAt: "2025-12-15T05:30:24Z"
3535
description: Manages the installation and upgrade of the Klusterlet.
3636
operators.operatorframework.io/builder: operator-sdk-v1.32.0
3737
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ require (
4040
k8s.io/kubectl v0.34.3
4141
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
4242
open-cluster-management.io/addon-framework v1.1.1-0.20251126020917-1a0a9be61322
43-
open-cluster-management.io/api v1.1.1-0.20251124092621-2337d27c3b7f
44-
open-cluster-management.io/sdk-go v1.1.1-0.20251209031938-62521c9935ac
43+
open-cluster-management.io/api v1.1.1-0.20251215032811-ee922fbb996c
44+
open-cluster-management.io/sdk-go v1.1.1-0.20251215074442-72dfdeb13ed1
4545
sigs.k8s.io/about-api v0.0.0-20250131010323-518069c31c03
4646
sigs.k8s.io/cluster-inventory-api v0.0.0-20240730014211-ef0154379848
4747
sigs.k8s.io/controller-runtime v0.22.4

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -590,10 +590,10 @@ k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 h1:hwvWFiBzdWw1FhfY1FooPn3kzWuJ8
590590
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
591591
open-cluster-management.io/addon-framework v1.1.1-0.20251126020917-1a0a9be61322 h1:ibdBTpWmpQ37f1jZgR3fFIDK5uDTOJRvOkDKnRjLOpg=
592592
open-cluster-management.io/addon-framework v1.1.1-0.20251126020917-1a0a9be61322/go.mod h1:YqG/M9aLM/jhUXZDb2lEi2gGFU8NHAPTsQEFGk/tiS8=
593-
open-cluster-management.io/api v1.1.1-0.20251124092621-2337d27c3b7f h1:aOEXqgXvWSykMvzw9drHsLGUNP3xhsk1PcdRzfOVXoM=
594-
open-cluster-management.io/api v1.1.1-0.20251124092621-2337d27c3b7f/go.mod h1:Hk/3c114t6Ba5qhpqw+RoA93yEbE2CosG+JzzBZ6aCo=
595-
open-cluster-management.io/sdk-go v1.1.1-0.20251209031938-62521c9935ac h1:Wt7rzenZqrtyYI58+lpe9tmf9e5Ft8Wwd0MyDwuJ4ck=
596-
open-cluster-management.io/sdk-go v1.1.1-0.20251209031938-62521c9935ac/go.mod h1:0EZ9M7AtD0b+x9lUo5pYlyFF2aKOk1y88looeOVybwU=
593+
open-cluster-management.io/api v1.1.1-0.20251215032811-ee922fbb996c h1:LWZ+5dwVSNVM84eMBiQkygyYIlAudXSwQ6IM5LXr7QY=
594+
open-cluster-management.io/api v1.1.1-0.20251215032811-ee922fbb996c/go.mod h1:Hk/3c114t6Ba5qhpqw+RoA93yEbE2CosG+JzzBZ6aCo=
595+
open-cluster-management.io/sdk-go v1.1.1-0.20251215074442-72dfdeb13ed1 h1:if168++xGJnZywbqYRYDhWTz5kCp2HpBQ59KmRX9Ag4=
596+
open-cluster-management.io/sdk-go v1.1.1-0.20251215074442-72dfdeb13ed1/go.mod h1:Hp1DYO2ABl/jt35Aw2IoeuJuvvURWXj1z2Gc8fdIVTw=
597597
sigs.k8s.io/about-api v0.0.0-20250131010323-518069c31c03 h1:1ShFiMjGQOR/8jTBkmZrk1gORxnvMwm1nOy2/DbHg4U=
598598
sigs.k8s.io/about-api v0.0.0-20250131010323-518069c31c03/go.mod h1:F1pT4mK53U6F16/zuaPSYpBaR7x5Kjym6aKJJC0/DHU=
599599
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM=

manifests/cluster-manager/hub/crds/0000_00_addon.open-cluster-management.io_clustermanagementaddons.crd.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ spec:
376376
type: object
377377
supportedConfigs:
378378
description: |-
379+
Deprecated: Will be removed and replaced with DefaultConfigs in v1beta1.
379380
supportedConfigs is a list of configuration types supported by add-on.
380381
An empty list means the add-on does not require configurations.
381382
The default is an empty list
@@ -422,7 +423,7 @@ spec:
422423
add-on.
423424
properties:
424425
defaultconfigReferences:
425-
description: defaultconfigReferences is a list of current add-on default
426+
description: DefaultConfigReferences is a list of current add-on default
426427
configuration references.
427428
items:
428429
description: |-

manifests/cluster-manager/hub/crds/0000_00_work.open-cluster-management.io_manifestworkreplicasets.crd.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,12 +751,20 @@ spec:
751751
type: integer
752752
degraded:
753753
type: integer
754+
desiredTotal:
755+
description: DesiredTotal is the number of ManifestWorks
756+
that will be created by the ManifestWorkReplicaSet.
757+
type: integer
754758
progressing:
755759
type: integer
756760
total:
757761
description: Total number of ManifestWorks managed by the
758762
ManifestWorkReplicaSet
759763
type: integer
764+
updated:
765+
description: Updated is the number of clusters with updated
766+
revision applied.
767+
type: integer
760768
type: object
761769
type: object
762770
type: array
@@ -773,11 +781,19 @@ spec:
773781
type: integer
774782
degraded:
775783
type: integer
784+
desiredTotal:
785+
description: DesiredTotal is the number of ManifestWorks that
786+
will be created by the ManifestWorkReplicaSet.
787+
type: integer
776788
progressing:
777789
type: integer
778790
total:
779791
description: Total number of ManifestWorks managed by the ManifestWorkReplicaSet
780792
type: integer
793+
updated:
794+
description: Updated is the number of clusters with updated revision
795+
applied.
796+
type: integer
781797
type: object
782798
type: object
783799
type: object

manifests/cluster-manager/hub/crds/0000_01_addon.open-cluster-management.io_managedclusteraddons.crd.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,8 @@ spec:
243243
- name
244244
type: object
245245
lastObservedGeneration:
246-
description: |-
247-
Deprecated: Use LastAppliedConfig instead
248-
lastObservedGeneration is the observed generation of the add-on configuration.
246+
description: lastObservedGeneration is the observed generation
247+
of the add-on configuration.
249248
format: int64
250249
type: integer
251250
name:
@@ -302,14 +301,16 @@ spec:
302301
create a csr for the addon agent with the registrationConfig.
303302
properties:
304303
signerName:
305-
description: signerName is the name of signer that addon agent
306-
will use to create csr.
304+
description: |-
305+
Deprecated: Will be replaced with type: kubeClient and type: csr in v1beta1.
306+
signerName is the name of signer that addon agent will use to create csr.
307307
maxLength: 571
308308
minLength: 5
309309
pattern: ^([a-z0-9][a-z0-9-]*[a-z0-9]\.)+[a-z]+\/[a-z0-9-\.]+$
310310
type: string
311311
subject:
312312
description: |-
313+
Deprecated: Will be replaced with type: kubeClient and type: csr in v1beta1.
313314
subject is the user subject of the addon agent to be registered to the hub.
314315
If it is not set, the addon agent will have the default subject
315316
"subject": {

pkg/registration/register/grpc/spoke_driver.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"open-cluster-management.io/sdk-go/pkg/basecontroller/events"
2525
"open-cluster-management.io/sdk-go/pkg/basecontroller/factory"
2626
cloudeventsaddon "open-cluster-management.io/sdk-go/pkg/cloudevents/clients/addon"
27+
cloudeventsaddonv1alpha1 "open-cluster-management.io/sdk-go/pkg/cloudevents/clients/addon/v1alpha1"
2728
cloudeventscluster "open-cluster-management.io/sdk-go/pkg/cloudevents/clients/cluster"
2829
cloudeventscsr "open-cluster-management.io/sdk-go/pkg/cloudevents/clients/csr"
2930
cloudeventsevent "open-cluster-management.io/sdk-go/pkg/cloudevents/clients/event"
@@ -142,7 +143,7 @@ func (d *GRPCDriver) BuildClients(ctx context.Context, secretOption register.Sec
142143
ctx,
143144
cloudeventsoptions.NewGenericClientOptions(
144145
config,
145-
cloudeventsaddon.NewManagedClusterAddOnCodec(),
146+
cloudeventsaddonv1alpha1.NewManagedClusterAddOnCodec(),
146147
secretOption.ClusterName,
147148
).WithClusterName(secretOption.ClusterName).WithClientWatcherStore(addonWatchStore))
148149
if err != nil {

pkg/server/grpc/options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/spf13/pflag"
88
"google.golang.org/grpc"
99

10-
addonce "open-cluster-management.io/sdk-go/pkg/cloudevents/clients/addon"
10+
addonce "open-cluster-management.io/sdk-go/pkg/cloudevents/clients/addon/v1alpha1"
1111
clusterce "open-cluster-management.io/sdk-go/pkg/cloudevents/clients/cluster"
1212
csrce "open-cluster-management.io/sdk-go/pkg/cloudevents/clients/csr"
1313
eventce "open-cluster-management.io/sdk-go/pkg/cloudevents/clients/event"

pkg/server/services/addon/addon.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
addonclientset "open-cluster-management.io/api/client/addon/clientset/versioned"
1515
addoninformerv1alpha1 "open-cluster-management.io/api/client/addon/informers/externalversions/addon/v1alpha1"
1616
addonlisterv1alpha1 "open-cluster-management.io/api/client/addon/listers/addon/v1alpha1"
17-
addonce "open-cluster-management.io/sdk-go/pkg/cloudevents/clients/addon"
17+
addonce "open-cluster-management.io/sdk-go/pkg/cloudevents/clients/addon/v1alpha1"
1818
"open-cluster-management.io/sdk-go/pkg/cloudevents/generic/types"
1919
"open-cluster-management.io/sdk-go/pkg/cloudevents/server"
2020

0 commit comments

Comments
 (0)