-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathsyncagent.kcp.io_publishedresources.yaml
More file actions
857 lines (841 loc) · 46.9 KB
/
syncagent.kcp.io_publishedresources.yaml
File metadata and controls
857 lines (841 loc) · 46.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
# This file has been generated by hack/update-codegen-crds.sh, DO NOT EDIT.
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.18.0
name: publishedresources.syncagent.kcp.io
spec:
group: syncagent.kcp.io
names:
kind: PublishedResource
listKind: PublishedResourceList
plural: publishedresources
singular: publishedresource
scope: Cluster
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: |-
PublishedResource describes how an API type (usually defined by a CRD)
on the service cluster should be exposed in kcp workspaces. Besides
controlling how namespaced and cluster-wide resources should be mapped,
the GVK can also be transformed to provide a uniform, implementation-independent
access to the APIs inside kcp.
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: |-
PublishedResourceSpec describes the desired resource publication from a service
cluster to kcp.
properties:
enableWorkspacePaths:
description: |-
EnableWorkspacePaths toggles whether the Sync Agent will not just store the kcp
cluster name as a label on each locally synced object, but also the full workspace
path. This is optional because it requires additional requests to kcp and
should only be used if the workspace path is of interest on the
service cluster side.
type: boolean
filter:
description: |-
If specified, the filter will be applied to the resources in a workspace
and allow restricting which of them will be handled by the Sync Agent.
properties:
namespace:
description: When given, the namespace filter will be applied to a resource's namespace.
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements. The requirements are ANDed.
items:
description: |-
A label selector requirement is a selector that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that the selector applies to.
type: string
operator:
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: |-
values is an array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
description: |-
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is "key", the
operator is "In", and the values array contains only "value". The requirements are ANDed.
type: object
type: object
x-kubernetes-map-type: atomic
resource:
description: When given, the resource filter will be applied to a resource itself.
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements. The requirements are ANDed.
items:
description: |-
A label selector requirement is a selector that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that the selector applies to.
type: string
operator:
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: |-
values is an array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
description: |-
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is "key", the
operator is "In", and the values array contains only "value". The requirements are ANDed.
type: object
type: object
x-kubernetes-map-type: atomic
type: object
mutation:
description: |-
Mutation allows to configure "rewrite rules" to modify the objects in both
directions during the synchronization.
properties:
spec:
items:
properties:
cel:
properties:
expression:
type: string
path:
type: string
required:
- expression
- path
type: object
delete:
properties:
path:
type: string
required:
- path
type: object
regex:
properties:
path:
type: string
pattern:
description: |-
Pattern can be left empty to simply replace the entire value with the
replacement.
type: string
replacement:
type: string
required:
- path
type: object
template:
properties:
path:
type: string
template:
type: string
required:
- path
- template
type: object
type: object
type: array
status:
items:
properties:
cel:
properties:
expression:
type: string
path:
type: string
required:
- expression
- path
type: object
delete:
properties:
path:
type: string
required:
- path
type: object
regex:
properties:
path:
type: string
pattern:
description: |-
Pattern can be left empty to simply replace the entire value with the
replacement.
type: string
replacement:
type: string
required:
- path
type: object
template:
properties:
path:
type: string
template:
type: string
required:
- path
- template
type: object
type: object
type: array
type: object
naming:
description: |-
Naming can be used to control how the namespace and names for local objects
are formed. If not specified, the Sync Agent will use defensive defaults to
prevent naming collisions in the service cluster.
When configuring this, great care must be taken to not allow for naming
collisions to happen; keep in mind that the same name/namespace can exists in
many different kcp workspaces.
properties:
name:
description: |-
The name field allows to control the name the local objects created by the Sync Agent.
If left empty, the default value is:
"{{ .Object.metadata.namespace | sha3short }}-{{ .Object.metadata.name | sha3short }}"
This guarantees unique names as long as the cluster name is used for the local namespace
(the default unless configured otherwise).
This value is a Go template, see the documentation for the available variables and functions.
Alternatively (but deprecated), this value can be a simple string using one of the following
placeholders:
- $remoteClusterName -- the kcp workspace's cluster name (e.g. "1084s8ceexsehjm2")
- $remoteNamespace -- the original namespace used by the consumer inside the kcp
workspace (if targetNamespace is left empty, it's equivalent
to setting "$remote_ns")
- $remoteNamespaceHash -- first 20 hex characters of the SHA-1 hash of $remoteNamespace
- $remoteName -- the original name of the object inside the kcp workspace
(rarely used to construct local namespace names)
- $remoteNameHash -- first 20 hex characters of the SHA-1 hash of $remoteName
Authors are advised to use Go templates instead, as the custom variable syntax is deprecated
and will be removed from a future release of the Sync Agent.
type: string
namespace:
description: |-
For namespaced resources, the this field allows to control where the local objects will
be created. If left empty, "{{ .ClusterName }}" is assumed.
This value is a Go template, see the documentation for the available variables and functions.
Alternatively (but deprecated), this value can be a simple string using one of the following
placeholders:
- $remoteClusterName -- the kcp workspace's cluster name (e.g. "1084s8ceexsehjm2")
- $remoteNamespace -- the original namespace used by the consumer inside the kcp
workspace (if targetNamespace is left empty, it's equivalent
to setting "$remote_ns")
- $remoteNamespaceHash -- first 20 hex characters of the SHA-1 hash of $remoteNamespace
- $remoteName -- the original name of the object inside the kcp workspace
(rarely used to construct local namespace names)
- $remoteNameHash -- first 20 hex characters of the SHA-1 hash of $remoteName
Authors are advised to use Go templates instead, as the custom variable syntax is deprecated
and will be removed from a future release of the Sync Agent.
type: string
type: object
projection:
description: |-
Projection is used to change the GVK of a published resource within kcp.
This can be used to hide implementation details and provide a customized API
experience to the user.
All fields in the projection are optional. If a field is set, it will overwrite
that field in the GVK. The namespaced field can be set to turn a cluster-wide
resource namespaced or vice-versa.
properties:
categories:
description: |-
Categories can be used to overwrite the original categories a resource was in. Set
this to an empty list to remove all categories.
items:
type: string
type: array
group:
description: The API group, for example "myservice.example.com". Leave empty to not modify the API group.
type: string
kind:
description: |-
The resource Kind, for example "Database". Setting this field will also overwrite
the singular name by lowercasing the resource kind. In addition, if this is set,
the plural name will also be updated by taking the lowercased kind name and appending
an "s". If this would yield an undesirable name, use the plural field to explicitly
give the plural name.
type: string
plural:
description: |-
When overwriting the Kind, it can be necessary to also override the plural name in
case of more complex pluralization rules.
type: string
scope:
description: Whether or not the resource is namespaced.
enum:
- Cluster
- Namespaced
type: string
shortNames:
description: |-
ShortNames can be used to overwrite the original short names for a resource, usually
when the Kind is remapped, new short names are also in order. Set this to an empty
list to remove all short names.
items:
type: string
type: array
version:
description: |-
The API version, for example "v1beta1". Leave empty to not modify the version.
This field must not be set when multiple versions have been selected.
Deprecated: Use .versions instead.
type: string
versions:
additionalProperties:
type: string
description: |-
Versions allows to map API versions onto new values in kcp. Leave empty to not modify the
versions.
type: object
type: object
related:
description: |-
Related configures additional resources that semantically belong to the synced
resource, like a Secret containing generated credentials. Related objects are
synced along the main resource.
items:
description: |-
RelatedResourceSpec describes a single related resource, which might point to
any number of actual Kubernetes objects.
(in the following rule, group is optional becaue core/v1 is represented by group="")
group is included here because when an identityHash is used, core/v1 cannot possible be targetted
properties:
group:
description: |-
Group is the API group of the related resource. This should be left blank for resources
in the core API group.
type: string
identifier:
description: |-
Identifier is a unique name for this related resource. The name must be unique within one
PublishedResource and is the key by which consumers (end users) can identify and consume the
related resource. Common names are "connection-details" or "credentials".
The identifier must be an alphanumeric string.
type: string
identityHash:
description: |-
IdentityHash is the identity hash of a kcp APIExport, in case the given Kind is
provided by an APIExport and not Kube-native.
type: string
kind:
description: |-
Kind is the object kind of the related resource (for example "Secret").
Deprecated: Use "Resource" instead. This field is limited to "ConfigMap" and "Secret" and will
be removed in the future. Kind and Resource cannot be specified at the same time.
enum:
- ConfigMap
- Secret
type: string
mutation:
description: |-
Mutation configures optional transformation rules for the related resource.
Status mutations are only performed when the related resource originates in kcp.
properties:
spec:
items:
properties:
cel:
properties:
expression:
type: string
path:
type: string
required:
- expression
- path
type: object
delete:
properties:
path:
type: string
required:
- path
type: object
regex:
properties:
path:
type: string
pattern:
description: |-
Pattern can be left empty to simply replace the entire value with the
replacement.
type: string
replacement:
type: string
required:
- path
type: object
template:
properties:
path:
type: string
template:
type: string
required:
- path
- template
type: object
type: object
type: array
status:
items:
properties:
cel:
properties:
expression:
type: string
path:
type: string
required:
- expression
- path
type: object
delete:
properties:
path:
type: string
required:
- path
type: object
regex:
properties:
path:
type: string
pattern:
description: |-
Pattern can be left empty to simply replace the entire value with the
replacement.
type: string
replacement:
type: string
required:
- path
type: object
template:
properties:
path:
type: string
template:
type: string
required:
- path
- template
type: object
type: object
type: array
type: object
object:
description: |-
Object describes how the related resource can be found on the origin side
and where it is to supposed to be created on the destination side.
properties:
namespace:
description: |-
Namespace configures in what namespace the related object resides in. If
not specified, the same namespace as the main object is assumed. If the
main object is cluster-scoped, this field is required and an error will be
raised during syncing if the field is not specified.
properties:
reference:
description: |-
Reference points to a field inside the main object. This reference is
evaluated on both source and destination sides to find the related object.
properties:
path:
description: |-
Path is a simplified JSONPath expression like "metadata.name". A reference
must always select at least _something_ in the object, even if the value
is discarded by the regular expression.
type: string
regex:
description: |-
Regex is a Go regular expression that is optionally applied to the selected
value from the path.
properties:
pattern:
description: |-
Pattern can be left empty to simply replace the entire value with the
replacement.
type: string
replacement:
description: |-
Replacement is the string that the matched pattern is replaced with. It
can contain references to groups in the pattern by using \N.
type: string
type: object
required:
- path
type: object
selector:
description: |-
Selector is a label selector that is useful if no reference is in the
main resource (i.e. if the related object links back to its parent, instead
of the parent pointing to the related object).
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements. The requirements are ANDed.
items:
description: |-
A label selector requirement is a selector that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that the selector applies to.
type: string
operator:
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: |-
values is an array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
description: |-
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is "key", the
operator is "In", and the values array contains only "value". The requirements are ANDed.
type: object
rewrite:
properties:
regex:
description: |-
Regex is a Go regular expression that is optionally applied to the selected
value from the path.
properties:
pattern:
description: |-
Pattern can be left empty to simply replace the entire value with the
replacement.
type: string
replacement:
description: |-
Replacement is the string that the matched pattern is replaced with. It
can contain references to groups in the pattern by using \N.
type: string
type: object
template:
description: |-
TemplateExpression is a Go templated string that can make use of variables to
construct the resulting string.
properties:
template:
type: string
type: object
type: object
required:
- rewrite
type: object
x-kubernetes-map-type: atomic
template:
description: |-
Template is a Go templated string that can make use of variables to
construct the resulting string.
properties:
template:
type: string
type: object
type: object
reference:
description: |-
Reference points to a field inside the main object. This reference is
evaluated on both source and destination sides to find the related object.
properties:
path:
description: |-
Path is a simplified JSONPath expression like "metadata.name". A reference
must always select at least _something_ in the object, even if the value
is discarded by the regular expression.
type: string
regex:
description: |-
Regex is a Go regular expression that is optionally applied to the selected
value from the path.
properties:
pattern:
description: |-
Pattern can be left empty to simply replace the entire value with the
replacement.
type: string
replacement:
description: |-
Replacement is the string that the matched pattern is replaced with. It
can contain references to groups in the pattern by using \N.
type: string
type: object
required:
- path
type: object
selector:
description: |-
Selector is a label selector that is useful if no reference is in the
main resource (i.e. if the related object links back to its parent, instead
of the parent pointing to the related object).
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements. The requirements are ANDed.
items:
description: |-
A label selector requirement is a selector that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that the selector applies to.
type: string
operator:
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: |-
values is an array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
description: |-
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is "key", the
operator is "In", and the values array contains only "value". The requirements are ANDed.
type: object
rewrite:
properties:
regex:
description: |-
Regex is a Go regular expression that is optionally applied to the selected
value from the path.
properties:
pattern:
description: |-
Pattern can be left empty to simply replace the entire value with the
replacement.
type: string
replacement:
description: |-
Replacement is the string that the matched pattern is replaced with. It
can contain references to groups in the pattern by using \N.
type: string
type: object
template:
description: |-
TemplateExpression is a Go templated string that can make use of variables to
construct the resulting string.
properties:
template:
type: string
type: object
type: object
required:
- rewrite
type: object
x-kubernetes-map-type: atomic
template:
description: |-
Template is a Go templated string that can make use of variables to
construct the resulting string.
properties:
template:
type: string
type: object
type: object
origin:
enum:
- service
- kcp
type: string
projection:
description: |-
Projection is used to change the GVK of a related resource on the opposite side of
its origin.
All fields in the projection are optional. If a field is set, it will overwrite
that field in the GVK.
properties:
group:
description: The API group, for example "myservice.example.com". Leave empty to not modify the API group.
type: string
resource:
description: The resource name, for example "databases". Leave empty to not modify the resource.
type: string
version:
description: The API version, for example "v1beta1". Leave empty to not modify the version.
type: string
type: object
resource:
description: Resource is the name of the related resource (for example "secrets").
type: string
version:
description: |-
Version is the API version of the related resource. This can be left blank to automatically
use the preferred version.
type: string
required:
- identifier
- object
- origin
type: object
x-kubernetes-validations:
- message: must specify either kind (deprecated) or group, version, resource
rule: has(self.kind) != (has(self.version) || has(self.resource))
- message: resource and version must be configured together or not at all
rule: has(self.resource) == has(self.version)
- message: configuring a group also requires a version and resource
rule: '!has(self.group) || (has(self.resource) && has(self.version))'
- message: identity hashes can only be used with GVRs
rule: '!has(self.identityHash) || (has(self.group) && has(self.version) && has(self.resource))'
type: array
resource:
description: |-
Describes the "source" Resource that exists on this, the service cluster,
that should be exposed in kcp workspaces. All fields have to be specified.
properties:
apiGroup:
description: The API group of a resource, for example "storage.initroid.com".
type: string
kind:
description: The resource Kind, for example "Database".
type: string
version:
description: |-
The API version, for example "v1beta1". Setting this field will only publish
the given version, otherwise all versions for the group/kind will be
published.
Deprecated: Use .versions instead.
type: string
versions:
description: |-
Versions allows to select a subset of versions to publish. Leave empty
to publish all available versions.
items:
type: string
type: array
required:
- apiGroup
- kind
type: object
synchronization:
description: Synchronization allows to configure how the syncagent processes this resource.
properties:
enabled:
description: |-
Enabled can be used to toggle the synchronization as a whole. When set to
false, the syncagent will only copy the CRD and include it in the APIExport,
but not will attempt to synchronize objects of this resource from the kcp
workspaces to the provider.
Synchronization must be disabled for resources that are used as related
resources for other PublishedResources. Otherwise the syncagent would
potentially loop and never finish processing an object.
type: boolean
required:
- enabled
type: object
required:
- resource
type: object
status:
description: Status contains reconciliation information for the published resource.
properties:
resourceSchemaName:
type: string
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}