Skip to content

Commit 2b0f7bb

Browse files
committed
/docs: rename CachedResource to ClusterCachedResource
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
1 parent d3f8e36 commit 2b0f7bb

4 files changed

Lines changed: 48 additions & 48 deletions

File tree

docs/content/concepts/apis/cached-resources.md

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# CachedResource API
1+
# ClusterCachedResource API
22

33
!!! warning
44
As of 0.29, this feature is of alpha-version quality. To use it, enable the `CachedAPIs` feature gate.
55

6-
A CachedResource object triggers replication of a user-defined resource from its workspace into kcp's [cache server](../sharding/cache-server.md), extending its [built-in resource set](../sharding/cache-server.md#built-in-resources) with custom types. This makes those resources available across shards, enabling implementors to build globally-aware kcp-native components. API providers can additionally expose replicated resources as read-only to consumer workspaces — see [Exporting CachedResources](#exporting-cachedresources).
6+
A ClusterCachedResource object triggers replication of a user-defined resource from its workspace into kcp's [cache server](../sharding/cache-server.md), extending its [built-in resource set](../sharding/cache-server.md#built-in-resources) with custom types. This makes those resources available across shards, enabling implementors to build globally-aware kcp-native components. API providers can additionally expose replicated resources as read-only to consumer workspaces — see [Exporting ClusterCachedResources](#exporting-clustercachedresources).
77

88
## Resource replication
99

1010
```yaml
1111
apiVersion: cache.kcp.io/v1alpha1
12-
kind: CachedResource
12+
kind: ClusterCachedResource
1313
metadata:
1414
name: cpuflavors-v1
1515
spec:
@@ -20,16 +20,16 @@ spec:
2020
2121
The snippet above shows an example where all `cpuflavors.v1.cloud.example.com` objects in the workspace are replicated to the cache. There are some constraints on what resources may be replicated:
2222

23-
- There may be only one CachedResource for a particular group-version-resource triplet in the workspace.
23+
- There may be only one ClusterCachedResource for a particular group-version-resource triplet in the workspace.
2424
- The resource must be cluster scoped.
2525
- The resource must not be a [built-in API](./built-in.md) or kcp system API belonging to `apis.kcp.io` group.
2626
- The resource may be originating from a CRD or an APIBinding.
2727

28-
Once created, resource replication progress may be checked in CachedResource's status:
28+
Once created, resource replication progress may be checked in ClusterCachedResource's status:
2929

3030
```yaml
3131
apiVersion: cache.kcp.io/v1alpha1
32-
kind: CachedResource
32+
kind: ClusterCachedResource
3333
metadata:
3434
name: cpuflavors-v1
3535
status:
@@ -50,10 +50,10 @@ status:
5050
local: 8 # (2)
5151
```
5252

53-
1. `cache` resource count refers to the count of objects currently in cache for this CachedResource.
54-
2. `local` resource count refers to the count of objects the CachedResource currently sees in its workspace.
53+
1. `cache` resource count refers to the count of objects currently in cache for this ClusterCachedResource.
54+
2. `local` resource count refers to the count of objects the ClusterCachedResource currently sees in its workspace.
5555

56-
The objects a CachedResource is watching are always replicated in the direction **from** CachedResource's workspace **into** cache. Note that this means the only way to modify the in-cache copies is to modify the original objects. In-cache objects can be then projected into a workspace as a read-only API. This is done by creating a respective APIExport with [CachedResource virtual resource](#exporting-cachedresources), and binding to it.
56+
The objects a ClusterCachedResource is watching are always replicated in the direction **from** ClusterCachedResource's workspace **into** cache. Note that this means the only way to modify the in-cache copies is to modify the original objects. In-cache objects can be then projected into a workspace as a read-only API. This is done by creating a respective APIExport with [ClusterCachedResource virtual resource](#exporting-clustercachedresources), and binding to it.
5757

5858
```mermaid
5959
flowchart TD
@@ -63,31 +63,31 @@ flowchart TD
6363
cpuflavorsCRD["CPUFlavors CRD"]
6464
cpuflavorCRs["CPUFlavor objects..."]
6565
66-
cpuflavorsCachedResource["CPUFlavors CachedResource"]
66+
cpuflavorsClusterCachedResource["CPUFlavors ClusterCachedResource"]
6767
6868
cpuflavorCRs -."From".-> cpuflavorsCRD
69-
cpuflavorsCachedResource -.Watches.-> cpuflavorCRs
69+
cpuflavorsClusterCachedResource -.Watches.-> cpuflavorCRs
7070
end
7171
72-
cpuflavorsCachedResource -."Replicates CPUFlavor objects into".-> cacheServer
72+
cpuflavorsClusterCachedResource -."Replicates CPUFlavor objects into".-> cacheServer
7373
```
7474

75-
You can optionally configure the following additional aspects of a CachedResource:
75+
You can optionally configure the following additional aspects of a ClusterCachedResource:
7676

7777
- its identity
7878
- resource selector
7979

8080
We'll talk about each of these next.
8181

82-
### CachedResource identity
82+
### ClusterCachedResource identity
8383

84-
Similar to the [APIExport identity](./exporting-apis.md#apiexport-identity) concept, there may be many CachedResources with the same group-version-resource triplet across the kcp installation. To differentiate between them and identify owners, a CachedResource object uses a unique identity key stored in a secret.
84+
Similar to the [APIExport identity](./exporting-apis.md#apiexport-identity) concept, there may be many ClusterCachedResources with the same group-version-resource triplet across the kcp installation. To differentiate between them and identify owners, a ClusterCachedResource object uses a unique identity key stored in a secret.
8585

8686
The identity **key** is considered a private key and should not be shared.
8787

88-
**Hash** calculated from that key, found at `.status.identityHash`, is considered a public key. APIExport's virtual resource definition expects this identity hash to be supplied when exporting a CachedResource.
88+
**Hash** calculated from that key, found at `.status.identityHash`, is considered a public key. APIExport's virtual resource definition expects this identity hash to be supplied when exporting a ClusterCachedResource.
8989

90-
By default, creating a CachedResource object triggers creation of an identity secret with a randomly generated key in its `key` data item. You can provide your own key by referencing your secret in the object's spec:
90+
By default, creating a ClusterCachedResource object triggers creation of an identity secret with a randomly generated key in its `key` data item. You can provide your own key by referencing your secret in the object's spec:
9191

9292
```yaml
9393
apiVersion: v1
@@ -99,7 +99,7 @@ stringData:
9999
key: "<Your identity key>"
100100
---
101101
apiVersion: cache.kcp.io/v1alpha1
102-
kind: CachedResource
102+
kind: ClusterCachedResource
103103
metadata:
104104
name: cpuflavors-v1
105105
spec:
@@ -112,11 +112,11 @@ spec:
112112

