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

Sort conditions #1663

Merged
merged 7 commits into from
Jul 27, 2018
Merged

Sort conditions #1663

merged 7 commits into from
Jul 27, 2018

Conversation

mattmoor
Copy link
Member

Add sorting to our Conditions, and make equality.Semantic ignore their LastTransitionTime fields.

This change enables us to elide status updates when a Reconcile() would only change the timestamp (and trigger another reconcile, potentially triggering an endless cycle).

@google-prow-robot google-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 24, 2018
@google-prow-robot google-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 24, 2018
@mattmoor
Copy link
Member Author

cc @josephburnett @tcnghia

@google-prow-robot google-prow-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 24, 2018
@google-prow-robot google-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 24, 2018
@google-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattmoor

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

mattmoor added 6 commits July 25, 2018 23:14
This is so that the order of Conditions is stable and predictable.
This changes the type of LastTransitionTime fields to use a new VolatileTime type that is ignored by `equality.Semantic.DeepEqual`.

This enables us to elide status updates that only update LastTransitionTime.
@mattmoor
Copy link
Member Author

/test pull-knative-serving-integration-tests

@@ -95,7 +115,7 @@ type ConfigurationCondition struct {
Status corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"`

// +optional
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"`
LastTransitionTime VolatileTime `json:"lastTransitionTime,omitempty" description:"last time the condition transit from one status to another"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Add some comment explaining why we choose VolatileTime vs metav1.Time ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@knative-metrics-robot
Copy link

The following is the coverage report on pkg/.
Say /test pull-knative-serving-go-coverage to run the coverage report again

File Old Coverage New Coverage Delta
pkg/apis/serving/v1alpha1/service_types.go 98.4% 98.5% 0.1
pkg/apis/serving/v1alpha1/configuration_types.go 95.8% 96.2% 0.3
pkg/apis/serving/v1alpha1/volatile_time.go Do not exist 50.0%
pkg/apis/serving/v1alpha1/revision_types.go 98.5% 98.6% 0.1
pkg/apis/serving/v1alpha1/route_types.go 94.9% 95.2% 0.3

@tcnghia
Copy link
Contributor

tcnghia commented Jul 27, 2018

/lgtm

@google-prow-robot google-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 27, 2018
@google-prow-robot google-prow-robot merged commit fed3bc3 into knative:master Jul 27, 2018
mattmoor added a commit to mattmoor/serving that referenced this pull request Jul 27, 2018
* Add sorting of the Service conditions.

This is so that the order of Conditions is stable and predictable.

* Add sorting of the Route conditions.

* Add sorting of the Configuration conditions.

* Add sorting of the Revision conditions.

* Create a new VolatileTime type to wrap metav1.Time.

This changes the type of LastTransitionTime fields to use a new VolatileTime type that is ignored by `equality.Semantic.DeepEqual`.

This enables us to elide status updates that only update LastTransitionTime.

* Make RevisionStatus use RevisionConditionSlice.

* Update codegen.
ZhiminXiang pushed a commit to ZhiminXiang/serving-1 that referenced this pull request Aug 2, 2018
* Add sorting of the Service conditions.

This is so that the order of Conditions is stable and predictable.

* Add sorting of the Route conditions.

* Add sorting of the Configuration conditions.

* Add sorting of the Revision conditions.

* Create a new VolatileTime type to wrap metav1.Time.

This changes the type of LastTransitionTime fields to use a new VolatileTime type that is ignored by `equality.Semantic.DeepEqual`.

This enables us to elide status updates that only update LastTransitionTime.

* Make RevisionStatus use RevisionConditionSlice.

* Update codegen.
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. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants