This is an automated email from the ASF dual-hosted git repository.

pbacsko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-k8shim.git


The following commit(s) were added to refs/heads/master by this push:
     new 24efbeda [YUNIKORN-2653] Gang scheduling K8s event formatting 
compliance (#851)
24efbeda is described below

commit 24efbeda6800fabec17cf9e0474cebee0314bd6e
Author: Wilfred Spiegelenburg <[email protected]>
AuthorDate: Wed Jun 19 15:40:41 2024 +0200

    [YUNIKORN-2653] Gang scheduling K8s event formatting compliance (#851)
    
    The K8s events provide definitions and rules around the content of the
    fields within the event. Adjust the content of gang scheduling related
    events to comply with the rules.
    Only affects the Reason and Action fields in the events.
    
    Closes: #851
    
    Signed-off-by: Peter Bacsko <[email protected]>
---
 pkg/cache/application.go      | 6 +++---
 pkg/cache/application_test.go | 2 +-
 pkg/cache/metadata.go         | 2 +-
 pkg/cache/task.go             | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/pkg/cache/application.go b/pkg/cache/application.go
index b4c4f012..ff4db058 100644
--- a/pkg/cache/application.go
+++ b/pkg/cache/application.go
@@ -550,7 +550,7 @@ func (app *Application) onReservationStateChange() {
        if app.originatingTask != nil {
                // Now that all placeholders has been allocated, send a final 
conclusion message
                
events.GetRecorder().Eventf(app.originatingTask.GetTaskPod().DeepCopy(), nil, 
v1.EventTypeNormal, "GangScheduling",
-                       "Gang reservations completed. All placeholders are 
allocated.", "Application %s all placeholders are allocated. Transitioning to 
running state.", app.applicationID)
+                       "GangReservationComplete", "Application %s all 
placeholders are allocated. Transitioning to running state.", app.applicationID)
        }
        dispatcher.Dispatch(NewRunApplicationEvent(app.applicationID))
 }
@@ -669,8 +669,8 @@ func (app *Application) 
publishPlaceholderTimeoutEvents(task *Task) {
                        zap.Stringer("app request originating pod", 
app.originatingTask.GetTaskPod()),
                        zap.String("taskID", task.taskID),
                        zap.String("terminationType", task.terminationType))
-               
events.GetRecorder().Eventf(app.originatingTask.GetTaskPod().DeepCopy(), nil, 
v1.EventTypeWarning, "Placeholder timed out",
-                       "Placeholder timed out", "Application %s placeholder 
has been timed out", app.applicationID)
+               
events.GetRecorder().Eventf(app.originatingTask.GetTaskPod().DeepCopy(), nil, 
v1.EventTypeWarning, "GangScheduling",
+                       "PlaceholderTimeOut", "Application %s placeholder has 
been timed out", app.applicationID)
        }
 }
 
diff --git a/pkg/cache/application_test.go b/pkg/cache/application_test.go
index d6b45cb3..9d91e46b 100644
--- a/pkg/cache/application_test.go
+++ b/pkg/cache/application_test.go
@@ -1196,7 +1196,7 @@ func TestPlaceholderTimeoutEvents(t *testing.T) {
        // after handle release event the states of app must be running
        assertAppState(t, app, ApplicationStates().Running, 3*time.Second)
 
-       message := "Placeholder timed out"
+       message := "GangScheduling"
        reason := "placeholder has been timed out"
        // check that the event has been published
        err = utils.WaitForCondition(func() bool {
diff --git a/pkg/cache/metadata.go b/pkg/cache/metadata.go
index 2c637ce8..68ba9deb 100644
--- a/pkg/cache/metadata.go
+++ b/pkg/cache/metadata.go
@@ -114,7 +114,7 @@ func getAppMetadata(pod *v1.Pod) (ApplicationMetadata, 
bool) {
                                zap.String("namespace", pod.Namespace),
                                zap.String("name", pod.Name),
                                zap.Error(err))
-                       events.GetRecorder().Eventf(pod, nil, 
v1.EventTypeWarning, "TaskGroupsError", "TaskGroupsError",
+                       events.GetRecorder().Eventf(pod, nil, 
v1.EventTypeWarning, "GangScheduling", "TaskGroupsError",
                                "unable to get taskGroups for pod, reason: %s", 
err.Error())
                }
                tags[constants.AnnotationTaskGroups] = 
pod.Annotations[constants.AnnotationTaskGroups]
diff --git a/pkg/cache/task.go b/pkg/cache/task.go
index 05b1b889..97f041ea 100644
--- a/pkg/cache/task.go
+++ b/pkg/cache/task.go
@@ -332,7 +332,7 @@ func (task *Task) handleSubmitTaskEvent() {
                // in this case, post an event to indicate the task is being 
gang scheduled
                if !task.placeholder && task.taskGroupName != "" {
                        events.GetRecorder().Eventf(task.pod.DeepCopy(), nil,
-                               v1.EventTypeNormal, "GangScheduling", 
"GangScheduling",
+                               v1.EventTypeNormal, "GangScheduling", 
"TaskGroupMatch",
                                "Pod belongs to the taskGroup %s, it will be 
scheduled as a gang member", task.taskGroupName)
                }
        }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to