Skip to content

Commit

Permalink
Make changes on the Work object status API
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelawyu committed Nov 15, 2024
1 parent 85ab438 commit 23065f8
Show file tree
Hide file tree
Showing 7 changed files with 281 additions and 119 deletions.
2 changes: 1 addition & 1 deletion apis/cluster/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions apis/placement/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

87 changes: 75 additions & 12 deletions apis/placement/v1beta1/work_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,73 @@ type WorkResourceIdentifier struct {
Name string `json:"name,omitempty"`
}

// DriftDetails describes the observed configuration drifts.
type DriftDetails struct {
// ObservationTime is the timestamp when the drift was last detected.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:Type=string
// +kubebuilder:validation:Format=date-time
ObservationTime metav1.Time `json:"observationTime"`

// ObservedInMemberClusterGeneration is the generation of the applied manifest on the member
// cluster side.
//
// +kubebuilder:validation:Required
ObservedInMemberClusterGeneration int64 `json:"observedInMemberClusterGeneration"`

// FirsftDriftedObservedTime is the timestamp when the drift was first detected.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:Type=string
// +kubebuilder:validation:Format=date-time
FirstDriftedObservedTime metav1.Time `json:"firstDriftedObservedTime"`

// ObservedDrifts describes each drifted field found from the applied manifest.
// Fleet might truncate the details as appropriate to control object size.
//
// Each entry specifies how the live state (the state on the member cluster side) compares
// against the desired state (the state kept in the hub cluster manifest).
//
// +kubebuilder:validation:Optional
ObservedDrifts []PatchDetail `json:"observedDrifts,omitempty"`
}

// DiffDetails describes the observed configuration differences.
type DiffDetails struct {
// ObservationTime is the timestamp when the configuration difference was last detected.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:Type=string
// +kubebuilder:validation:Format=date-time
ObservationTime metav1.Time `json:"observationTime"`

// ObservedInMemberClusterGeneration is the generation of the applied manifest on the member
// cluster side.
//
// +kubebuilder:validation:Required
ObservedInMemberClusterGeneration int64 `json:"observedInMemberClusterGeneration"`

// FirsftDiffedObservedTime is the timestamp when the configuration difference
// was first detected.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:Type=string
// +kubebuilder:validation:Format=date-time
FirstDiffedObservedTime metav1.Time `json:"firstDiffedObservedTime"`

// ObservedDiffs describes each field with configuration difference as found from the
// member cluster side.
//
// Fleet might truncate the details as appropriate to control object size.
//
// Each entry specifies how the live state (the state on the member cluster side) compares
// against the desired state (the state kept in the hub cluster manifest).
//
// +kubebuilder:validation:Optional
ObservedDiffs []PatchDetail `json:"observedDiffs,omitempty"`
}

// ManifestCondition represents the conditions of the resources deployed on
// spoke cluster.
type ManifestCondition struct {
Expand All @@ -124,31 +191,27 @@ type ManifestCondition struct {
// +required
Conditions []metav1.Condition `json:"conditions"`

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

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

// +genclient
Expand Down
62 changes: 53 additions & 9 deletions apis/placement/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 23065f8

Please sign in to comment.