-
Notifications
You must be signed in to change notification settings - Fork 144
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
update: add status update on component CR's phase #1394
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 | ||||
---|---|---|---|---|---|---|
@@ -1,12 +1,14 @@ | ||||||
package modelregistry | ||||||
|
||||||
import ( | ||||||
"context" | ||||||
"fmt" | ||||||
|
||||||
operatorv1 "github.com/openshift/api/operator/v1" | ||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
"sigs.k8s.io/controller-runtime/pkg/client" | ||||||
|
||||||
"github.com/opendatahub-io/opendatahub-operator/v2/apis/components" | ||||||
componentsv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1" | ||||||
dscv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/datasciencecluster/v1" | ||||||
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster" | ||||||
|
@@ -72,3 +74,10 @@ func (s *componentHandler) NewCRObject(dsc *dscv1.DataScienceCluster) client.Obj | |||||
}, | ||||||
}) | ||||||
} | ||||||
func (s *componentHandler) GetStatus(ctx context.Context, cli client.Client) (components.Status, error) { | ||||||
m := &componentsv1.Dashboard{} | ||||||
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.
Suggested change
|
||||||
if err := cli.Get(ctx, client.ObjectKey{Name: componentsv1.ModelRegistryInstanceName}, m); err != nil { | ||||||
return components.Status{}, fmt.Errorf("error get component CR %v %w ", componentsv1.ModelRegistryInstanceName, err) | ||||||
} | ||||||
return *m.GetStatus(), nil | ||||||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,12 +1,14 @@ | ||||||
package ray | ||||||
|
||||||
import ( | ||||||
"context" | ||||||
"fmt" | ||||||
|
||||||
operatorv1 "github.com/openshift/api/operator/v1" | ||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
"sigs.k8s.io/controller-runtime/pkg/client" | ||||||
|
||||||
"github.com/opendatahub-io/opendatahub-operator/v2/apis/components" | ||||||
componentsv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1" | ||||||
dscv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/datasciencecluster/v1" | ||||||
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster" | ||||||
|
@@ -72,3 +74,10 @@ func (s *componentHandler) Init(platform cluster.Platform) error { | |||||
|
||||||
return nil | ||||||
} | ||||||
func (s *componentHandler) GetStatus(ctx context.Context, cli client.Client) (components.Status, error) { | ||||||
r := &componentsv1.Dashboard{} | ||||||
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.
Suggested change
|
||||||
if err := cli.Get(ctx, client.ObjectKey{Name: componentsv1.RayInstanceName}, r); err != nil { | ||||||
return components.Status{}, fmt.Errorf("error get component CR %v %w ", componentsv1.RayInstanceName, err) | ||||||
} | ||||||
return *r.GetStatus(), nil | ||||||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,12 +1,14 @@ | ||||||
package trainingoperator | ||||||
|
||||||
import ( | ||||||
"context" | ||||||
"fmt" | ||||||
|
||||||
operatorv1 "github.com/openshift/api/operator/v1" | ||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
k8sclient "sigs.k8s.io/controller-runtime/pkg/client" | ||||||
"sigs.k8s.io/controller-runtime/pkg/client" | ||||||
|
||||||
"github.com/opendatahub-io/opendatahub-operator/v2/apis/components" | ||||||
componentsv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1" | ||||||
dscv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/datasciencecluster/v1" | ||||||
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster" | ||||||
|
@@ -37,7 +39,7 @@ func (s *componentHandler) GetManagementState(dsc *dscv1.DataScienceCluster) ope | |||||
return dsc.Spec.Components.TrainingOperator.ManagementState | ||||||
} | ||||||
|
||||||
func (s *componentHandler) NewCRObject(dsc *dscv1.DataScienceCluster) k8sclient.Object { | ||||||
func (s *componentHandler) NewCRObject(dsc *dscv1.DataScienceCluster) client.Object { | ||||||
trainingoperatorAnnotations := make(map[string]string) | ||||||
switch dsc.Spec.Components.TrainingOperator.ManagementState { | ||||||
case operatorv1.Managed, operatorv1.Removed: | ||||||
|
@@ -46,7 +48,7 @@ func (s *componentHandler) NewCRObject(dsc *dscv1.DataScienceCluster) k8sclient. | |||||
trainingoperatorAnnotations[annotations.ManagementStateAnnotation] = "Unknown" | ||||||
} | ||||||
|
||||||
return k8sclient.Object(&componentsv1.TrainingOperator{ | ||||||
return client.Object(&componentsv1.TrainingOperator{ | ||||||
TypeMeta: metav1.TypeMeta{ | ||||||
Kind: componentsv1.TrainingOperatorKind, | ||||||
APIVersion: componentsv1.GroupVersion.String(), | ||||||
|
@@ -72,3 +74,10 @@ func (s *componentHandler) Init(platform cluster.Platform) error { | |||||
|
||||||
return nil | ||||||
} | ||||||
func (s *componentHandler) GetStatus(ctx context.Context, cli client.Client) (components.Status, error) { | ||||||
t := &componentsv1.Dashboard{} | ||||||
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.
Suggested change
|
||||||
if err := cli.Get(ctx, client.ObjectKey{Name: componentsv1.TrainingOperatorInstanceName}, t); err != nil { | ||||||
return components.Status{}, fmt.Errorf("error get component CR %v %w ", componentsv1.TrainingOperatorInstanceName, err) | ||||||
} | ||||||
return *t.GetStatus(), nil | ||||||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,12 +1,14 @@ | ||||||
package trustyai | ||||||
|
||||||
import ( | ||||||
"context" | ||||||
"fmt" | ||||||
|
||||||
operatorv1 "github.com/openshift/api/operator/v1" | ||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
"sigs.k8s.io/controller-runtime/pkg/client" | ||||||
|
||||||
"github.com/opendatahub-io/opendatahub-operator/v2/apis/components" | ||||||
componentsv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/components/v1" | ||||||
dscv1 "github.com/opendatahub-io/opendatahub-operator/v2/apis/datasciencecluster/v1" | ||||||
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster" | ||||||
|
@@ -79,3 +81,10 @@ func (s *componentHandler) Init(platform cluster.Platform) error { | |||||
|
||||||
return nil | ||||||
} | ||||||
func (s *componentHandler) GetStatus(ctx context.Context, cli client.Client) (components.Status, error) { | ||||||
t := &componentsv1.Dashboard{} | ||||||
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.
Suggested change
|
||||||
if err := cli.Get(ctx, client.ObjectKey{Name: componentsv1.TrustyAIInstanceName}, t); err != nil { | ||||||
return components.Status{}, fmt.Errorf("error get component CR %v %w ", componentsv1.TrustyAIInstanceName, err) | ||||||
} | ||||||
return *t.GetStatus(), nil | ||||||
} |
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.
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.
💤 i was not myself
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.
I know it's still a draft PR and not yet ready for review, but I thought it might be useful to highlight these in case you didn't catch them before making it ready 🙂
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.
sure, thanks!
history proves this again: do not eat and work at the same time!