Skip to content

Add data validation for subscription in reconciler#1100

Merged
knative-prow-robot merged 1 commit into
knative:masterfrom
shashwathi:nats
Apr 26, 2019
Merged

Add data validation for subscription in reconciler#1100
knative-prow-robot merged 1 commit into
knative:masterfrom
shashwathi:nats

Conversation

@shashwathi
Copy link
Copy Markdown
Contributor

  • Update subscription error when reply strategy does not contain address

Fixes #1081

cc @n3wscott

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Apr 25, 2019
@knative-prow-robot knative-prow-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 25, 2019

subscriberGVK = metav1.GroupVersionKind{
Group: "testing.eventing.knative.dev",
Group: "eventing.knative.dev",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is testing ducktyping for subscribers. testing. was wanted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed that because in subscriber validation there is hardcoded logic to validate API group is eventing.knative.dev

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, thanks.

subscription.Status.InitializeConditions()

if err := subscription.Validate(ctx); err != nil {
// Verify subscription is valid
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this comment to the other side of the if statement and end it with a .

return resolve.DomainToURL(s.Status.Address.Hostname), nil
}
return "", fmt.Errorf("status does not contain address")
return "", fmt.Errorf("reply.status does not contain address")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol, thanks!

WantEvents: []string{
Eventf(corev1.EventTypeWarning, "ResultResolveFailed", "Failed to resolve spec.reply: status does not contain address"),
Eventf(corev1.EventTypeWarning, "SubscriptionUpdateStatusFailed", "Failed to update Subscription's status: status does not contain address"), // TODO: BUGBUG THIS IS WEIRD
Eventf(corev1.EventTypeWarning, "SubscriptionUpdateStatusFailed", "Failed to update Subscription's status: invalid value: Subscriber: spec.reply.kind\nonly 'Channel' kind is allowed"), // TODO: BUGBUG THIS IS WEIRD
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can remove the todo at the end.

WithSubscriptionReply(subscriberGVK, replyName),
// The first reconciliation will initialize the status conditions.
WithInitSubscriptionConditions,
WithSubscriptionPhysicalSubscriptionSubscriber(subscriberURI),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting, I suppose this is because you are validating. NICE.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Fixes knative#1081

- Update subscription error when reply strategy does not contain address
@shashwathi
Copy link
Copy Markdown
Contributor Author

@n3wscott : I have addressed all your comments

@knative-metrics-robot
Copy link
Copy Markdown

The following is the coverage report on pkg/.
Say /test pull-knative-eventing-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/subscription/subscription.go Do not exist 80.3%

@n3wscott
Copy link
Copy Markdown
Contributor

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 26, 2019
@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: n3wscott, shashwathi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 26, 2019
@knative-prow-robot knative-prow-robot merged commit c4324b0 into knative:master Apr 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Subscription Reconciler bugs found while migrating.

5 participants