-
Notifications
You must be signed in to change notification settings - Fork 108
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
Add ability to expose resource reconciliation progress #633
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
Copyright 2024 The Crossplane Authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1 | ||
|
||
// ObservedStatus contains the recent reconciliation stats. | ||
type ObservedStatus struct { | ||
// ObservedGeneration is the latest metadata.generation | ||
// which resulted in either a ready state, or stalled due to error | ||
// it can not recover from without human intervention. | ||
// +optional | ||
ObservedGeneration int64 `json:"observedGeneration,omitempty"` | ||
} | ||
|
||
// SetObservedGeneration sets the generation of the main resource | ||
// during the last reconciliation. | ||
func (s *ObservedStatus) SetObservedGeneration(generation int64) { | ||
s.ObservedGeneration = generation | ||
} | ||
|
||
// GetObservedGeneration returns the last observed generation of the main resource. | ||
func (s *ObservedStatus) GetObservedGeneration() int64 { | ||
return s.ObservedGeneration | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -176,6 +176,12 @@ type ConnectionDetailsPublishedTimer interface { | |
GetConnectionDetailsLastPublishedTime() *metav1.Time | ||
} | ||
|
||
// ReconciliationObserver can track data observed by resource reconciler. | ||
type ReconciliationObserver interface { | ||
SetObservedGeneration(generation int64) | ||
GetObservedGeneration() int64 | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you expect that managed resources would also satisfy this interface, eventually? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, I was just thinking that adding |
||
|
||
// An Object is a Kubernetes object. | ||
type Object interface { | ||
metav1.Object | ||
|
@@ -245,6 +251,7 @@ type Composite interface { //nolint:interfacebloat // This interface has to be b | |
|
||
Conditioned | ||
ConnectionDetailsPublishedTimer | ||
ReconciliationObserver | ||
} | ||
|
||
// Composed resources can be a composed into a Composite resource. | ||
|
@@ -254,6 +261,7 @@ type Composed interface { | |
Conditioned | ||
ConnectionSecretWriterTo | ||
ConnectionDetailsPublisherTo | ||
ReconciliationObserver | ||
} | ||
|
||
// A CompositeClaim for a Composite resource. | ||
|
@@ -272,4 +280,5 @@ type CompositeClaim interface { //nolint:interfacebloat // This interface has to | |
|
||
Conditioned | ||
ConnectionDetailsPublishedTimer | ||
ReconciliationObserver | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub won't let me add a comment to the
existing.Equal
docstring, but it should explicitly call out that it doesn't considerObservedGeneration
when assessing equality. It already calls out that it ignores LastTransitionTime.