You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@yunikorn.apache.org by "zhuqi-lucas (via GitHub)" <gi...@apache.org> on 2023/02/06 04:09:49 UTC

[GitHub] [yunikorn-k8shim] zhuqi-lucas commented on a diff in pull request #519: [YUNIKORN-1550] pass k8s node labels as attributes not json

zhuqi-lucas commented on code in PR #519:
URL: https://github.com/apache/yunikorn-k8shim/pull/519#discussion_r1096927110


##########
pkg/cache/nodes.go:
##########
@@ -101,20 +100,13 @@ func (nc *schedulerNodes) addAndReportNode(node *v1.Node, reportNode bool) {
 
 	// add node to nodes map
 	if _, ok := nc.nodesMap[node.Name]; !ok {
-		var nodeLabels []byte
-		nodeLabels, err := json.Marshal(node.Labels) // A nil pointer encodes as the "null" JSON value.
-		if err != nil {
-			log.Logger().Error("failed to marshall node labels to json", zap.Error(err))
-			nodeLabels = make([]byte, 0)
-		}
-
 		log.Logger().Info("adding node to context",
 			zap.String("nodeName", node.Name),
-			zap.String("nodeLabels", string(nodeLabels)),
+			zap.String("nodeLabels", fmt.Sprintf("%v", node.Labels)),

Review Comment:
   Thank you @wilfred-s for review, good suggestion, addressed in latest PR.



-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@yunikorn.apache.org

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