Skip to content

Trigger status depends on importer status#1849

Merged
knative-prow-robot merged 5 commits into
knative:masterfrom
capri-xiyue:issue_1734
Sep 16, 2019
Merged

Trigger status depends on importer status#1849
knative-prow-robot merged 5 commits into
knative:masterfrom
capri-xiyue:issue_1734

Conversation

@capri-xiyue
Copy link
Copy Markdown
Contributor

@capri-xiyue capri-xiyue commented Sep 9, 2019

Fixes #1734

Proposed Changes

  • Implemented the feature, trigger status depends on importer status

Release Note

@knative-prow-robot knative-prow-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 9, 2019
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Sep 9, 2019
@knative-prow-robot knative-prow-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 9, 2019
@capri-xiyue
Copy link
Copy Markdown
Contributor Author

/assign @grantr

Copy link
Copy Markdown
Contributor

@grantr grantr left a comment

Choose a reason for hiding this comment

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

Yay! 😄

Comment thread pkg/reconciler/trigger/trigger.go Outdated
@capri-xiyue
Copy link
Copy Markdown
Contributor Author

/test pull-knative-eventing-integration-tests

@knative-prow-robot
Copy link
Copy Markdown
Contributor

@capri-xiyue: GitHub didn't allow me to assign the following users: adamharwayne.

Note that only knative members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

Details

In response to this:

/assign @adamharwayne

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow-robot
Copy link
Copy Markdown
Contributor

@capri-xiyue: GitHub didn't allow me to assign the following users: adamharwayne.

Note that only knative members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

Details

In response to this:

/assign @adamharwayne

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@capri-xiyue
Copy link
Copy Markdown
Contributor Author

I differentiate the status "False" and "Unknown" by following this doc https://github.com/knative/serving/blob/master/docs/spec/errors.md

  • Unknown when the controller is actively working to achieve the condition.
  • False when the reconciliation has failed. This should be a terminal failure state until user action occurs.
    However, when Trigger try to reconcile broker and subscription, it doesn't follow these rules. For example, when the broker doesn't exist, we mark the broker status as False. Should we create another issue to fix this? @grantr

@capri-xiyue
Copy link
Copy Markdown
Contributor Author

I'm wondering whether we have any restrictions of using third party libraries? I used https://github.com/hashicorp/go-multierror to handle multi error. @grantr

@grantr
Copy link
Copy Markdown
Contributor

grantr commented Sep 9, 2019

However, when Trigger try to reconcile broker and subscription, it doesn't follow these rules. For example, when the broker doesn't exist, we mark the broker status as False. Should we create another issue to fix this? @grantr

This sounds like a bug, so yes please create an issue about this @capri-xiyue!

Copy link
Copy Markdown
Contributor

@grantr grantr left a comment

Choose a reason for hiding this comment

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

I'm excited to see this go in! Thanks @capri-xiyue.

After finishing the review, I think I favor validating the format of the annotation in the webhook, not the reconciler. That simplifies the reconciler since there are fewer error states to worry about. Let me know if you need help getting started with this.

General question: Should a failure to reconcile the dependency's status due to a non-terminal error (like the object doesn't exist, or doesn't have a status) immediately return a reconcile error? The effect of returning immediately is that the Trigger's data plane configuration is never created. I think this might cause data loss. For example:

  1. Importer created along with Trigger.
  2. Importer isn't ready. Trigger reconcile returns before creating a Subscription.
  3. Importer is ready and starts sending events.
  4. Trigger reconcile creates a Subscription.

Between step 3 and 4, any events sent by the importer will be lost. I think it would be a better experience for the user if we continue reconciling the trigger even if the dependency isn't ready.

What do you think @capri-xiyue?

Comment thread config/200-source-resolvers-clusterrole.yaml
Comment thread config/200-source-resolvers-clusterrole.yaml
Comment thread pkg/apis/eventing/v1alpha1/trigger_lifecycle.go
Comment thread pkg/reconciler/trigger/trigger.go Outdated
Comment thread pkg/reconciler/trigger/trigger.go Outdated
Comment thread pkg/reconciler/trigger/trigger.go Outdated
Comment thread pkg/reconciler/trigger/trigger.go Outdated
Comment thread pkg/reconciler/trigger/trigger.go Outdated
Comment thread pkg/reconciler/trigger/trigger.go Outdated
Comment thread pkg/reconciler/trigger/trigger.go Outdated
Co-Authored-By: mattmoor-sockpuppet <mattmoor+sockpuppet@google.com>
@capri-xiyue
Copy link
Copy Markdown
Contributor Author

capri-xiyue commented Sep 11, 2019

I'm excited to see this go in! Thanks @capri-xiyue.

After finishing the review, I think I favor validating the format of the annotation in the webhook, not the reconciler. That simplifies the reconciler since there are fewer error states to worry about. Let me know if you need help getting started with this.

