Skip to content

Commit

Permalink
feat: support excluded sync resources
Browse files Browse the repository at this point in the history
Signed-off-by: KubeKyrie <shaolong.qin@daocloud.io>
  • Loading branch information
KubeKyrie committed Dec 29, 2023
1 parent b4117dd commit cdef1d8
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ spec:
syncResources:
items:
properties:
excludeResources:
items:
type: string
type: array
group:
type: string
resources:
Expand Down
4 changes: 4 additions & 0 deletions kustomize/crds/cluster.clusterpedia.io_pediaclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ spec:
syncResources:
items:
properties:
excludeResources:
items:
type: string
type: array
group:
type: string
resources:
Expand Down
14 changes: 14 additions & 0 deletions pkg/generated/openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/synchromanager/clustersynchro/resource_negotiator.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ func (negotiator *ResourceNegotiator) NegotiateSyncResources(syncResources []clu
var groupResourceStatus = NewGroupResourceStatus()
var storageResourceSyncConfigs = make(map[schema.GroupVersionResource]syncConfig)
for _, groupResources := range syncResources {
excludedResourcesSet := sets.New(groupResources.ExcludeResources...)
for _, resource := range groupResources.Resources {
if excludedResourcesSet.Has(resource) {
continue
}
syncGR := schema.GroupResource{Group: groupResources.Group, Resource: resource}

if clusterpediafeature.FeatureGate.Enabled(features.IgnoreSyncLease) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ type ClusterGroupResources struct {
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinItems=1
Resources []string `json:"resources"`

// +optional
ExcludeResources []string `json:"excludeResources"`
}

type ClusterStatus struct {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cdef1d8

Please sign in to comment.