Skip to content

Commit

Permalink
feat: add events package to be DRYer
Browse files Browse the repository at this point in the history
  • Loading branch information
davidxia committed Jul 4, 2022
1 parent d1e0d1a commit e611ad1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ray-operator/apis/ray/v1alpha1/events/raycluster_events.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package v1alpha1

const (
RayConfigError = "RayConfigError"
)
3 changes: 2 additions & 1 deletion ray-operator/controllers/ray/raycluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
rbacv1 "k8s.io/api/rbac/v1"

rayiov1alpha1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1alpha1"
rayevents "github.com/ray-project/kuberay/ray-operator/apis/ray/v1alpha1/events"
_ "github.com/ray-project/kuberay/ray-operator/controllers/ray/common"
"k8s.io/client-go/tools/record"

Expand Down Expand Up @@ -626,7 +627,7 @@ func (r *RayClusterReconciler) updateStatus(instance *rayiov1alpha1.RayCluster)
// validation for the RayStartParam for the state.
isValid, err := common.ValidateHeadRayStartParams(instance.Spec.HeadGroupSpec)
if err != nil {
r.Recorder.Event(instance, v1.EventTypeWarning, "Parameters conflict", err.Error())
r.Recorder.Event(instance, v1.EventTypeWarning, rayevents.RayConfigError, err.Error())
}
// only in invalid status that we update the status to unhealthy.
if !isValid {
Expand Down

0 comments on commit e611ad1

Please sign in to comment.