113113
### Selectors
114114

115-
CachedResource spec has an optional [`labelSelector`](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors) field which can be used to shape the set of objects it picks up.
115+
ClusterCachedResource spec has an optional [`labelSelector`](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors) field which can be used to shape the set of objects it picks up.
116116

117117
```yaml
118118
apiVersion: cache.kcp.io/v1alpha1
119-
kind: CachedResource
119+
kind: ClusterCachedResource
120120
metadata:
121121
name: cpuflavors-v1
122122
spec:
@@ -127,58 +127,58 @@ spec:
127127
cloud.example.com/visibility: Public
128128
```
129129

130-
## Exporting CachedResources
130+
## Exporting ClusterCachedResources
131131

132-
You can project the replicated read-only objects of a CachedResource into a workspace using the standard APIExport-APIBinding relationship. Create an APIExport and define [virtual resource](./exporting-apis.md#virtual-resources) for the associated [CachedResourceEndpointSlice](#cachedresourceendpointslice). Consumers can then bind to it.
132+
You can project the replicated read-only objects of a ClusterCachedResource into a workspace using the standard APIExport-APIBinding relationship. Create an APIExport and define [virtual resource](./exporting-apis.md#virtual-resources) for the associated [ClusterCachedResourceEndpointSlice](#clustercachedresourceendpointslice). Consumers can then bind to it.
133133

134134
**Example user story:**
135135

136136
- You, the **service provider**, run a cloud _Cloud Co._, including a compute service.
137137
- You offer a service of provisioning and running VM instances: users create an `Instance` object and voilà, they have a running VM!
138138
- But how do you design the API for configuring such a resource? How do you make your consumers know what configuration options are available, given the limited resources available in the cloud?
139139
- You've decided to offer different packages for CPUs, memory, storage, GPUs; these are represented as CRDs, e.g. `cpuflavors.cloud.example.com`, `memflavors.cloud.example.com`, with `cpu-small`, `cpu-medium`, `cpu-large`, `mem-medium`, `mem-large`, `mem-xlarge` respectively.
140-
- You've created a CachedResource for each flavor type.
140+
- You've created a ClusterCachedResource for each flavor type.
141141
- You offer the service through an APIExport containing the main `instances.cloud.example.com` resource, as well as all flavors. These are exported as [virtual resources](./exporting-apis.md#virtual-resources).
142142
- **Consumers** binding to your APIExport can list and get the available flavors from within their workspace (e.g. with `kubectl get cpuflavors`), and refer to them in their `Instance` spec. They cannot create, delete or otherwise modify the flavor objects in any way.
143143

144144
See an example usage at [github.com/kcp-dev/kcp/tree/main/config/examples/virtualresources](https://github.com/kcp-dev/kcp/tree/main/config/examples/virtualresources).
145145

146-
### CachedResourceEndpointSlice
146+
### ClusterCachedResourceEndpointSlice
147147

148-
The CachedResourceEndpointSlice tracks the consumers of the associated APIExport, and needs to be created when you want to export a CachedResource.
148+
The ClusterCachedResourceEndpointSlice tracks the consumers of the associated APIExport, and needs to be created when you want to export a ClusterCachedResource.
149149

150150
```mermaid
151151
flowchart TD
152152
cacheServer["Cache server"]
153153
replicationVW["Replication VW"]
154154
155155
subgraph provider["API Provider Workspace"]
156-
cpuflavorsCachedResource["CPUFlavors CachedResource"]
157-
cpuflavorsCachedResourceEndpointSlice["CPUFlavors CachedResourceEndpointSlice"]
156+
cpuflavorsClusterCachedResource["CPUFlavors ClusterCachedResource"]
157+
cpuflavorsClusterCachedResourceEndpointSlice["CPUFlavors ClusterCachedResourceEndpointSlice"]
158158
159-
cpuflavorsCachedResourceEndpointSlice --> cpuflavorsCachedResource
159+
cpuflavorsClusterCachedResourceEndpointSlice --> cpuflavorsClusterCachedResource
160160
end
161161
162162
replicationVW -."Reads from".-> cacheServer
163-
cpuflavorsCachedResourceEndpointSlice -."Has an endpoint for".-> replicationVW
163+
cpuflavorsClusterCachedResourceEndpointSlice -."Has an endpoint for".-> replicationVW
164164
```
165165

166166
```yaml
167167
apiVersion: cache.kcp.io/v1alpha1
168-
kind: CachedResourceEndpointSlice
168+
kind: ClusterCachedResourceEndpointSlice
169169
metadata:
170170
name: cpuflavors-v1
171171
spec:
172-
cachedResource:
172+
clusterCachedResource:
173173
name: cpuflavors-v1 # (1)
174174
export:
175175
name: vm-provider # (2)
176176
```
177177

178-
1. Name (and optionally the cluster path) of the CachedResource this endpoint slice is referencing.
178+
1. Name (and optionally the cluster path) of the ClusterCachedResource this endpoint slice is referencing.
179179
2. Name (and optionally the cluster path) of the APIExport this endpoint slice is referenced by.
180180

181-
Both the `cachedResource` and `export` references are immutable once set.
181+
Both the `clusterCachedResource` and `export` references are immutable once set.
182182

183183
```yaml
184184
apiVersion: apis.kcp.io/v1alpha2
@@ -194,27 +194,27 @@ spec:
194194
virtual:
195195
reference: # (2)
196196
apiGroup: cache.kcp.io
197-
kind: CachedResourceEndpointSlice
197+
kind: ClusterCachedResourceEndpointSlice
198198
name: cpuflavors-v1
199199
identityHash: cd2eb0837... # (3)
200200
```
201201

202-
1. Resource schema must match the schema used by the resource in the associated CachedResource.
203-
2. Reference to the CachedResourceEndpointSlice endpoint slice `cpuflavors-v1`.
204-
3. Identity hash of the `cpuflavors-v1` CachedResource object.
202+
1. Resource schema must match the schema used by the resource in the associated ClusterCachedResource.
203+
2. Reference to the ClusterCachedResourceEndpointSlice endpoint slice `cpuflavors-v1`.
204+
3. Identity hash of the `cpuflavors-v1` ClusterCachedResource object.
205205

206-
A `virtual` storage definition needs (1) a reference to an [endpoint slice](./exporting-apis.md#endpoint-slices) object, and (2) a virtual resource identity. In the case of CachedResources, the endpoint slice is provided by CachedResourceEndpointSlice. The identity hash must match the one set in CachedResource's `.status.identityHash`.
206+
A `virtual` storage definition needs (1) a reference to an [endpoint slice](./exporting-apis.md#endpoint-slices) object, and (2) a virtual resource identity. In the case of ClusterCachedResources, the endpoint slice is provided by ClusterCachedResourceEndpointSlice. The identity hash must match the one set in ClusterCachedResource's `.status.identityHash`.
207207

208208
```mermaid
209209
flowchart TD
210210
subgraph provider["API Provider Workspace"]
211211
export["CPUFlavors APIExport"]
212212
schema["CPUFlavors APIResourceSchema"]
213213
crd["CPUFlavors CRD"]
214-
cpuflavorsCachedResourceEndpointSlice["CPUFlavors CachedResourceEndpointSlice"]
214+
cpuflavorsClusterCachedResourceEndpointSlice["CPUFlavors ClusterCachedResourceEndpointSlice"]
215215
216216
export --> schema
217-
export --> cpuflavorsCachedResourceEndpointSlice
217+
export --> cpuflavorsClusterCachedResourceEndpointSlice
218218
schema -."Is equivalent to".-> crd
219219
end
220220

docs/content/concepts/apis/exporting-apis.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ spec:
578578
virtual:
579579
reference: # (1)
580580
apiGroup: cache.kcp.io
581-
kind: CachedResourceEndpointSlice
581+
kind: ClusterCachedResourceEndpointSlice
582582
name: cpuflavors-v1
583583
identityHash: cd2eb0837... # (2)
584584
@@ -587,6 +587,6 @@ spec:
587587
1. The `reference` block defines a reference to an [endpoint slice](#endpoint-slices) object.
588588
2. The `identityHash` refers to the identity hash owned by the virtual resource. This is different from the APIExport identity hash.
589589

590-
kcp currently supports one such virtual resource: see [CachedResource API](./cached-resources.md) for more information.
590+
kcp currently supports one such virtual resource: see [ClusterCachedResource API](./cached-resources.md) for more information.
591591

592592
Virtual resources are generic, and as long as the source virtual workspace implements the endpoint slice machinery, it can be used in APIExport's `virtual` storage definition.

docs/content/concepts/sharding/cache-server.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ The set of object types replicated to the cache server is wired up by the
9393
| `apiexportendpointslices` | `apis.kcp.io/v1alpha1` | always |
9494
| `apiresourceschemas` | `apis.kcp.io/v1alpha1` | always |
9595
| `apiconversions` | `apis.kcp.io/v1alpha1` | always |
96-
| `cachedresources` | `cache.kcp.io/v1alpha1` | always |
97-
| `cachedresourceendpointslices` | `cache.kcp.io/v1alpha1` | always |
96+
| `clustercachedresources` | `cache.kcp.io/v1alpha1` | always |
97+
| `clustercachedresourceendpointslices` | `cache.kcp.io/v1alpha1` | always |
9898
| `shards` | `core.kcp.io/v1alpha1` | always |
9999
| `workspacetypes` | `tenancy.kcp.io/v1alpha1` | always |
100100
| `mutatingwebhookconfigurations` | `admissionregistration.k8s.io/v1` | always |
@@ -106,7 +106,7 @@ The set of object types replicated to the cache server is wired up by the
106106
| `clusterrolebindings` | `rbac.authorization.k8s.io/v1` | annotated `core.kcp.io/replicate` |
107107

108108
User-defined types are added on top of this set via the
109-
[CachedResource API](../apis/cached-resources.md).
109+
[ClusterCachedResource API](../apis/cached-resources.md).
110110

111111
Objects in clusters whose name starts with `system:` are excluded from
112112
replication.
@@ -150,12 +150,12 @@ unrelated tenant RBAC stays local.
150150
but does not push the binding back.
151151
- **`Partition` / `PartitionSet`.** These are configuration objects consumed
152152
in the workspace where they live and referenced by `APIExportEndpointSlice`.
153-
- **Identity secrets.** A `CachedResource`'s identity secret is created
153+
- **Identity secrets.** A `ClusterCachedResource`'s identity secret is created
154154
locally per shard, not replicated.
155155

156156
### Adding New Resources
157157

158-
User-defined resources can be added to the cache server using the [CachedResource API](../apis/cached-resources.md). A CachedResource object triggers replication of a cluster-scoped resource from a workspace into the cache, making it available across shards alongside the built-in resource set.
158+
User-defined resources can be added to the cache server using the [ClusterCachedResource API](../apis/cached-resources.md). A ClusterCachedResource object triggers replication of a cluster-scoped resource from a workspace into the cache, making it available across shards alongside the built-in resource set.
159159

160160
### Deletion of Data
161161

docs/content/setup/production/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The main API endpoint for clients to access kcp. This is the main entry point fo
1919

2020
1. **Workspace scheduling**: When a new workspace is scheduled, the shard contacts the front-proxy to randomly pick a shard for the new workspace
2121

22-
2. **Endpoint updates**: When an `APIExportEndpointSlice` or `CachedResourceEndpointSlice` URL is updated, the update happens via the front-proxy
22+
2. **Endpoint updates**: When an `APIExportEndpointSlice` or `ClusterCachedResourceEndpointSlice` URL is updated, the update happens via the front-proxy
2323

2424
**Configuration:**
2525
- Set `--externalHostname` or `spec.external.hostname` in front-proxy or shard configurations

0 commit comments

Comments
 (0)