You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prefix provider resource names with hashed consumer cluster name to prevent conflicts (#165)
- Prefix provider-side resource names with a 12-char hash of the
consumer cluster name to prevent conflicts when multiple consumers
create resources with the same name/namespace
- Store original name in annotation for provider-to-consumer reverse
lookup
- Strip prefix from related resources when syncing back to consumer
- Added unit tests for the generic functions
- Modified the e2e examples test
The resource-broker will see the Certificate in the virtual workspace of the APIExport, pass it to a matching provider. Since the fqdn is `app.internal.corp` the InternalCA provider will issue the certificate:
318
+
The resource-broker will see the Certificate in the virtual workspace of the APIExport, pass it to a matching provider. Since the fqdn is `app.internal.corp` the InternalCA provider will issue the certificate.
319
+
320
+
> [!NOTE]
321
+
> Provider-side resource names are prefixed with a hash of the consumer cluster name to prevent
322
+
> naming conflicts when multiple consumers create resources with the same name.
323
+
> The original consumer-side name `cert-from-consumer` becomes `{hash}-cert-from-consumer` in
324
+
> the provider's virtual workspace.
325
+
326
+
In the provider's virtual workspace the Certificate looks like this.
327
+
328
+
Grab the hash-prefixed name from the VW:
329
+
330
+
<!--
331
+
Wait for the certificate to appear in the provider's virtual workspace:
332
+
```bash ci
333
+
kubectl::wait::list \
334
+
kubeconfigs/workspaces/internalca.vw.kubeconfig \
335
+
certificates.example.platform-mesh.io \
336
+
--all-namespaces
337
+
```
338
+
-->
339
+
340
+
```bash ci
341
+
provider_cert="$(kubectl --kubeconfig kubeconfigs/workspaces/internalca.vw.kubeconfig get certificates.example.platform-mesh.io -A -o jsonpath="{.items[0].metadata.name}")"
342
+
```
343
+
344
+
```bash ci
345
+
kubectl --kubeconfig kubeconfigs/workspaces/internalca.vw.kubeconfig get certificates.example.platform-mesh.io "$provider_cert" -o yaml
346
+
```
347
+
348
+
```yaml
349
+
apiVersion: v1
350
+
items:
351
+
- apiVersion: example.platform-mesh.io/v1alpha1
352
+
kind: Certificate
353
+
metadata:
354
+
# ...
355
+
name: {hash}-cert-from-consumer
356
+
namespace: default
357
+
# ...
358
+
spec:
359
+
fqdn: app.internal.corp
360
+
status:
361
+
# ...
362
+
relatedResources:
363
+
secret:
364
+
gvk:
365
+
group: core
366
+
kind: Secret
367
+
version: v1
368
+
name: {hash}-cert-from-consumer
369
+
namespace: default
370
+
# ...
371
+
kind: List
372
+
metadata:
373
+
resourceVersion: ""
374
+
```
375
+
376
+
On the compute cluster, api-syncagent further transforms the name using its own cluster IDs and hashes:
319
377
320
378
<!--
321
379
```bash ci
@@ -326,13 +384,10 @@ kubectl::wait::list \
326
384
```
327
385
-->
328
386
329
-
330
387
```bash ci
331
388
kubectl --kubeconfig kubeconfigs/internalca.kubeconfig get certificates.example.platform-mesh.io --all-namespaces
332
389
```
333
390
334
-
For synchronisation api-syncagent is used, which uses the cluster IDs and hashes to uniquely name the resources:
335
-
336
391
```
337
392
NAMESPACE NAME STATE SYNCED AGE
338
393
9n832d7e4xebepg1 2747cabbb481a433679f-42b4d6246cf320c6cee5 ACTIVE True 10m
@@ -362,15 +417,15 @@ items:
362
417
group: core
363
418
kind: Secret
364
419
version: v1
365
-
name: 2747cabbb481a433679f-42b4d6246cf320c6cee5
420
+
name: {hash}-cert-from-consumer
366
421
namespace: default
367
422
# ...
368
423
kind: List
369
424
metadata:
370
425
resourceVersion: ""
371
426
```
372
427
373
-
Grab the name and namespace:
428
+
Grab the name and namespace from the compute cluster:
374
429
375
430
```bash ci
376
431
secret_name="$(kubectl --kubeconfig kubeconfigs/internalca.kubeconfig get certificates.example.platform-mesh.io --all-namespaces -o jsonpath="{.items[0].metadata.name}")"
@@ -382,7 +437,7 @@ Wait for the certificate to be issued.
Grab the hash-prefixed name from the externalca VW:
529
+
530
+
<!--
531
+
Wait for the certificate to appear in the externalca provider's virtual workspace:
532
+
```bash ci
533
+
kubectl::wait::list \
534
+
kubeconfigs/workspaces/externalca.vw.kubeconfig \
535
+
certificates.example.platform-mesh.io \
536
+
--all-namespaces
537
+
```
538
+
-->
539
+
540
+
```bash ci
541
+
provider_cert="$(kubectl --kubeconfig kubeconfigs/workspaces/externalca.vw.kubeconfig get certificates.example.platform-mesh.io -A -o jsonpath="{.items[0].metadata.name}")"
542
+
```
543
+
473
544
```bash ci
474
545
secret_name="$(kubectl --kubeconfig kubeconfigs/externalca.kubeconfig get certificates.example.platform-mesh.io --all-namespaces -o jsonpath="{.items[0].metadata.name}")"
475
546
secret_namespace="$(kubectl --kubeconfig kubeconfigs/externalca.kubeconfig get certificates.example.platform-mesh.io --all-namespaces -o jsonpath="{.items[0].metadata.namespace}")"
476
547
```
477
548
549
+
<!--
550
+
Wait for the certificate to be issued.
551
+
```bash ci
552
+
kubectl::wait::cert::subject \
553
+
kubeconfigs/externalca.kubeconfig \
554
+
"$provider_cert" \
555
+
"$secret_namespace" \
556
+
"app.corp.com"
557
+
```
558
+
-->
559
+
478
560
And decoding the `tls.crt` field shows the certificate was correctly issued for `app.corp.com`:
0 commit comments