Skip to content

Commit 99d114b

Browse files
committed
improve readability
Signed-off-by: win5923 <[email protected]>
1 parent 9359c5f commit 99d114b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ray-operator/controllers/ray/raycluster_controller.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,20 +1159,22 @@ func (r *RayClusterReconciler) shouldRecreatePodsForUpgrade(ctx context.Context,
11591159
actualHash := pod.Annotations[utils.PodTemplateHashKey]
11601160

11611161
var expectedHash string
1162-
if nodeType == string(rayv1.HeadNode) {
1162+
switch rayv1.RayNodeType(nodeType) {
1163+
case rayv1.HeadNode:
11631164
expectedHash = headHash
1164-
} else if nodeType == string(rayv1.WorkerNode) {
1165+
case rayv1.WorkerNode:
11651166
groupName := pod.Labels[utils.RayNodeGroupLabelKey]
11661167
var ok bool
11671168
expectedHash, ok = workerHashMap[groupName]
11681169
if !ok {
11691170
logger.Info("Worker group not found in spec, skipping pod", "pod", pod.Name, "groupName", groupName)
11701171
continue
11711172
}
1172-
} else {
1173+
default:
11731174
continue
11741175
}
11751176

1177+
// Check if pod needs recreation
11761178
if actualHash != expectedHash {
11771179
logger.Info("Pod template has changed, will recreate all pods",
11781180
"pod", pod.Name,

0 commit comments

Comments
 (0)