Skip to content

Commit b6fd865

Browse files
committed
Updates, latest conflicts and formatting
Clean ups Adding tests for reconciler Signed-off-by: Matthias Wessendorf <[email protected]>
1 parent 22be4dd commit b6fd865

File tree

24 files changed

+485
-236
lines changed

24 files changed

+485
-236
lines changed

docs/eventing-api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6354,7 +6354,7 @@ JobSinkStatus
63546354
<td>
63556355
<code>s3</code><br/>
63566356
<em>
6357-
knative.dev/eventing/pkg/apis/common.AWSS3
6357+
knative.dev/eventing/pkg/apis/common/integration/v1alpha1.AWSS3
63586358
</em>
63596359
</td>
63606360
<td>
@@ -6364,7 +6364,7 @@ knative.dev/eventing/pkg/apis/common.AWSS3
63646364
<td>
63656365
<code>sqs</code><br/>
63666366
<em>
6367-
knative.dev/eventing/pkg/apis/common.AWSSQS
6367+
knative.dev/eventing/pkg/apis/common/integration/v1alpha1.AWSSQS
63686368
</em>
63696369
</td>
63706370
<td>
@@ -6375,7 +6375,7 @@ knative.dev/eventing/pkg/apis/common.AWSSQS
63756375
<td>
63766376
<code>auth</code><br/>
63776377
<em>
6378-
knative.dev/eventing/pkg/apis/common.Auth
6378+
knative.dev/eventing/pkg/apis/common/integration/v1alpha1.Auth
63796379
</em>
63806380
</td>
63816381
<td>

pkg/apis/sinks/v1alpha1/integration_sink_defaults_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ package v1alpha1
1818

1919
import (
2020
"context"
21-
"github.com/google/go-cmp/cmp"
2221
"testing"
22+
23+
"github.com/google/go-cmp/cmp"
2324
)
2425

