Skip to content

Commit 1893de1

Browse files
authored
Make changes on the Work object status API (#958)
1 parent 9c4a292 commit 1893de1

File tree

7 files changed

+281
-119
lines changed

7 files changed

+281
-119
lines changed

apis/cluster/v1beta1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/placement/v1alpha1/zz_generated.deepcopy.go

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/placement/v1beta1/work_types.go

Lines changed: 75 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,73 @@ type WorkResourceIdentifier struct {
113113
Name string `json:"name,omitempty"`
114114
}
115115

116+
// DriftDetails describes the observed configuration drifts.
117+
type DriftDetails struct {
118+
// ObservationTime is the timestamp when the drift was last detected.
119+
//
120+
// +kubebuilder:validation:Required
121+
// +kubebuilder:validation:Type=string
122+
// +kubebuilder:validation:Format=date-time
123+
ObservationTime metav1.Time `json:"observationTime"`
124+
125+
// ObservedInMemberClusterGeneration is the generation of the applied manifest on the member
126+
// cluster side.
127+
//
128+
// +kubebuilder:validation:Required
129+
ObservedInMemberClusterGeneration int64 `json:"observedInMemberClusterGeneration"`
130+
131+
// FirsftDriftedObservedTime is the timestamp when the drift was first detected.
132+
//
133+
// +kubebuilder:validation:Required
134+
// +kubebuilder:validation:Type=string
135+
// +kubebuilder:validation:Format=date-time
136+
FirstDriftedObservedTime metav1.Time `json:"firstDriftedObservedTime"`
137+
138+
// ObservedDrifts describes each drifted field found from the applied manifest.
139+
// Fleet might truncate the details as appropriate to control object size.
140+
//
141+
// Each entry specifies how the live state (the state on the member cluster side) compares
142+
// against the desired state (the state kept in the hub cluster manifest).
143+
//
144+
// +kubebuilder:validation:Optional
145+
ObservedDrifts []PatchDetail `json:"observedDrifts,omitempty"`
146+
}
147+
148+
// DiffDetails describes the observed configuration differences.
149+
type DiffDetails struct {
150+
// ObservationTime is the timestamp when the configuration difference was last detected.
151+
//
152+
// +kubebuilder:validation:Required
153+
// +kubebuilder:validation:Type=string
154+
// +kubebuilder:validation:Format=date-time
155+
ObservationTime metav1.Time `json:"observationTime"`
156+
157+
// ObservedInMemberClusterGeneration is the generation of the applied manifest on the member
158+
// cluster side.
159+
//
160+
// +kubebuilder:validation:Required
161+
ObservedInMemberClusterGeneration int64 `json:"observedInMemberClusterGeneration"`
162+
163+
// FirsftDiffedObservedTime is the timestamp when the configuration difference
164+
// was first detected.
165+
//
166+
// +kubebuilder:validation:Required
167+
// +kubebuilder:validation:Type=string
168+
// +kubebuilder:validation:Format=date-time
169+
FirstDiffedObservedTime metav1.Time `json:"firstDiffedObservedTime"`
170+
171+
// ObservedDiffs describes each field with configuration difference as found from the
172+
// member cluster side.
173+
//
174+
// Fleet might truncate the details as appropriate to control object size.
175+
//
176+
// Each entry specifies how the live state (the state on the member cluster side) compares
177+
// against the desired state (the state kept in the hub cluster manifest).
178+
//
179+
// +kubebuilder:validation:Optional
180+
ObservedDiffs []PatchDetail `json:"observedDiffs,omitempty"`
181+
}
182+
116183
// ManifestCondition represents the conditions of the resources deployed on
117184
// spoke cluster.
118185
type ManifestCondition struct {
@@ -124,31 +191,27 @@ type ManifestCondition struct {
124191
// +required
125192
Conditions []metav1.Condition `json:"conditions"`
126193

127-
// ObservedDrifts explains the details about the observed configuration drifts.
194+
// DriftDetails explains about the observed configuration drifts.
128195
// Fleet might truncate the details as appropriate to control object size.
129196
//
130-
// Each detail entry specifies how the live state (the state on the member
131-
// cluster side) compares against the desired state (the state kept in the hub cluster manifest).
132-
//
133197
// Note that configuration drifts can only occur on a resource if it is currently owned by
134198
// Fleet and its corresponding placement is set to use the ClientSideApply or ServerSideApply
135-
// apply strategy. In other words, ObservedDrifts and ObservedDiffs will not be populated
199+
// apply strategy. In other words, DriftDetails and DiffDetails will not be populated
136200
// at the same time.
201+
//
137202
// +kubebuilder:validation:Optional
138-
ObservedDrifts []PatchDetail `json:"observedDrifts,omitempty"`
203+
DriftDetails *DriftDetails `json:"driftDetails,omitempty"`
139204

140-
// ObservedDiffs explains the details about the observed configuration differences.
205+
// DiffDetails explains the details about the observed configuration differences.
141206
// Fleet might truncate the details as appropriate to control object size.
142207
//
143-
// Each detail entry specifies how the live state (the state on the member
144-
// cluster side) compares against the desired state (the state kept in the hub cluster manifest).
145-
//
146208
// Note that configuration differences can only occur on a resource if it is not currently owned
147209
// by Fleet (i.e., it is a pre-existing resource that needs to be taken over), or if its
148210
// corresponding placement is set to use the ReportDiff apply strategy. In other words,
149-
// ObservedDiffs and ObservedDrifts will not be populated at the same time.
211+
// DiffDetails and DriftDetails will not be populated at the same time.
212+
//
150213
// +kubebuilder:validation:Optional
151-
ObservedDiffs []PatchDetail `json:"observedDiffs,omitempty"`
214+
DiffDetails *DiffDetails `json:"diffDetails,omitempty"`
152215
}
153216

154217
// +genclient

apis/placement/v1beta1/zz_generated.deepcopy.go

Lines changed: 53 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)