Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groom conditions LastTransitionTime in postprocess #1403

Merged
merged 6 commits into from
Jun 18, 2020

Conversation

whaught
Copy link
Contributor

@whaught whaught commented Jun 12, 2020

Fixes #1394

  • This fixes behavior if a condition is flip/flopped in a single reconciliation
  • All changed conditions share the same time

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jun 12, 2020
@knative-prow-robot knative-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 12, 2020
// groomConditionsTransitionTime ensures that the LastTransitionTime only advances for resources
// where the condition has changed during reconciliation. This also ensures that all advanced
// conditions share the same timestamp.
func groomConditionsTransitionTime(resource, oldResource duckv1.KRShaped) {
Copy link
Member

Choose a reason for hiding this comment

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

🤔 maybe I'm misunderstanding, but iiuc the entire point of VolatileTime is to avoid what this is doing 😅

Copy link
Contributor Author

@whaught whaught Jun 16, 2020

Choose a reason for hiding this comment

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

The VolatileTime strategy has a few weaknesses I've outlined in #1394

  • Requires use of k8s specific comparison libraries
  • The snapshot of now() is taken multiple times during reconciliation, but all written back at the same time. This can make it hard to tell which conditions are changed in a single reconciliation step (although this is optional, we could update them as we go).
  • It fails to keep the LastTransitionTime stable if a single reconciliation sets conditions more than once (eg. flip-flopping but winds up in the same place).

This obviates the VolatileTime and condition manager strategy so that implementers don't really need to worry about how they are modifying the status struct - it just works.

Copy link
Member

Choose a reason for hiding this comment

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

Let me comment on the issue, but it may be worth discussing more synchronous Weds (put on the agenda for API WG?).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea let's just discuss in WG - that'll be easiest

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 17, 2020
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 18, 2020
@whaught
Copy link
Contributor Author

whaught commented Jun 18, 2020

/assign @mattmoor @vagababov

@knative-metrics-robot
Copy link

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

File Old Coverage New Coverage Delta
reconciler/reconcile_common.go 87.5% 92.3% 4.8

Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

Discussed in the API WG meeting. Let's see if we can kill VolatileTime next 🤩

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 18, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattmoor, whaught

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

The pull request process is described here

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 Jun 18, 2020
@knative-prow-robot knative-prow-robot merged commit d5043a4 into knative:master Jun 18, 2020
@mattmoor
Copy link
Member

Yeah, this breaks forward edges, so it'll have to land in a few waves downstream. Thanks @Cynocracy for doing this for networking 😍

@mattmoor
Copy link
Member

To clarify: manual changes aren't needed, but the sequencing of updates will need to follow the graph, so it'll likely take a couple applications of the automation before things are running smoothly again.

@Cynocracy
Copy link
Contributor

Cynocracy commented Jun 19, 2020 via email

@Cynocracy
Copy link
Contributor

Cynocracy commented Jun 19, 2020 via email

@whaught whaught deleted the groom-conditions branch June 23, 2020 04:11
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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move LastTransitionTime grooming to reconcile post-process
7 participants