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

Add status sub resource to component's APIs #10

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions apis/components/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package components

import (
operatorv1 "github.com/openshift/api/operator/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// Component struct defines the basis for each OpenDataHub component configuration.
Expand Down Expand Up @@ -54,3 +55,14 @@ type ManifestsConfig struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=3
SourcePath string `json:"sourcePath,omitempty"`
}

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

type WithStatus interface {
GetStatus() *Status
}
16 changes: 10 additions & 6 deletions apis/components/v1/codeflare_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/components"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -34,13 +35,12 @@ type CodeFlareSpec struct {

// CodeFlareStatus defines the observed state of CodeFlare
type CodeFlareStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
components.Status `json:",inline"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// CodeFlare is the Schema for the codeflares API
type CodeFlare struct {
Expand All @@ -51,7 +51,11 @@ type CodeFlare struct {
Status CodeFlareStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
func (c *CodeFlare) GetStatus() *components.Status {
return &c.Status.Status
}

// +kubebuilder:object:root=true

// CodeFlareList contains a list of CodeFlare
type CodeFlareList struct {
Expand Down
15 changes: 9 additions & 6 deletions apis/components/v1/dashboard_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ type DashboardSpec struct {

// DashboardStatus defines the observed state of Dashboard
type DashboardStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
components.Status `json:",inline"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// Dashboard is the Schema for the dashboards API
type Dashboard struct {
Expand All @@ -50,7 +49,11 @@ type Dashboard struct {
Status DashboardStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
func (c *Dashboard) GetStatus() *components.Status {
return &c.Status.Status
}

// +kubebuilder:object:root=true

// DashboardList contains a list of Dashboard
type DashboardList struct {
Expand Down
16 changes: 10 additions & 6 deletions apis/components/v1/datasciencepipelines_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/components"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -34,13 +35,12 @@ type DataSciencePipelinesSpec struct {

// DataSciencePipelinesStatus defines the observed state of DataSciencePipelines
type DataSciencePipelinesStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
components.Status `json:",inline"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// DataSciencePipelines is the Schema for the datasciencepipelines API
type DataSciencePipelines struct {
Expand All @@ -51,7 +51,11 @@ type DataSciencePipelines struct {
Status DataSciencePipelinesStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
func (c *DataSciencePipelines) GetStatus() *components.Status {
return &c.Status.Status
}

// +kubebuilder:object:root=true

// DataSciencePipelinesList contains a list of DataSciencePipelines
type DataSciencePipelinesList struct {
Expand Down
16 changes: 10 additions & 6 deletions apis/components/v1/kserve_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/components"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -34,13 +35,12 @@ type KserveSpec struct {

// KserveStatus defines the observed state of Kserve
type KserveStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
components.Status `json:",inline"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// Kserve is the Schema for the kserves API
type Kserve struct {
Expand All @@ -51,7 +51,11 @@ type Kserve struct {
Status KserveStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
func (c *Kserve) GetStatus() *components.Status {
return &c.Status.Status
}

// +kubebuilder:object:root=true

// KserveList contains a list of Kserve
type KserveList struct {
Expand Down
16 changes: 10 additions & 6 deletions apis/components/v1/kueue_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/components"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -34,13 +35,12 @@ type KueueSpec struct {

// KueueStatus defines the observed state of Kueue
type KueueStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
components.Status `json:",inline"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// Kueue is the Schema for the kueues API
type Kueue struct {
Expand All @@ -51,7 +51,11 @@ type Kueue struct {
Status KueueStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
func (c *Kueue) GetStatus() *components.Status {
return &c.Status.Status
}

// +kubebuilder:object:root=true

// KueueList contains a list of Kueue
type KueueList struct {
Expand Down
16 changes: 10 additions & 6 deletions apis/components/v1/modelmeshserving_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/components"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -34,13 +35,12 @@ type ModelMeshServingSpec struct {

// ModelMeshServingStatus defines the observed state of ModelMeshServing
type ModelMeshServingStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
components.Status `json:",inline"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// ModelMeshServing is the Schema for the modelmeshservings API
type ModelMeshServing struct {
Expand All @@ -51,7 +51,11 @@ type ModelMeshServing struct {
Status ModelMeshServingStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
func (c *ModelMeshServing) GetStatus() *components.Status {
return &c.Status.Status
}

// +kubebuilder:object:root=true

// ModelMeshServingList contains a list of ModelMeshServing
type ModelMeshServingList struct {
Expand Down
16 changes: 10 additions & 6 deletions apis/components/v1/modelregistry_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/components"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -34,13 +35,12 @@ type ModelRegistrySpec struct {

// ModelRegistryStatus defines the observed state of ModelRegistry
type ModelRegistryStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
components.Status `json:",inline"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// ModelRegistry is the Schema for the modelregistries API
type ModelRegistry struct {
Expand All @@ -51,7 +51,11 @@ type ModelRegistry struct {
Status ModelRegistryStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
func (c *ModelRegistry) GetStatus() *components.Status {
return &c.Status.Status
}

// +kubebuilder:object:root=true

// ModelRegistryList contains a list of ModelRegistry
type ModelRegistryList struct {
Expand Down
16 changes: 10 additions & 6 deletions apis/components/v1/ray_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/components"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -34,13 +35,12 @@ type RaySpec struct {

// RayStatus defines the observed state of Ray
type RayStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
components.Status `json:",inline"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// Ray is the Schema for the rays API
type Ray struct {
Expand All @@ -51,7 +51,11 @@ type Ray struct {
Status RayStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
func (c *Ray) GetStatus() *components.Status {
return &c.Status.Status
}

// +kubebuilder:object:root=true

// RayList contains a list of Ray
type RayList struct {
Expand Down
16 changes: 10 additions & 6 deletions apis/components/v1/trainingoperator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1

import (
"github.com/opendatahub-io/opendatahub-operator/v2/apis/components"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -34,13 +35,12 @@ type TrainingOperatorSpec struct {

// TrainingOperatorStatus defines the observed state of TrainingOperator
type TrainingOperatorStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
components.Status `json:",inline"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// TrainingOperator is the Schema for the trainingoperators API
type TrainingOperator struct {
Expand All @@ -51,7 +51,11 @@ type TrainingOperator struct {
Status TrainingOperatorStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
func (c *TrainingOperator) GetStatus() *components.Status {
return &c.Status.Status
}

// +kubebuilder:object:root=true

// TrainingOperatorList contains a list of TrainingOperator
type TrainingOperatorList struct {
Expand Down
Loading
Loading