Skip to content

Commit 14c3f68

Browse files
committed
Adding first EB bits
Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
1 parent 3e86e93 commit 14c3f68

File tree

11 files changed

+151
-5
lines changed

11 files changed

+151
-5
lines changed

config/core/deployments/controller.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ spec:
131131
key: aws-sns-sink
132132
name: eventing-integrations-images
133133

134+
- name: INTEGRATION_SINK_AWS_EVENTBRIDGE_IMAGE
135+
valueFrom:
136+
configMapKeyRef:
137+
key: aws-eventbridge-sink
138+
name: eventing-integrations-images
139+
140+
134141
## Adapter settings
135142
# - name: K_LOGGING_CONFIG
136143
# value: ''

config/core/resources/integrationsink.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,30 @@ spec:
111111
aws:
112112
type: object
113113
properties:
114+
eventbridge:
115+
type: object
116+
properties:
117+
arn:
118+
type: string
119+
title: Eventbus Name
120+
description: The Eventbridge Eventbus name or Amazon Resource Name (ARN).
121+
region:
122+
type: string
123+
title: AWS Region
124+
description: The AWS region to access.
125+
uriEndpointOverride:
126+
type: string
127+
title: Overwrite Endpoint URI
128+
description: The overriding endpoint URI. To use this option, you must
129+
also select the `overrideEndpoint` option.
130+
overrideEndpoint:
131+
type: boolean
132+
title: Endpoint Overwrite
133+
description: Select this option to override the endpoint URI. To use
134+
this option, you must also provide a URI for the `uriEndpointOverride`
135+
option.
136+
default: false
137+
114138
s3:
115139
type: object
116140
properties:

docs/eventing-api.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6757,12 +6757,23 @@ JobSinkStatus
67576757
<tbody>
67586758
<tr>
67596759
<td>
6760+
<code>eventbridge</code><br/>
6761+
<em>
6762+
knative.dev/eventing/pkg/apis/common/integration/v1alpha1.AWSEventbridge
6763+
</em>
6764+
</td>
6765+
<td>
6766+
</td>
6767+
</tr>
6768+
<tr>
6769+
<td>
67606770
<code>s3</code><br/>
67616771
<em>
67626772
knative.dev/eventing/pkg/apis/common/integration/v1alpha1.AWSS3
67636773
</em>
67646774
</td>
67656775
<td>
6776+
<p>EB sink configuration</p>
67666777
</td>
67676778
</tr>
67686779
<tr>

pkg/apis/common/integration/v1alpha1/aws.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,8 @@ type AWSSNS struct {
7474
Arn string `json:"arn,omitempty" camel:"TOPIC_NAME_OR_ARN"` // SNS ARN
7575
AutoCreateTopic bool `json:"autoCreateTopic" default:"false"` // Auto-create SNS topic
7676
}
77+
78+
type AWSEventbridge struct {
79+
AWSCommon `json:",inline"` // Embeds AWSCommon to inherit its fields in JSON
80+
Arn string `json:"arn,omitempty" camel:"EVENTBUS_NAME_OR_ARN"` // EB ARN
81+
}

pkg/apis/common/integration/v1alpha1/zz_generated.deepcopy.go

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/sinks/v1alpha1/integration_sink_types.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,11 @@ type Log struct {
7474
}
7575

7676
type Aws struct {
77-
S3 *v1alpha1.AWSS3 `json:"s3,omitempty"` // S3 sink configuration
78-
SQS *v1alpha1.AWSSQS `json:"sqs,omitempty"` // SQS sink configuration
79-
SNS *v1alpha1.AWSSNS `json:"sns,omitempty"` // SNS sink configuration
80-
Auth *v1alpha1.Auth `json:"auth,omitempty"`
77+
EVENTBRIDGE *v1alpha1.AWSEventbridge `json:"eventbridge,omitempty"` // EB sink configuration
78+
S3 *v1alpha1.AWSS3 `json:"s3,omitempty"` // S3 sink configuration
79+
SQS *v1alpha1.AWSSQS `json:"sqs,omitempty"` // SQS sink configuration
80+
SNS *v1alpha1.AWSSNS `json:"sns,omitempty"` // SNS sink configuration
81+
Auth *v1alpha1.Auth `json:"auth,omitempty"`
8182
}
8283

