You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@yunikorn.apache.org by GitBox <gi...@apache.org> on 2020/06/16 13:40:59 UTC

[GitHub] [incubator-yunikorn-k8shim] adamantal commented on a change in pull request #107: [YUNIKORN-55] Add pod labels and annotations to allocation ask attributes

adamantal commented on a change in pull request #107:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/107#discussion_r440858242



##########
File path: pkg/common/si_helper.go
##########
@@ -19,16 +19,48 @@
 package common
 
 import (
+	"encoding/json"
+
+	"go.uber.org/zap"
+	v1 "k8s.io/api/core/v1"
+
 	"github.com/apache/incubator-yunikorn-k8shim/pkg/conf"
+	"github.com/apache/incubator-yunikorn-k8shim/pkg/log"
 	"github.com/apache/incubator-yunikorn-scheduler-interface/lib/go/si"
 )
 
-func CreateUpdateRequestForTask(appID, taskID string, resource *si.Resource) si.UpdateRequest {
+func createTagsForTask(pod *v1.Pod, taskID string) map[string]string {
+	tags := map[string]string{
+		"namespace": pod.Namespace,
+		"podName": pod.Name,
+	}
+
+	// add Pod labels to Task tags
+	labels, err := json.Marshal(pod.Labels)
+	if err != nil {
+		log.Logger.Debug("Could not marshal pod labels", zap.String("taskID", taskID))
+	} else {
+		tags["labels"] = string(labels)
+	}
+
+	// add Pod annotations to Task tags
+	annotations, err := json.Marshal(pod.Annotations)
+	if err != nil {
+		log.Logger.Debug("Could not marshal pod annotations", zap.String("taskID", taskID))
+	} else {
+		tags["annotations"] = string(annotations)
+	}

Review comment:
       All right. Removed it.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org