Skip to content

Commit

Permalink
Update DSC status with the related components status"
Browse files Browse the repository at this point in the history
This commit includes:
- exposing common components status to the DSC as part of
  status.components field
- introduce a new Ready conditions that becomes true only when all the
  components are also Ready
- reduces DSC chattering, by reducing the number of updates per
  reconcile

Signed-off-by: Luca Burgazzoli <[email protected]>
  • Loading branch information
lburgazzoli committed Dec 10, 2024
1 parent 6d836db commit fcfcba0
Show file tree
Hide file tree
Showing 81 changed files with 3,346 additions and 1,063 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ linters-settings:
- dynamic.Interface
- predicate.Predicate
- client.Object
- common.PlatformObject
revive:
rules:
- name: dot-imports
Expand Down
11 changes: 8 additions & 3 deletions apis/common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,14 @@ type ManifestsConfig struct {

// +kubebuilder:object:generate=true
type Status struct {
Phase string `json:"phase,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
Phase string `json:"phase,omitempty"`
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

type WithStatus interface {
Expand Down
13 changes: 12 additions & 1 deletion apis/components/v1alpha1/codeflare_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ const (
CodeFlareKind = "CodeFlare"
)

// CodeFlareCommonStatus defines the shared observed state of CodeFlare
type CodeFlareCommonStatus struct {
}

// CodeFlareStatus defines the observed state of CodeFlare
type CodeFlareStatus struct {
common.Status `json:",inline"`
common.Status `json:",inline"`
CodeFlareCommonStatus `json:",inline"`
}

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -86,3 +91,9 @@ type DSCCodeFlare struct {
common.ManagementSpec `json:",inline"`
CodeFlareCommonSpec `json:",inline"`
}

// DSCCodeFlareStatus contains the observed state of the CodeFlare exposed in the DSC instance
type DSCCodeFlareStatus struct {
common.ManagementSpec `json:",inline"`
*CodeFlareCommonStatus `json:",inline"`
}
16 changes: 13 additions & 3 deletions apis/components/v1alpha1/dashboard_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ type DashboardSpec struct {
// dashboard spec exposed only to internal api
}

// DashboardCommonStatus defines the shared observed state of Dashboard
type DashboardCommonStatus struct {
URL string `json:"url,omitempty"`
}

// DashboardStatus defines the observed state of Dashboard
type DashboardStatus struct {
common.Status `json:",inline"`

URL string `json:"url,omitempty"`
common.Status `json:",inline"`
DashboardCommonStatus `json:",inline"`
}

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -95,3 +99,9 @@ type DSCDashboard struct {
// dashboard specific field
DashboardCommonSpec `json:",inline"`
}

// DSCDashboardStatus contains the observed state of the Dashboard exposed in the DSC instance
type DSCDashboardStatus struct {
common.ManagementSpec `json:",inline"`
*DashboardCommonStatus `json:",inline"`
}
13 changes: 12 additions & 1 deletion apis/components/v1alpha1/datasciencepipelines_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@ type DataSciencePipelinesCommonSpec struct {
common.DevFlagsSpec `json:",inline"`
}

// DataSciencePipelinesCommonStatus defines the shared observed state of DataSciencePipelines
type DataSciencePipelinesCommonStatus struct {
}

// DataSciencePipelinesStatus defines the observed state of DataSciencePipelines
type DataSciencePipelinesStatus struct {
common.Status `json:",inline"`
common.Status `json:",inline"`
DataSciencePipelinesCommonStatus `json:",inline"`
}

func (c *DataSciencePipelines) GetDevFlags() *common.DevFlags {
Expand Down Expand Up @@ -84,3 +89,9 @@ type DSCDataSciencePipelines struct {
// datasciencepipelines specific field
DataSciencePipelinesCommonSpec `json:",inline"`
}

// DSCDataSciencePipelinesStatus contains the observed state of the DataSciencePipelines exposed in the DSC instance
type DSCDataSciencePipelinesStatus struct {
common.ManagementSpec `json:",inline"`
*DataSciencePipelinesCommonStatus `json:",inline"`
}
13 changes: 12 additions & 1 deletion apis/components/v1alpha1/kserve_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,14 @@ type KserveSpec struct {
// kserve spec exposed only to internal api
}

// KserveCommonStatus defines the shared observed state of Kserve
type KserveCommonStatus struct {
}

// KserveStatus defines the observed state of Kserve
type KserveStatus struct {
common.Status `json:",inline"`
common.Status `json:",inline"`
KserveCommonStatus `json:",inline"`
}

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -122,3 +127,9 @@ type DSCKserve struct {
// Kserve specific fields
KserveCommonSpec `json:",inline"`
}

// DSCKserveStatus contains the observed state of the Kserve exposed in the DSC instance
type DSCKserveStatus struct {
common.ManagementSpec `json:",inline"`
*KserveCommonStatus `json:",inline"`
}
13 changes: 12 additions & 1 deletion apis/components/v1alpha1/kueue_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ type KueueCommonSpec struct {
common.DevFlagsSpec `json:",inline"`
}

// KueueCommonStatus defines the shared observed state of Kueue
type KueueCommonStatus struct {
}

// KueueStatus defines the observed state of Kueue
type KueueStatus struct {
common.Status `json:",inline"`
common.Status `json:",inline"`
KueueCommonStatus `json:",inline"`
}

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -85,3 +90,9 @@ type DSCKueue struct {
// configuration fields common across components
KueueCommonSpec `json:",inline"`
}

// DSCKueueStatus contains the observed state of the Kueue exposed in the DSC instance
type DSCKueueStatus struct {
common.ManagementSpec `json:",inline"`
*KueueCommonStatus `json:",inline"`
}
13 changes: 12 additions & 1 deletion apis/components/v1alpha1/modelmeshserving_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ type ModelMeshServingCommonSpec struct {
common.DevFlagsSpec `json:",inline"`
}

// ModelMeshServingCommonStatus defines the shared observed state of ModelMeshServing
type ModelMeshServingCommonStatus struct {
}

// ModelMeshServingStatus defines the observed state of ModelMeshServing
type ModelMeshServingStatus struct {
common.Status `json:",inline"`
common.Status `json:",inline"`
ModelMeshServingCommonStatus `json:",inline"`
}

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -85,3 +90,9 @@ type DSCModelMeshServing struct {
// configuration fields common across components
ModelMeshServingCommonSpec `json:",inline"`
}

// DSCModelMeshServingStatus contains the observed state of the ModelMeshServing exposed in the DSC instance
type DSCModelMeshServingStatus struct {
common.ManagementSpec `json:",inline"`
*ModelMeshServingCommonStatus `json:",inline"`
}
12 changes: 9 additions & 3 deletions apis/components/v1alpha1/modelregistry_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,15 @@ type ModelRegistrySpec struct {
// model registry spec exposed only to internal api
}

// ModelRegistryCommonStatus defines the shared observed state of ModelRegistry
type ModelRegistryCommonStatus struct {
RegistriesNamespace string `json:"registriesNamespace,omitempty"`
}

// ModelRegistryStatus defines the observed state of ModelRegistry
type ModelRegistryStatus struct {
common.Status `json:",inline"`
DSCModelRegistryStatus `json:",inline"`
common.Status `json:",inline"`
ModelRegistryCommonStatus `json:",inline"`
}

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -105,5 +110,6 @@ type DSCModelRegistry struct {

// DSCModelRegistryStatus struct holds the status for the ModelRegistry component exposed in the DSC
type DSCModelRegistryStatus struct {
RegistriesNamespace string `json:"registriesNamespace,omitempty"`
common.ManagementSpec `json:",inline"`
*ModelRegistryCommonStatus `json:",inline"`
}
13 changes: 12 additions & 1 deletion apis/components/v1alpha1/ray_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ type RayCommonSpec struct {
common.DevFlagsSpec `json:",inline"`
}

// RayCommonStatus defines the shared observed state of Ray
type RayCommonStatus struct {
}

// RayStatus defines the observed state of Ray
type RayStatus struct {
common.Status `json:",inline"`
common.Status `json:",inline"`
RayCommonStatus `json:",inline"`
}

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -85,3 +90,9 @@ type DSCRay struct {
// configuration fields common across components
RayCommonSpec `json:",inline"`
}

// DSCRayStatus struct holds the status for the Ray component exposed in the DSC
type DSCRayStatus struct {
common.ManagementSpec `json:",inline"`
*RayCommonStatus `json:",inline"`
}
13 changes: 12 additions & 1 deletion apis/components/v1alpha1/trainingoperator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ type TrainingOperatorCommonSpec struct {
common.DevFlagsSpec `json:",inline"`
}

// TrainingOperatorCommonStatus defines the shared observed state of TrainingOperator
type TrainingOperatorCommonStatus struct {
}

// TrainingOperatorStatus defines the observed state of TrainingOperator
type TrainingOperatorStatus struct {
common.Status `json:",inline"`
common.Status `json:",inline"`
TrainingOperatorCommonStatus `json:",inline"`
}

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -85,3 +90,9 @@ type DSCTrainingOperator struct {
// configuration fields common across components
TrainingOperatorCommonSpec `json:",inline"`
}

// DSCTrainingOperatorStatus struct holds the status for the TrainingOperator component exposed in the DSC
type DSCTrainingOperatorStatus struct {
common.ManagementSpec `json:",inline"`
*TrainingOperatorCommonStatus `json:",inline"`
}
13 changes: 12 additions & 1 deletion apis/components/v1alpha1/trustyai_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ type TrustyAICommonSpec struct {
common.DevFlagsSpec `json:",inline"`
}

// TrustyAICommonStatus defines the shared observed state of TrustyAI
type TrustyAICommonStatus struct {
}

// TrustyAIStatus defines the observed state of TrustyAI
type TrustyAIStatus struct {
common.Status `json:",inline"`
common.Status `json:",inline"`
TrustyAICommonStatus `json:",inline"`
}

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -85,3 +90,9 @@ type DSCTrustyAI struct {
// configuration fields common across components
TrustyAICommonSpec `json:",inline"`
}

// DSCTrustyAIStatus struct holds the status for the TrustyAI component exposed in the DSC
type DSCTrustyAIStatus struct {
common.ManagementSpec `json:",inline"`
*TrustyAICommonStatus `json:",inline"`
}
13 changes: 12 additions & 1 deletion apis/components/v1alpha1/workbenches_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@ type WorkbenchesSpec struct {
// workbenches spec exposed only to internal api
}

// WorkbenchesCommonStatus defines the shared observed state of Workbenches
type WorkbenchesCommonStatus struct {
}

// WorkbenchesStatus defines the observed state of Workbenches
type WorkbenchesStatus struct {
common.Status `json:",inline"`
common.Status `json:",inline"`
WorkbenchesCommonStatus `json:",inline"`
}

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -91,3 +96,9 @@ type DSCWorkbenches struct {
// workbenches specific field
WorkbenchesCommonSpec `json:",inline"`
}

// DSCWorkbenchesStatus struct holds the status for the Workbenches component exposed in the DSC
type DSCWorkbenchesStatus struct {
common.ManagementSpec `json:",inline"`
*WorkbenchesCommonStatus `json:",inline"`
}
Loading

0 comments on commit fcfcba0

Please sign in to comment.