Skip to content

Commit fcb866c

Browse files
authored
[release-v1.16] Backport Event transform (#1191)
* Checkout EventTransform Signed-off-by: Pierangelo Di Pilato <[email protected]> * Remove transformations and integrations ConfigMaps We don't use the ConfigMaps to inject the values, the operator will replace the value to the images directly. Signed-off-by: Pierangelo Di Pilato <[email protected]> * Run make generate-release Signed-off-by: Pierangelo Di Pilato <[email protected]> * RBAC for EventTransform Signed-off-by: Pierangelo Di Pilato <[email protected]> * RBAC for EventTransform in release artifacts Signed-off-by: Pierangelo Di Pilato <[email protected]> * Add configmaps/finalizers permissions Signed-off-by: Pierangelo Di Pilato <[email protected]> * Add update finalizers permissions for EventTransform reconciled resources Signed-off-by: Pierangelo Di Pilato <[email protected]> * Update eventing-controller manifest with EventTransform Jsonata image Signed-off-by: Pierangelo Di Pilato <[email protected]> * Volume mounts use direct Signed-off-by: Pierangelo Di Pilato <[email protected]> * Fix EventTransform with TLS Sink test Signed-off-by: Pierangelo Di Pilato <[email protected]> --------- Signed-off-by: Pierangelo Di Pilato <[email protected]>
1 parent 442caed commit fcb866c

File tree

65 files changed

+9035
-109
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+9035
-109
lines changed

cmd/controller/main.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,19 @@ import (
2020
// Uncomment the following line to load the gcp plugin (only required to authenticate against GKE clusters).
2121
// _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
2222

23+
"knative.dev/eventing/pkg/certificates"
2324
"knative.dev/pkg/injection/sharedmain"
2425

25-
filteredFactory "knative.dev/pkg/client/injection/kube/informers/factory/filtered"
26+
kubefilteredfactory "knative.dev/pkg/client/injection/kube/informers/factory/filtered"
2627
"knative.dev/pkg/signals"
2728

29+
eventingfilteredfactory "knative.dev/eventing/pkg/client/injection/informers/factory/filtered"
30+
2831
"knative.dev/eventing/pkg/apis/sinks"
2932
"knative.dev/eventing/pkg/auth"
3033
"knative.dev/eventing/pkg/eventingtls"
3134
"knative.dev/eventing/pkg/reconciler/eventpolicy"
35+
"knative.dev/eventing/pkg/reconciler/eventtransform"
3236
"knative.dev/eventing/pkg/reconciler/jobsink"
3337

3438
"knative.dev/eventing/pkg/reconciler/apiserversource"
@@ -49,16 +53,17 @@ import (
4953
func main() {
5054
ctx := signals.NewContext()
5155

52-
ctx = filteredFactory.WithSelectors(ctx,
56+
ctx = kubefilteredfactory.WithSelectors(ctx,
5357
auth.OIDCLabelSelector,
5458
eventingtls.TrustBundleLabelSelector,
5559
sinks.JobSinkJobsLabelSelector,
56-
"app.kubernetes.io/name",
60+
eventtransform.JsonataResourcesSelector,
61+
certificates.SecretLabelSelectorPair,
5762
)
5863

59-
//for _, inf := range []injection.InformerInjector{v1certificate.WithInformer} {
60-
// injection.Default.RegisterInformer(inf)
61-
//}
64+
ctx = eventingfilteredfactory.WithSelectors(ctx,
65+
eventtransform.JsonataResourcesSelector,
66+
)
6267

6368
sharedmain.MainWithContext(ctx, "controller",
6469
// Messaging
@@ -89,5 +94,8 @@ func main() {
8994
// Sugar
9095
sugarnamespace.NewController,
9196
sugartrigger.NewController,
97+
98+
// Transform
99+
eventtransform.NewController,
92100
)
93101
}

cmd/webhook/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ func init() {
7979
var ourTypes = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{
8080
// For group eventing.knative.dev.
8181
// v1alpha1
82-
eventingv1alpha1.SchemeGroupVersion.WithKind("EventPolicy"): &eventingv1alpha1.EventPolicy{},
82+
eventingv1alpha1.SchemeGroupVersion.WithKind("EventPolicy"): &eventingv1alpha1.EventPolicy{},
83+
eventingv1alpha1.SchemeGroupVersion.WithKind("EventTransform"): &eventingv1alpha1.EventTransform{},
8384
// v1beta1
8485
eventingv1beta1.SchemeGroupVersion.WithKind("EventType"): &eventingv1beta1.EventType{},
8586
// v1beta2

config/400-config-eventing-integrations-images.yaml

Lines changed: 0 additions & 1 deletion
This file was deleted.

config/core/configmaps/eventing-integrations-images.yaml

Lines changed: 0 additions & 1 deletion
This file was deleted.

config/core/deployments/controller.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ spec:
7777
fieldRef:
7878
fieldPath: metadata.name
7979

80+
- name: EVENT_TRANSFORM_JSONATA_IMAGE
81+
valueFrom:
82+
configMapKeyRef:
83+
key: transform-jsonata
84+
name: eventing-transformations-images
8085

8186
- name: INTEGRATION_SOURCE_TIMER_IMAGE
8287
valueFrom:
Lines changed: 280 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
# Copyright 2025 The Knative Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: apiextensions.k8s.io/v1
16+
kind: CustomResourceDefinition
17+
metadata:
18+
name: eventtransforms.eventing.knative.dev
19+
labels:
20+
knative.dev/crd-install: "true"
21+
app.kubernetes.io/version: devel
22+
app.kubernetes.io/name: knative-eventing
23+
spec:
24+
group: eventing.knative.dev
25+
versions:
26+
- name: v1alpha1
27+
served: true
28+
storage: true
29+
subresources:
30+
status: { }
31+
schema:
32+
openAPIV3Schema:
33+
type: object
34+
properties:
35+
spec:
36+
description: Spec defines the desired state of the EventTransform.
37+
type: object
38+
properties:
39+
jsonata:
40+
type: object
41+
properties:
42+
expression:
43+
description: Expression is the JSONata expression (https://jsonata.org/).
44+
type: string
45+
reply:
46+
description: |
47+
Reply is the configuration on how to handle responses from Sink. It can only be set if Sink is set.
48+
Only one "type" can be used.
49+
The used type must match the top-level transformation, if you need to mix transformation types, use compositions and chain transformations together to achieve your desired outcome.
50+
type: object
51+
properties:
52+
jsonata:
53+
type: object
54+
properties:
55+
expression:
56+
description: Expression is the JSONata expression (https://jsonata.org/).
57+
type: string
58+
discard:
59+
description: |
60+
Discard discards responses from Sink and return empty response body.
61+
When set to false, it returns the exact sink response body.
62+
When set to true, Discard is mutually exclusive with EventTransformations in the reply
63+
section, it can either be discarded or transformed.
64+
Default: false.
65+
type: boolean
66+
sink:
67+
description: 'Sink is a reference to an object that will resolve to a uri to use as the sink. If not present, the transformation will send back the transformed event as response, this is useful to leverage the built-in Broker reply feature to re-publish a transformed event back to the broker. '
68+
type: object
69+
properties:
70+
CACerts:
71+
description: CACerts are Certification Authority (CA) certificates in PEM format according to https://www.rfc-editor.org/rfc/rfc7468. If set, these CAs are appended to the set of CAs provided by the Addressable target, if any.
72+
type: string
73+
audience:
74+
description: Audience is the OIDC audience. This need only be set, if the target is not an Addressable and thus the Audience can't be received from the Addressable itself. In case the Addressable specifies an Audience too, the Destinations Audience takes preference.
75+
type: string
76+
ref:
77+
description: Ref points to an Addressable.
78+
type: object
79+
properties:
80+
address:
81+
description: Address points to a specific Address Name.
82+
type: string
83+
apiVersion:
84+
description: API version of the referent.
85+
type: string
86+
group:
87+
description: 'Group of the API, without the version of the group. This can be used as an alternative to the APIVersion, and then resolved using ResolveGroup. Note: This API is EXPERIMENTAL and might break anytime. For more details: https://github.com/knative/eventing/issues/5086'
88+
type: string
89+
kind:
90+
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
91+
type: string
92+
name:
93+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
94+
type: string
95+
namespace:
96+
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ This is optional field, it gets defaulted to the object holding it if left out.'
97+
type: string
98+
uri:
99+
description: URI can be an absolute URL(non-empty scheme and non-empty host) pointing to the target or a relative URI. Relative URIs will be resolved using the base URI retrieved from Ref.
100+
type: string
101+
status:
102+
description: Status represents the current state of the EventTransform. This data may be out of date.
103+
type: object
104+
properties:
105+
address:
106+
description: Address is a single Addressable address. If Addresses is present, Address will be ignored by clients.
107+
type: object
108+
required:
109+
- url
110+
properties:
111+
CACerts:
112+
description: CACerts is the Certification Authority (CA) certificates in PEM format according to https://www.rfc-editor.org/rfc/rfc7468.
113+
type: string
114+
audience:
115+
description: Audience is the OIDC audience for this address.
116+
type: string
117+
name:
118+
description: Name is the name of the address.
119+
type: string
120+
url:
121+
type: string
122+
addresses:
123+
description: Addresses is a list of addresses for different protocols (HTTP and HTTPS) If Addresses is present, Address must be ignored by clients.
124+
type: array
125+
items:
126+
type: object
127+
required:
128+
- url
129+
properties:
130+
CACerts:
131+
description: CACerts is the Certification Authority (CA) certificates in PEM format according to https://www.rfc-editor.org/rfc/rfc7468.
132+
type: string
133+
audience:
134+
description: Audience is the OIDC audience for this address.
135+
type: string
136+
name:
137+
description: Name is the name of the address.
138+
type: string
139+
url:
140+
type: string
141+
annotations:
142+
description: Annotations is additional Status fields for the Resource to save some additional State as well as convey more information to the user. This is roughly akin to Annotations on any k8s resource, just the reconciler conveying richer information outwards.
143+
type: object
144+
x-kubernetes-preserve-unknown-fields: true
145+
auth:
146+
description: Auth defines the attributes that provide the generated service account name in the resource status.
147+
type: object
148+
required:
149+
- serviceAccountName
150+
properties:
151+
serviceAccountName:
152+
description: ServiceAccountName is the name of the generated service account used for this components OIDC authentication.
153+
type: string
154+
serviceAccountNames:
155+
description: ServiceAccountNames is the list of names of the generated service accounts used for this components OIDC authentication. This list can have len() > 1, when the component uses multiple identities (e.g. in case of a Parallel).
156+
type: array
157+
items:
158+
type: string
159+
conditions:
160+
description: Conditions the latest available observations of a resource's current state.
161+
type: array
162+
items:
163+
type: object
164+
required:
165+
- type
166+
- status
167+
properties:
168+
lastTransitionTime:
169+
description: LastTransitionTime is the last time the condition transitioned from one status to another. We use VolatileTime in place of metav1.Time to exclude this from creating equality.Semantic differences (all other things held constant).
170+
type: string
171+
message:
172+
description: A human readable message indicating details about the transition.
173+
type: string
174+
reason:
175+
description: The reason for the condition's last transition.
176+
type: string
177+
severity:
178+
description: Severity with which to treat failures of this type of condition. When this is not specified, it defaults to Error.
179+
type: string
180+
status:
181+
description: Status of the condition, one of True, False, Unknown.
182+
type: string
183+
type:
184+
description: Type of condition.
185+
type: string
186+
jsonata:
187+
description: JsonataTransformationStatus is the status associated with JsonataEventTransformationSpec.
188+
type: object
189+
properties:
190+
deployment:
191+
type: object
192+
properties:
193+
availableReplicas:
194+
description: Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.
195+
type: integer
196+
format: int32
197+
collisionCount:
198+
description: Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet.
199+
type: integer
200+
format: int32
201+
conditions:
202+
description: Represents the latest available observations of a deployment's current state.
203+
type: array
204+
items:
205+
type: object
206+
properties:
207+
lastTransitionTime:
208+
description: Last time the condition transitioned from one status to another.
209+
type: string
210+
lastUpdateTime:
211+
description: The last time this condition was updated.
212+
type: string
213+
message:
214+
description: A human readable message indicating details about the transition.
215+
type: string
216+
reason:
217+
description: The reason for the condition's last transition.
218+
type: string
219+
status:
220+
description: Status of the condition, one of True, False, Unknown.
221+
type: string
222+
type:
223+
description: Type of deployment condition.
224+
type: string
225+
observedGeneration:
226+
description: The generation observed by the deployment controller.
227+
type: integer
228+
format: int64
229+
readyReplicas:
230+
description: readyReplicas is the number of pods targeted by this Deployment with a Ready Condition.
231+
type: integer
232+
format: int32
233+
replicas:
234+
description: Total number of non-terminated pods targeted by this deployment (their labels match the selector).
235+
type: integer
236+
format: int32
237+
unavailableReplicas:
238+
description: Total number of unavailable pods targeted by this deployment. This is the total number of pods that are still required for the deployment to have 100% available capacity. They may either be pods that are running but not yet available or pods that still have not been created.
239+
type: integer
240+
format: int32
241+
updatedReplicas:
242+
description: Total number of non-terminated pods targeted by this deployment that have the desired template spec.
243+
type: integer
244+
format: int32
245+
observedGeneration:
246+
description: ObservedGeneration is the 'Generation' of the Service that was last processed by the controller.
247+
type: integer
248+
format: int64
249+
sinkAudience:
250+
description: SinkAudience is the OIDC audience of the sink.
251+
type: string
252+
sinkCACerts:
253+
description: SinkCACerts are Certification Authority (CA) certificates in PEM format according to https://www.rfc-editor.org/rfc/rfc7468.
254+
type: string
255+
sinkUri:
256+
description: SinkURI is the current active sink URI that has been configured for the Source.
257+
type: string
258+
259+
additionalPrinterColumns:
260+
- name: URL
261+
type: string
262+
jsonPath: ".status.address.url"
263+
- name: Sink
264+
type: string
265+
jsonPath: ".status.sinkUri"
266+
- name: Ready
267+
type: string
268+
jsonPath: ".status.conditions[?(@.type==\"Ready\")].status"
269+
- name: Reason
270+
type: string
271+
jsonPath: ".status.conditions[?(@.type==\"Ready\")].reason"
272+
names:
273+
kind: EventTransform
274+
plural: eventtransforms
275+
singular: eventtransform
276+
categories:
277+
- all
278+
- knative
279+
- eventing
280+
scope: Namespaced

0 commit comments

Comments
 (0)