Skip to content

Commit e9a8945

Browse files
committed
Added CachedResourceSchemaSource to CachedResource
The schema source for the wrapped resource is determined before the CachedResource object is marked as ready. The schema may be coming from a CRD, or an APIResourceSchema. In both cases it is cloned to CachedResource's cluster, and replicated to cache. This serves two purposes: * Schema is now disconnected from its original location, improving resiliance against provider unavailability. * Replication VW is greatly simplified, as it does schema lookup in a single step. On-behalf-of: @SAP [email protected] Signed-off-by: Robert Vasek <[email protected]>
1 parent c6b01a3 commit e9a8945

18 files changed

+2515
-15
lines changed

config/crds/cache.kcp.io_cachedresources.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,42 @@ spec:
216216
- cache
217217
- local
218218
type: object
219+
resourceSchemaSource:
220+
description: ResourceSchemaSource is a reference to the schema object
221+
of the cached resource.
222+
properties:
223+
apiResourceSchema:
224+
description: APIResourceSchema defines an APIResourceSchema as
225+
the source of the schema.
226+
properties:
227+
clusterName:
228+
description: ClusterName is the name of the cluster where
229+
the APIResourceSchema is defined.
230+
minLength: 1
231+
type: string
232+
name:
233+
description: Name is the APIResourceSchema name.
234+
minLength: 1
235+
type: string
236+
required:
237+
- clusterName
238+
- name
239+
type: object
240+
crd:
241+
description: CRD defines a CRD as the source of the schema.
242+
properties:
243+
name:
244+
description: Name is the CRD name.
245+
minLength: 1
246+
type: string
247+
resourceVersion:
248+
description: ResourceVersion is the resource version of the
249+
source CRD object.
250+
type: string
251+
required:
252+
- name
253+
type: object
254+
type: object
219255
type: object
220256
required:
221257
- spec

config/root-phase0/apiexport-cache.kcp.io.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ spec:
1212
crd: {}
1313
- group: cache.kcp.io
1414
name: cachedresources
15-
schema: v250523-2b8c1d3c5.cachedresources.cache.kcp.io
15+
schema: v250830-080348246.cachedresources.cache.kcp.io
1616
storage:
1717
crd: {}
1818
status: {}

config/root-phase0/apiresourceschema-cachedresources.cache.kcp.io.yaml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: apis.kcp.io/v1alpha1
22
kind: APIResourceSchema
33
metadata:
44
creationTimestamp: null
5-
name: v250523-2b8c1d3c5.cachedresources.cache.kcp.io
5+
name: v250830-080348246.cachedresources.cache.kcp.io
66
spec:
77
group: cache.kcp.io
88
names:
@@ -213,6 +213,42 @@ spec:
213213
- cache
214214
- local
215215
type: object
216+
resourceSchemaSource:
217+
description: ResourceSchemaSource is a reference to the schema object
218+
of the cached resource.
219+
properties:
220+
apiResourceSchema:
221+
description: APIResourceSchema defines an APIResourceSchema as the
222+
source of the schema.
223+
properties:
224+
clusterName:
225+
description: ClusterName is the name of the cluster where the
226+
APIResourceSchema is defined.
227+
minLength: 1
228+
type: string
229+
name:
230+
description: Name is the APIResourceSchema name.
231+
minLength: 1
232+
type: string
233+
required:
234+
- clusterName
235+
- name
236+
type: object
237+
crd:
238+
description: CRD defines a CRD as the source of the schema.
239+
properties:
240+
name:
241+
description: Name is the CRD name.
242+
minLength: 1
243+
type: string
244+
resourceVersion:
245+
description: ResourceVersion is the resource version of the
246+
source CRD object.
247+
type: string
248+
required:
249+
- name
250+
type: object
251+
type: object
216252
type: object
217253
required:
218254
- spec

pkg/openapi/zz_generated.openapi.go

Lines changed: 95 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)