@@ -1116,7 +1116,7 @@ func (r *RayClusterReconciler) reconcileMultiHostWorkerGroup(ctx context.Context
11161116 return nil
11171117}
11181118
1119- // shouldRecreatePodsForUpgrade checks if any pods need to be recreated based on Head/Worker pod template changes
1119+ // shouldRecreatePodsForUpgrade checks if any pods need to be recreated based on PodTemplateSpec changes
11201120func (r * RayClusterReconciler ) shouldRecreatePodsForUpgrade (ctx context.Context , instance * rayv1.RayCluster ) bool {
11211121 logger := ctrl .LoggerFrom (ctx )
11221122
@@ -1159,31 +1159,27 @@ 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
11761177 if actualHash != expectedHash {
11771178 logger .Info ("Pod template has changed, will recreate all pods" ,
1178- "pod" , pod .Name ,
1179- "nodeType" , nodeType ,
1180- "actualHash" , actualHash ,
1181- "expectedHash" , expectedHash ,
1182- "upgradeStrategy" , * instance .Spec .UpgradeStrategy .Type )
1179+ "rayCluster" , instance .Name )
11831180 return true
11841181 }
11851182 }
1186-
11871183 return false
11881184}
11891185
0 commit comments