8384
type IntegrationSinkStatus struct {

pkg/apis/sinks/v1alpha1/integration_sink_types_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,17 @@ func TestAWS(t *testing.T) {
9898
if sns.Region != "eu-north-1" {
9999
t.Errorf("AWSDDBStreams.Region = %v, want 'eu-north-1'", sns.Region)
100100
}
101+
102+
eb := v1alpha1.AWSEventbridge{
103+
AWSCommon: v1alpha1.AWSCommon{
104+
Region: "eu-north-1",
105+
},
106+
Arn: "example-event-bus",
107+
}
108+
109+
if eb.Region != "eu-north-1" {
110+
t.Errorf("AWSEventbridge.Region = %v, want 'eu-north-1'", sns.Region)
111+
}
101112
}
102113

103114
// TestAuthFieldAccess tests the HasAuth method and field access in Auth struct

pkg/apis/sinks/v1alpha1/integration_sink_validation.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ func (spec *IntegrationSinkSpec) Validate(ctx context.Context) *apis.FieldError
4545
if spec.Aws.SNS != nil {
4646
sinkSetCount++
4747
}
48+
if spec.Aws.EVENTBRIDGE != nil {
49+
sinkSetCount++
50+
}
4851
}
4952

5053
// Validate that only one sink field is set
@@ -56,7 +59,7 @@ func (spec *IntegrationSinkSpec) Validate(ctx context.Context) *apis.FieldError
5659

5760
// Only perform AWS-specific validation if exactly one AWS sink is configured
5861
if sinkSetCount == 1 && spec.Aws != nil {
59-
if spec.Aws.S3 != nil || spec.Aws.SQS != nil || spec.Aws.SNS != nil {
62+
if spec.Aws.S3 != nil || spec.Aws.SQS != nil || spec.Aws.SNS != nil || spec.Aws.EVENTBRIDGE != nil {
6063
// Check that AWS Auth is properly configured
6164
if !spec.Aws.Auth.HasAuth() {
6265
errs = errs.Also(apis.ErrMissingField("aws.auth.secret.ref.name"))
@@ -91,6 +94,15 @@ func (spec *IntegrationSinkSpec) Validate(ctx context.Context) *apis.FieldError
9194
errs = errs.Also(apis.ErrMissingField("aws.sns.region"))
9295
}
9396
}
97+
// Additional validation for AWS Eventbridge required fields
98+
if spec.Aws.EVENTBRIDGE != nil {
99+
if spec.Aws.EVENTBRIDGE.Arn == "" {
100+
errs = errs.Also(apis.ErrMissingField("aws.eventbridge.arn"))
101+
}
102+
if spec.Aws.EVENTBRIDGE.Region == "" {
103+
errs = errs.Also(apis.ErrMissingField("aws.eventbridge.region"))
104+
}
105+
}
94106
}
95107

96108
return errs

pkg/apis/sinks/v1alpha1/integration_sink_validation_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,26 @@ func TestIntegrationSinkSpecValidation(t *testing.T) {
169169
},
170170
want: apis.ErrMissingField("aws.sns.arn"),
171171
},
172+
{
173+
name: "AWS Eventbridge sink without TopicNameOrArn (invalid)",
174+
spec: IntegrationSinkSpec{
175+
Aws: &Aws{
176+
EVENTBRIDGE: &v1alpha1.AWSEventbridge{
177+
AWSCommon: v1alpha1.AWSCommon{
178+
Region: "us-east-1",
179+
},
180+
},
181+
Auth: &v1alpha1.Auth{
182+
Secret: &v1alpha1.Secret{
183+
Ref: &v1alpha1.SecretReference{
184+
Name: "aws-secret",
185+
},
186+
},
187+
},
188+
},
189+
},
190+
want: apis.ErrMissingField("aws.eventbridge.arn"),
191+
},
172192
{
173193
name: "no sink type specified (invalid)",
174194
spec: IntegrationSinkSpec{},
@@ -206,6 +226,24 @@ func TestIntegrationSinkSpecValidation(t *testing.T) {
206226
},
207227
want: apis.ErrMissingField("aws.s3.region"),
208228
},
229+
{
230+
name: "AWS Eventbridge sink without region (invalid)",
231+
spec: IntegrationSinkSpec{
232+
Aws: &Aws{
233+
EVENTBRIDGE: &v1alpha1.AWSEventbridge{
234+
Arn: "example-bus",
235+
},
236+
Auth: &v1alpha1.Auth{
237+
Secret: &v1alpha1.Secret{
238+
Ref: &v1alpha1.SecretReference{
239+
Name: "aws-secret",
240+
},
241+
},
242+
},
243+
},
244+
},
245+
want: apis.ErrMissingField("aws.eventbridge.region"),
246+
},
209247
}
210248

211249
for _, test := range tests {

pkg/apis/sinks/v1alpha1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)