-
Notifications
You must be signed in to change notification settings - Fork 72
ko: describe how cross namespace references work #3775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| --- | ||
| title: "Cross namespace references" | ||
| description: "How do I use cross namespace references with {{ site.operator_product_name }}?" | ||
| content_type: reference | ||
| layout: reference | ||
| products: | ||
| - operator | ||
| breadcrumbs: | ||
| - /operator/ | ||
| - index: operator | ||
| group: Konnect | ||
| - index: operator | ||
| group: Konnect | ||
| section: Key Concepts | ||
|
|
||
| min_version: | ||
| operator: '2.1' | ||
|
|
||
| --- | ||
|
|
||
| {{ site.operator_product_name }} supports cross namespace references for certain resources. | ||
| This allows you to reference resources that are located in different namespaces than the resource that is referencing them. | ||
|
|
||
| ## ControlPlane configuration {% new_in 2.1 %} | ||
|
|
||
| When configuring a `KonnectGatewayControlPlane`, you can reference it from entities defined ain a different namespace. | ||
|
|
||
| This reference can be done via the `spec.controlPlaneRef.konnectNamespacedRef.namespace` field, by specifying the `namespace` of the `KonnectGatewayControlPlane` resource. | ||
|
|
||
| ```yaml | ||
| apiVersion: configuration.konghq.com/{{ site.operator_kongservice_api_version }} | ||
| kind: KongService | ||
| metadata: | ||
| name: my-service | ||
| namespace: default | ||
| spec: | ||
| name: service-1 | ||
| host: example.com | ||
| controlPlaneRef: | ||
| type: konnectNamespacedRef | ||
| konnectNamespacedRef: | ||
| name: my-control-plane | ||
| namespace: kong | ||
| ``` | ||
|
|
||
| In order to protect cross namespace references, the `KonnectGatewayControlPlane` resource must explicitly allow references from other namespaces by specifying `KongReferenceGrant` resources. | ||
|
|
||
| ```yaml | ||
| apiVersion: configuration.konghq.com/{{ site.operator_kongreferencegrant_api_version }} | ||
| kind: KongReferenceGrant | ||
| metadata: | ||
| name: allow-kongservice-to-konnectgatewaycontrolplane | ||
| namespace: kong | ||
| spec: | ||
| from: | ||
| - group: configuration.konghq.com | ||
| kind: KongService | ||
| namespace: default | ||
| to: | ||
| - group: konnect.konghq.com | ||
| kind: KonnectGatewayControlPlane | ||
| # Optionally specify a specific KonnectGatewayControlPlane name to allow | ||
| # only this specific resource to be referenced. | ||
| # name: my-control-plane | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| If you're having issues with cross namespace references, you can always check your | ||
| object's status conditions - specifically the `ResolvedRefs` condition - for more information: | ||
|
|
||
| ```bash | ||
| kg kongservice -n kong service-1 -o jsonpath-as-json="{ .status.conditions[?(@.type=='ResolvedRefs')]}" | ||
| ``` | ||
|
|
||
| ```json | ||
| [ | ||
| { | ||
| "lastTransitionTime": "2025-12-19T15:18:07Z", | ||
| "message": "KongReferenceGrant default/my-control-plane does not allow access to KonnectGatewayControlPlane <konnectNamespacedRef:default/my-control-plane>", | ||
| "observedGeneration": 2, | ||
| "reason": "RefNotPermitted", | ||
| "status": "False", | ||
| "type": "ResolvedRefs" | ||
| } | ||
| ] | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a list of resources that can be referenced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still a WIP but Kong/kong-operator#2936 tracks all of those.
This document will cover (in my eyes) all the references that we'll have (not only the
KonnectGatewayControlPlanereference).If you'd like to have a list of those then we'd have to add it in the next section (
ControlPlane configuration).The list itself can change (based on the output of 2936) so we might want to refine it later on when we're closer to 2.1. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good, we can wait and add the list later, thanks!