General question: Should a failure to reconcile the dependency's status due to a non-terminal error (like the object doesn't exist, or doesn't have a status) immediately return a reconcile error? The effect of returning immediately is that the Trigger's data plane configuration is never created. I think this might cause data loss. For example:

  1. Importer created along with Trigger.
  2. Importer isn't ready. Trigger reconcile returns before creating a Subscription.
  3. Importer is ready and starts sending events.
  4. Trigger reconcile creates a Subscription.

Between step 3 and 4, any events sent by the importer will be lost. I think it would be a better experience for the user if we continue reconciling the trigger even if the dependency isn't ready.

What do you think @capri-xiyue?

Discussed offline with @grantr. When trigger is not ready, user won't have the expectation that they will receive events from trigger, so data loss should not be a problem. But it's good to have trigger reconciled ASAP. So it's better to allow trigger to keep reconciling other dependent resources even when it encounters problems when trying to reconcile some dependent resources. But it should return all errors together in the end and mark reconcile failed. Otherwise, when user try to kubectl describe trigger, it's quite confusing to find "trigger reconciled" logging but trigger status is still not ready.
For this PR, I will try to reconcile dependency annotation after we reconcile broker and subscription. And I will create another issue which will figure out whether it's necessary and possible to allow trigger to keep reconciling other dependent resources even when it encounters problems when trying to reconcile some dependent resources. And it should also return all errors together in the end and mark reconcile failed.(Kind of like apis.FieldError usage when doing validation, for example pkg/apis/eventing/v1alpha1/trigger_validation.go)

Copy link
Copy Markdown
Contributor

@Harwayne Harwayne left a comment

Choose a reason for hiding this comment

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

Overall looks really good. I think all the logic is mostly correct, just lots of minor comments.

Comment thread config/200-source-resolvers-clusterrole.yaml Outdated
- apiGroups:
- "sources.eventing.knative.dev"
resources:
- "cronjobsources"
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.

Do we need the status subresource as well? E.g.

- cronjobsources
- cronjobsources/status
- containersources
- containersources/status
- apiserversources
- apiserversources/status

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.

I think no, because we never write the status.

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.

Makes sense. Probably worth giving this feedback on #1856, which says they must include the status subresources.

Comment thread config/200-source-resolvers-clusterrole.yaml
- "pubsub.cloud.run"
- "events.cloud.run"
resources:
- "pullsubscriptions"
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.

Same question about status subresources.

Copy link
Copy Markdown
Contributor Author

@capri-xiyue capri-xiyue Sep 13, 2019

Choose a reason for hiding this comment

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

We don't need to update status. Do we need the status subresources? I did manual testing. It works even without permission of status subresources.

Comment thread pkg/apis/eventing/v1alpha1/trigger_types.go
Comment thread pkg/reconciler/trigger/trigger.go Outdated
Comment thread pkg/reconciler/trigger/trigger.go Outdated
Comment thread pkg/reconciler/trigger/trigger.go Outdated
Comment thread pkg/reconciler/trigger/trigger.go Outdated
Comment thread pkg/reconciler/trigger/trigger.go Outdated
@capri-xiyue capri-xiyue changed the title [WIP]Trigger status depends on importer status Trigger status depends on importer status Sep 13, 2019
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 13, 2019
@capri-xiyue
Copy link
Copy Markdown
Contributor Author

@grantr @Harwayne , I've pushed new changes. It's ready for another round of code review.

Comment thread pkg/apis/eventing/v1alpha1/trigger_validation.go Outdated
Comment thread pkg/apis/eventing/v1alpha1/trigger_validation.go Outdated
Comment thread pkg/apis/eventing/v1alpha1/trigger_validation.go Outdated
Comment thread pkg/apis/eventing/v1alpha1/trigger_types.go Outdated
Comment thread pkg/reconciler/trigger/trigger.go Outdated
Comment thread pkg/apis/eventing/v1alpha1/trigger_lifecycle.go
@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/apis/eventing/v1alpha1/trigger_lifecycle.go 100.0% 71.4% -28.6
pkg/apis/eventing/v1alpha1/trigger_validation.go 97.6% 98.5% 0.9
pkg/reconciler/trigger/trigger.go 86.2% 84.8% -1.4

Copy link
Copy Markdown
Contributor

@grantr grantr left a comment

Choose a reason for hiding this comment

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

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: capri-xiyue, grantr

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 Sep 16, 2019
@knative-prow-robot knative-prow-robot merged commit b8e91d3 into knative:master Sep 16, 2019
matzew added a commit to matzew/eventing that referenced this pull request Sep 7, 2022
* Patch the upstream config file to repair or reenable old behavior

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Running 'make RELEASE=v1.4 generate-release'

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Adding check for (legacy) annotations

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
dsimansk pushed a commit to dsimansk/eventing that referenced this pull request Apr 7, 2026
…ative#9012) (knative#1849)

Generate test certs dynamically instead of hardcoding them

Co-authored-by: Knative Prow Robot <automation+prow-robot@knative.team>
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow Trigger status to be dependent on importer status

7 participants