2526
func TestIntegrationSinkSetDefaults(t *testing.T) {

pkg/apis/sinks/v1alpha1/integration_sink_lifecycle.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (s *IntegrationSinkStatus) MarkEventPoliciesTrueWithReason(reason, messageF
9393
IntegrationSinkCondSet.Manage(s).MarkTrueWithReason(IntegrationSinkConditionEventPoliciesReady, reason, messageFormat, messageA...)
9494
}
9595

96-
func (s *IntegrationSinkStatus) PropagateDeploymentAvailability(d *appsv1.DeploymentStatus) {
96+
func (s *IntegrationSinkStatus) PropagateDeploymentStatus(d *appsv1.DeploymentStatus) {
9797
deploymentAvailableFound := false
9898
for _, cond := range d.Conditions {
9999
if cond.Type == appsv1.DeploymentAvailable {

pkg/apis/sinks/v1alpha1/integration_sink_lifecycle_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ limitations under the License.
1717
package v1alpha1
1818

1919
import (
20+
"testing"
21+
2022
"github.com/google/go-cmp/cmp"
2123
corev1 "k8s.io/api/core/v1"
2224
"knative.dev/pkg/apis"
2325
duckv1 "knative.dev/pkg/apis/duck/v1"
24-
"testing"
2526
)
2627

2728
func TestIntegrationSinkGetConditionSet(t *testing.T) {
@@ -45,6 +46,9 @@ func TestIntegrationSinkInitializeConditions(t *testing.T) {
4546
Conditions: []apis.Condition{{
4647
Type: IntegrationSinkConditionAddressable,
4748
Status: corev1.ConditionUnknown,
49+
}, {
50+
Type: IntegrationSinkConditionDeploymentReady,
51+
Status: corev1.ConditionUnknown,
4852
}, {
4953
Type: IntegrationSinkConditionEventPoliciesReady,
5054
Status: corev1.ConditionUnknown,
@@ -69,6 +73,9 @@ func TestIntegrationSinkInitializeConditions(t *testing.T) {
6973
Conditions: []apis.Condition{{
7074
Type: IntegrationSinkConditionAddressable,
7175
Status: corev1.ConditionFalse,
76+
}, {
77+
Type: IntegrationSinkConditionDeploymentReady,
78+
Status: corev1.ConditionUnknown,
7279
}, {
7380
Type: IntegrationSinkConditionEventPoliciesReady,
7481
Status: corev1.ConditionUnknown,
@@ -93,6 +100,9 @@ func TestIntegrationSinkInitializeConditions(t *testing.T) {
93100
Conditions: []apis.Condition{{
94101
Type: IntegrationSinkConditionAddressable,
95102
Status: corev1.ConditionTrue,
103+
}, {
104+
Type: IntegrationSinkConditionDeploymentReady,
105+
Status: corev1.ConditionUnknown,
96106
}, {
97107
Type: IntegrationSinkConditionEventPoliciesReady,
98108
Status: corev1.ConditionUnknown,

pkg/apis/sinks/v1alpha1/integration_sink_types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
"k8s.io/apimachinery/pkg/runtime"
2222
"k8s.io/apimachinery/pkg/runtime/schema"
23-
"knative.dev/eventing/pkg/apis/common"
23+
"knative.dev/eventing/pkg/apis/common/integration/v1alpha1"
2424
eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1"
2525
"knative.dev/pkg/apis"
2626
duckv1 "knative.dev/pkg/apis/duck/v1"
@@ -74,9 +74,9 @@ type Log struct {
7474
}
7575

7676
type Aws struct {
77-
S3 *common.AWSS3 `json:"s3,omitempty"` // S3 source configuration
78-
SQS *common.AWSSQS `json:"sqs,omitempty"` // SQS source configuration
79-
Auth *common.Auth `json:"auth,omitempty"`
77+
S3 *v1alpha1.AWSS3 `json:"s3,omitempty"` // S3 source configuration
78+
SQS *v1alpha1.AWSSQS `json:"sqs,omitempty"` // SQS source configuration
79+
Auth *v1alpha1.Auth `json:"auth,omitempty"`
8080
}
8181

8282
type IntegrationSinkStatus struct {

pkg/apis/sinks/v1alpha1/integration_sink_types_test.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ limitations under the License.
1717
package v1alpha1
1818

1919
import (
20-
"knative.dev/eventing/pkg/apis/common"
2120
"testing"
21+
22+
"knative.dev/eventing/pkg/apis/common/integration/v1alpha1"
2223
)
2324

2425
func TestIntegrationSink_GetStatus(t *testing.T) {
@@ -54,30 +55,30 @@ func TestLog(t *testing.T) {
5455
}
5556

5657
func TestAWS(t *testing.T) {
57-
s3 := common.AWSS3{
58-
AWSCommon: common.AWSCommon{
58+
s3 := v1alpha1.AWSS3{
59+
AWSCommon: v1alpha1.AWSCommon{
5960
Region: "eu-north-1",
6061
},
61-
BucketNameOrArn: "example-bucket",
62+
Arn: "example-bucket",
6263
}
6364

6465
if s3.Region != "eu-north-1" {
6566
t.Errorf("AWSS3.Region = %v, want 'eu-north-1'", s3.Region)
6667
}
6768

68-
sqs := common.AWSSQS{
69-
AWSCommon: common.AWSCommon{
69+
sqs := v1alpha1.AWSSQS{
70+
AWSCommon: v1alpha1.AWSCommon{
7071
Region: "eu-north-1",
7172
},
72-
QueueNameOrArn: "example-queue",
73+
Arn: "example-queue",
7374
}
7475

7576
if sqs.Region != "eu-north-1" {
7677
t.Errorf("AWSSQS.Region = %v, want 'eu-north-1'", sqs.Region)
7778
}
7879

79-
ddbStreams := common.AWSDDBStreams{
80-
AWSCommon: common.AWSCommon{
80+
ddbStreams := v1alpha1.AWSDDBStreams{
81+
AWSCommon: v1alpha1.AWSCommon{
8182
Region: "eu-north-1",
8283
},
8384
Table: "example-table",
@@ -90,9 +91,9 @@ func TestAWS(t *testing.T) {
9091

9192
// TestAuthFieldAccess tests the HasAuth method and field access in Auth struct
9293
func TestAuthFieldAccess(t *testing.T) {
93-
auth := common.Auth{
94-
Secret: &common.Secret{
95-
Ref: &common.SecretReference{
94+
auth := v1alpha1.Auth{
95+
Secret: &v1alpha1.Secret{
96+
Ref: &v1alpha1.SecretReference{
9697
Name: "aws-secret",
9798
},
9899
},

pkg/apis/sinks/v1alpha1/integration_sink_validation.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package v1alpha1
1818

1919
import (
2020
"context"
21+
2122
"knative.dev/pkg/apis"
2223
)
2324

@@ -61,7 +62,7 @@ func (spec *IntegrationSinkSpec) Validate(ctx context.Context) *apis.FieldError
6162

6263
// Additional validation for AWS S3 required fields
6364
if spec.Aws.S3 != nil {
64-
if spec.Aws.S3.BucketNameOrArn == "" {
65+
if spec.Aws.S3.Arn == "" {
6566
errs = errs.Also(apis.ErrMissingField("aws.s3.bucketNameOrArn"))
6667
}
6768
if spec.Aws.S3.Region == "" {
@@ -71,7 +72,7 @@ func (spec *IntegrationSinkSpec) Validate(ctx context.Context) *apis.FieldError
7172

7273
// Additional validation for AWS SQS required fields
7374
if spec.Aws.SQS != nil {
74-
if spec.Aws.SQS.QueueNameOrArn == "" {
75+
if spec.Aws.SQS.Arn == "" {
7576
errs = errs.Also(apis.ErrMissingField("aws.sqs.queueNameOrArn"))
7677
}
7778
if spec.Aws.SQS.Region == "" {

pkg/apis/sinks/v1alpha1/integration_sink_validation_test.go

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ package v1alpha1
1818

1919
import (
2020
"context"
21-
"knative.dev/eventing/pkg/apis/common"
2221
"testing"
2322

23+
"knative.dev/eventing/pkg/apis/common/integration/v1alpha1"
24+
2425
"github.com/google/go-cmp/cmp"
2526
"knative.dev/pkg/apis"
2627
)
@@ -45,15 +46,15 @@ func TestIntegrationSinkSpecValidation(t *testing.T) {
4546
name: "valid AWS S3 sink with auth and region",
4647
spec: IntegrationSinkSpec{
4748
Aws: &Aws{
48-
S3: &common.AWSS3{
49-
AWSCommon: common.AWSCommon{
49+
S3: &v1alpha1.AWSS3{
50+
AWSCommon: v1alpha1.AWSCommon{
5051
Region: "us-east-1",
5152
},
52-
BucketNameOrArn: "example-bucket",
53+
Arn: "example-bucket",
5354
},
54-
Auth: &common.Auth{
55-
Secret: &common.Secret{
56-
Ref: &common.SecretReference{
55+
Auth: &v1alpha1.Auth{
56+
Secret: &v1alpha1.Secret{
57+
Ref: &v1alpha1.SecretReference{
5758
Name: "aws-secret",
5859
},
5960
},
@@ -66,15 +67,15 @@ func TestIntegrationSinkSpecValidation(t *testing.T) {
6667
name: "valid AWS SQS sink with auth and region",
6768
spec: IntegrationSinkSpec{
6869
Aws: &Aws{
69-
SQS: &common.AWSSQS{
70-
AWSCommon: common.AWSCommon{
70+
SQS: &v1alpha1.AWSSQS{
71+
AWSCommon: v1alpha1.AWSCommon{
7172
Region: "us-east-1",
7273
},
73-
QueueNameOrArn: "example-queue",
74+
Arn: "example-queue",
7475
},
75-
Auth: &common.Auth{
76-
Secret: &common.Secret{
77-
Ref: &common.SecretReference{
76+
Auth: &v1alpha1.Auth{
77+
Secret: &v1alpha1.Secret{
78+
Ref: &v1alpha1.SecretReference{
7879
Name: "aws-secret",
7980
},
8081
},
@@ -91,11 +92,11 @@ func TestIntegrationSinkSpecValidation(t *testing.T) {
9192
ShowHeaders: true,
9293
},
9394
Aws: &Aws{
94-
S3: &common.AWSS3{
95-
AWSCommon: common.AWSCommon{
95+
S3: &v1alpha1.AWSS3{
96+
AWSCommon: v1alpha1.AWSCommon{
9697
Region: "us-east-1",
9798
},
98-
BucketNameOrArn: "example-bucket",
99+
Arn: "example-bucket",
99100
},
100101
},
101102
},
@@ -105,21 +106,21 @@ func TestIntegrationSinkSpecValidation(t *testing.T) {
105106
name: "multiple AWS sinks set (invalid)",
106107
spec: IntegrationSinkSpec{
107108
Aws: &Aws{
108-
S3: &common.AWSS3{
109-
AWSCommon: common.AWSCommon{
109+
S3: &v1alpha1.AWSS3{
110+
AWSCommon: v1alpha1.AWSCommon{
110111
Region: "us-east-1",
111112
},
112-
BucketNameOrArn: "example-bucket",
113+
Arn: "example-bucket",
113114
},
114-
SQS: &common.AWSSQS{
115-
AWSCommon: common.AWSCommon{
115+
SQS: &v1alpha1.AWSSQS{
116+
AWSCommon: v1alpha1.AWSCommon{
116117
Region: "us-east-1",
117118
},
118-
QueueNameOrArn: "example-queue",
119+
Arn: "example-queue",
119120
},
120-
Auth: &common.Auth{
121-
Secret: &common.Secret{
122-
Ref: &common.SecretReference{
121+
Auth: &v1alpha1.Auth{
122+
Secret: &v1alpha1.Secret{
123+
Ref: &v1alpha1.SecretReference{
123124
Name: "aws-secret",
124125
},
125126
},
@@ -132,14 +133,14 @@ func TestIntegrationSinkSpecValidation(t *testing.T) {
132133
name: "AWS SQS sink without QueueNameOrArn (invalid)",
133134
spec: IntegrationSinkSpec{
134135
Aws: &Aws{
135-
SQS: &common.AWSSQS{
136-
AWSCommon: common.AWSCommon{
136+
SQS: &v1alpha1.AWSSQS{
137+
AWSCommon: v1alpha1.AWSCommon{
137138
Region: "us-east-1",
138139
},
139140
},
140-
Auth: &common.Auth{
141-
Secret: &common.Secret{
142-
Ref: &common.SecretReference{
141+
Auth: &v1alpha1.Auth{
142+
Secret: &v1alpha1.Secret{
143+
Ref: &v1alpha1.SecretReference{
143144
Name: "aws-secret",
144145
},
145146
},
@@ -157,11 +158,11 @@ func TestIntegrationSinkSpecValidation(t *testing.T) {
157158
name: "AWS sink without auth (invalid)",
158159
spec: IntegrationSinkSpec{
159160
Aws: &Aws{
160-
S3: &common.AWSS3{
161-
AWSCommon: common.AWSCommon{
161+
S3: &v1alpha1.AWSS3{
162+
AWSCommon: v1alpha1.AWSCommon{
162163
Region: "us-east-1",
163164
},
164-
BucketNameOrArn: "example-bucket",
165+
Arn: "example-bucket",
165166
},
166167
},
167168
},
@@ -171,12 +172,12 @@ func TestIntegrationSinkSpecValidation(t *testing.T) {
171172
name: "AWS S3 sink without region (invalid)",
172173
spec: IntegrationSinkSpec{
173174
Aws: &Aws{
174-
S3: &common.AWSS3{
175-
BucketNameOrArn: "example-bucket",
175+
S3: &v1alpha1.AWSS3{
176+
Arn: "example-bucket",
176177
},
177-
Auth: &common.Auth{
178-
Secret: &common.Secret{
179-
Ref: &common.SecretReference{
178+
Auth: &v1alpha1.Auth{
179+
Secret: &v1alpha1.Secret{
180+
Ref: &v1alpha1.SecretReference{
180181
Name: "aws-secret",
181182
},
182183
},

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

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

pkg/reconciler/inmemorychannel/controller/resources/service.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ func ExternalService(namespace, service string) K8sServiceOption {
5252
}
5353

5454
// NewK8sService creates a new Service for a Channel resource. It also sets the appropriate
55-
5655
// OwnerReferences on the resource so handleObject can discover the Channel resource that 'owns' it.
5756
// As well as being garbage collected when the Channel is deleted.
5857
func NewK8sService(imc *v1.InMemoryChannel, opts ...K8sServiceOption) (*corev1.Service, error) {

0 commit comments

Comments
 (0)