Skip to content

Commit c2f6db9

Browse files
committed
ko: describe how cross namespace references work
1 parent 059c3ee commit c2f6db9

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

app/_indices/operator.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ groups:
9191
- path: /operator/konnect/reconciliation-loop/
9292
- path: /operator/konnect/labelling/
9393
- path: /operator/konnect/kongpluginbinding/
94+
- path: /operator/konnect/cross-namespace-references/
9495
- title: "Konnect CRDs: Control Planes"
9596
items:
9697
- path: /operator/konnect/crd/control-planes/**/*
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
title: "Cross namespace references"
3+
description: "How do I use cross namespace references with {{ site.operator_product_name }}?"
4+
content_type: reference
5+
layout: reference
6+
products:
7+
- operator
8+
breadcrumbs:
9+
- /operator/
10+
- index: operator
11+
group: Konnect
12+
- index: operator
13+
group: Konnect
14+
section: Key Concepts
15+
16+
min_version:
17+
operator: '2.1'
18+
19+
---
20+
21+
{{ site.operator_product_name }} supports cross namespace references for certain resources.
22+
This allows you to reference resources that are located in different namespaces than the resource that is referencing them.
23+
24+
## ControlPlane configuration {% new_in 2.1 %}
25+
26+
When configuring a `KonnectGatewayControlPlane`, you can reference it from entities defined ain a different namespace.
27+
28+
This reference can be done via the `spec.controlPlaneRef.konnectNamespacedRef.namespace` field, by specifying the `namespace` of the `KonnectGatewayControlPlane` resource.
29+
30+
```yaml
31+
apiVersion: configuration.konghq.com/{{ site.operator_kongservice_api_version }}
32+
kind: KongService
33+
metadata:
34+
name: my-service
35+
namespace: default
36+
spec:
37+
name: service-1
38+
host: example.com
39+
controlPlaneRef:
40+
type: konnectNamespacedRef
41+
konnectNamespacedRef:
42+
name: my-control-plane
43+
namespace: kong
44+
```
45+
46+
In order to protect cross namespace references, the `KonnectGatewayControlPlane` resource must explicitly allow references from other namespaces by specifying `KongReferenceGrant` resources.
47+
48+
```yaml
49+
apiVersion: configuration.konghq.com/{{ site.operator_kongreferencegrant_api_version }}
50+
kind: KongReferenceGrant
51+
metadata:
52+
name: allow-kongservice-to-konnectgatewaycontrolplane
53+
namespace: kong
54+
spec:
55+
from:
56+
- group: configuration.konghq.com
57+
kind: KongService
58+
namespace: default
59+
to:
60+
- group: konnect.konghq.com
61+
kind: KonnectGatewayControlPlane
62+
# Optionally specify a specific KonnectGatewayControlPlane name to allow
63+
# only this specific resource to be referenced.
64+
# name: my-control-plane
65+
```
66+
67+
## Troubleshooting
68+
69+
If you're having issues with cross namespace references, you can always check your
70+
object's status conditions - specifically the `ResolvedRefs` condition - for more information:
71+
72+
```bash
73+
kg kongservice -n kong service-1 -o jsonpath-as-json="{ .status.conditions[?(@.type=='ResolvedRefs')]}"
74+
```
75+
76+
```json
77+
[
78+
{
79+
"lastTransitionTime": "2025-12-19T15:18:07Z",
80+
"message": "KongReferenceGrant default/my-control-plane does not allow access to KonnectGatewayControlPlane <konnectNamespacedRef:default/my-control-plane>",
81+
"observedGeneration": 2,
82+
"reason": "RefNotPermitted",
83+
"status": "False",
84+
"type": "ResolvedRefs"
85+
}
86+
]
87+
```

jekyll.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,6 @@ latest_gateway_oss_version: "3.9.1"
158158
operator_gatewayconfiguration_api_version: "v2beta1"
159159
operator_konnectgatewaycontrolplane_api_version: "v1alpha2"
160160
operator_konnectextension_api_version: "v1alpha2"
161+
operator_kongservice_api_version: "v1alpha1"
162+
operator_kongreferencegrant_api_version: "v1alpha1"
161163
render_banner: false

0 commit comments

Comments
 (0)