Skip to content

Commit ade0c40

Browse files
committed
add enabled flag to PublishedResources
On-behalf-of: @SAP christoph.mewes@sap.com
1 parent aad3540 commit ade0c40

File tree

6 files changed

+109
-0
lines changed

6 files changed

+109
-0
lines changed

deploy/crd/kcp.io/syncagent.kcp.io_publishedresources.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,10 @@ spec:
349349
type: object
350350
type: object
351351
related:
352+
description: |-
353+
Related configures additional resources that semantically belong to the synced
354+
resource, like a Secret containing generated credentials. Related objects are
355+
synced along the main resource.
352356
items:
353357
properties:
354358
group:
@@ -755,6 +759,22 @@ spec:
755759
- apiGroup
756760
- kind
757761
type: object
762+
synchronization:
763+
description: Synchronization allows to configure how the syncagent processes this resource.
764+
properties:
765+
enabled:
766+
description: |-
767+
Enabled can be used to toggle the synchronization as a whole. When set to
768+
false, the syncagent will only copy the CRD and include it in the APIExport,
769+
but not will attempt to synchronize objects of this resource from the kcp
770+
workspaces to the provider.
771+
Synchronization must be disabled for resources that are used as related
772+
resources for other PublishedResources. Otherwise the syncagent would
773+
potentially loop and never finish processing an object.
774+
type: boolean
775+
required:
776+
- enabled
777+
type: object
758778
required:
759779
- resource
760780
type: object

sdk/apis/syncagent/v1alpha1/published_resource.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,13 @@ type PublishedResourceSpec struct {
9696
// directions during the synchronization.
9797
Mutation *ResourceMutationSpec `json:"mutation,omitempty"`
9898

99+
// Related configures additional resources that semantically belong to the synced
100+
// resource, like a Secret containing generated credentials. Related objects are
101+
// synced along the main resource.
99102
Related []RelatedResourceSpec `json:"related,omitempty"`
103+
104+
// Synchronization allows to configure how the syncagent processes this resource.
105+
Synchronization *SynchronizationSpec `json:"synchronization,omitempty"`
100106
}
101107

102108
// ResourceNaming describes how the names for local objects should be formed.
@@ -388,6 +394,19 @@ type ResourceFilter struct {
388394
Resource *metav1.LabelSelector `json:"resource,omitempty"`
389395
}
390396

397+
// SynchronizationSpec allows to configure how the syncagent processes a
398+
// PublishedResource.
399+
type SynchronizationSpec struct {
400+
// Enabled can be used to toggle the synchronization as a whole. When set to
401+
// false, the syncagent will only copy the CRD and include it in the APIExport,
402+
// but not will attempt to synchronize objects of this resource from the kcp
403+
// workspaces to the provider.
404+
// Synchronization must be disabled for resources that are used as related
405+
// resources for other PublishedResources. Otherwise the syncagent would
406+
// potentially loop and never finish processing an object.
407+
Enabled bool `json:"enabled"`
408+
}
409+
391410
// PublishedResourceStatus stores status information about a published resource.
392411
type PublishedResourceStatus struct {
393412
ResourceSchemaName string `json:"resourceSchemaName,omitempty"`

sdk/apis/syncagent/v1alpha1/zz_generated.deepcopy.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/applyconfiguration/syncagent/v1alpha1/publishedresourcespec.go

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/applyconfiguration/syncagent/v1alpha1/synchronizationspec.go

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/applyconfiguration/utils.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)