Skip to content

Commit 0bbc22f

Browse files
Add doc for kreference-mapping (#4231)
* add doc for kreference-mapping * try quoting macro * fix example * apply review comments * more fixes * more fixes
1 parent 8c0741c commit 0bbc22f

File tree

1 file changed

+104
-20
lines changed

1 file changed

+104
-20
lines changed

docs/eventing/experimental-features.md

Lines changed: 104 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,37 @@
11
# Experimental features
22

3-
In Knative we want to keep the innovation alive, experimenting and delivering new features without affecting the stability of the project.
3+
In order to keep Knative innovative, the maintainers of this project have
4+
developed an
5+
[experimental features process](https://github.com/knative/eventing/blob/main/docs/experimental-features.md),
6+
that allows new, experimental features to be delivered and tested by users,
7+
without affecting the stability of the core project.
48

5-
In order to achieve that goal in Knative Eventing, we have a process to include new features.
6-
This allows users like you to try out new features and provide feedback back to the project.
7-
8-
This document explains how to enable experimental features and which ones are available today.
9-
10-
For more details about the process, the feature phases, quality requirements and guarantees, check out the [Experimental features process documentation](https://github.com/knative/eventing/blob/main/docs/experimental-features.md).
9+
<!--TODO: Add note about HOW / where users can provide feedback, otherwise there's not much point mentioning that-->
1110

1211
!!! warning
13-
Depending on the feature stage, an experimental feature might be unstable and break your Knative setup or even your cluster setup, use them with caution.
14-
For more details about quality guarantees, check out the [Feature stage definition](https://github.com/knative/eventing/blob/main/docs/experimental-features.md#stage-definition).
12+
Experimental features are unstable and may cause issues in your Knative setup or even your cluster setup.
13+
These features should be used with caution, and should never be tested on a production environment. For more
14+
information about quality guarantees for features at different stages of
15+
development, see the
16+
[Feature stage definition](https://github.com/knative/eventing/blob/main/docs/experimental-features.md#stage-definition)
17+
documentation.
18+
19+
This document explains how to enable experimental features and which ones are
20+
available today.
1521

1622
## Before you begin
1723

18-
You must have a Knative cluster running with the Eventing component installed. [Learn more](../admin/install/README.md)
24+
You must have a Knative cluster running with Knative Eventing installed.
1925

2026
## Experimental features configuration
2127

22-
When installing Eventing, the `config-features` ConfigMap is added to your cluster in the `knative-eventing` namespace.
23-
In order to enable a feature, you just need to add it to the config map and set its value to `enabled`.
24-
For example, to enable `new-cool-feature`:
28+
When you install Knative Eventing, the `config-features` ConfigMap is added to
29+
your cluster in the `knative-eventing` namespace.
30+
31+
In order to enable a feature, you must add it to the `config-features` ConfigMap
32+
under the `data` spec, and set the value for the feature to `enabled`. For example,
33+
to enable a feature called `new-cool-feature`, you would add the following ConfigMap
34+
entry:
2535

2636
```yaml
2737
apiVersion: v1
@@ -63,9 +73,13 @@ data:
6373

6474
**Tracking issue**: [#5086](https://github.com/knative/eventing/issues/5086)
6575

66-
When using the `KReference` type to refer to another Knative resource, you can just specify the API `group` of the resource, instead of the full `APIVersion`.
76+
**Persona**: Developer
77+
78+
When using the `KReference` type to refer to another Knative resource, you can
79+
just specify the API `group` of the resource, instead of the full `APIVersion`.
6780

68-
For example, in order to refer to an `InMemoryChannel`, instead of the following spec:
81+
For example, in order to refer to an `InMemoryChannel`, instead of the following
82+
spec:
6983

7084
```yaml
7185
apiVersion: messaging.knative.dev/v1
@@ -81,10 +95,13 @@ kind: InMemoryChannel
8195
name: my-channel
8296
```
8397

84-
With this feature you can allow Knative to resolve the full `APIVersion` and further upgrades, deprecations and removals of the referred CRD without affecting existing resources.
98+
With this feature you can allow Knative to resolve the full `APIVersion` and
99+
further upgrades, deprecations and removals of the referred CRD without
100+
affecting existing resources.
85101

86102
!!! note
87-
At the moment this feature is implemented only for `Subscription.Spec.Subscriber.Ref` and `Subscription.Spec.Channel`.
103+
At the moment this feature is implemented only for
104+
`Subscription.Spec.Subscriber.Ref` and `Subscription.Spec.Channel`.
88105

89106
### DeliverySpec.Timeout field
90107

@@ -94,9 +111,15 @@ With this feature you can allow Knative to resolve the full `APIVersion` and fur
94111

95112
**Tracking issue**: [#5148](https://github.com/knative/eventing/issues/5148)
96113

97-
When using the `delivery` spec to configure event delivery parameters, you can use `timeout` field to specify the timeout for each sent HTTP request. The duration of the `timeout` parameter is specified using the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Times) format.
114+
**Persona**: Developer
115+
116+
When using the `delivery` spec to configure event delivery parameters, you can
117+
use `timeout` field to specify the timeout for each sent HTTP request. The
118+
duration of the `timeout` parameter is specified using the
119+
[ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Times) format.
98120

99-
The following example shows a Subscription that retries sending an event 3 times, and on each retry the request timeout is going to be 5 seconds:
121+
The following example shows a Subscription that retries sending an event 3
122+
times, and on each retry the request timeout is 5 seconds:
100123

101124
```yaml
102125
apiVersion: messaging.knative.dev/v1
@@ -117,4 +140,65 @@ spec:
117140
timeout: PT5S
118141
```
119142

120-
You can specify a `delivery` spec for Channels, Subscriptions, Brokers, Triggers, and any other resource spec that accepts the `delivery` field.
143+
You can specify a `delivery` spec for Channels, Subscriptions, Brokers,
144+
Triggers, and any other resource spec that accepts the `delivery` field.
145+
146+
### Knative reference mapping
147+
148+
**Flag name**: `kreference-mapping`
149+
150+
**Stage**: Alpha, disabled by default
151+
152+
**Tracking issue**: [#5148](https://github.com/knative/eventing/issues/5593)
153+
154+
**Persona**: Administrator, Developer
155+
156+
When enabled, this feature allows you to provide mappings from a [Knative reference](https://github.com/knative/specs/blob/main/specs/eventing/overview.md#destination) to a templated URI.
157+
158+
159+
!!! note
160+
Currently only PingSource supports this experimental feature.
161+
162+
For example, you can directly reference non-addressable resources anywhere that Knative Eventing accepts a reference, such as for a PingSource sink, or a Trigger subscriber.
163+
164+
Mappings are defined by a cluster administrator in the `config-reference-mapping` ConfigMap.
165+
The following example maps `JobDefinition` to a Job runner service:
166+
167+
{% raw %}
168+
169+
```yaml
170+
apiVersion: v1
171+
kind: ConfigMap
172+
metadata:
173+
name: config-kreference-mapping
174+
namespace: knative-eventing
175+
data:
176+
JobDefinition.v1.mygroup: "https://jobrunner.{{ .SystemNamespace }}.svc.cluster.local/{{ .Name }}"
177+
```
178+
179+
{% endraw %}
180+
181+
The key must be of the form `<Kind>.<version>.<group>`. The value must resolved
182+
to a valid URI. Currently, the following template data are supported:
183+
184+
- Name: The name of the referenced object
185+
- Namespace: The namespace of the referenced object
186+
- SystemNamespace: The namespace of where Knative Eventing is installed
187+
188+
Given the above mapping, the following example shows how you can directly reference
189+
`JobDefinition` objects in a PingSource:
190+
191+
```yaml
192+
apiVersion: sources.knative.dev/v1
193+
kind: PingSource
194+
metadata:
195+
name: trigger-job-every-minute
196+
spec:
197+
schedule: "*/1 * * * *"
198+
sink:
199+
ref:
200+
apiVersion: mygroup/v1
201+
kind: JobDefinition
202+
name: ajob
203+
```
204+

0 commit comments

Comments
 (0)