Skip to content

Commit

Permalink
fix: fix panic on nil statefulset
Browse files Browse the repository at this point in the history
Signed-off-by: arkbriar <[email protected]>
  • Loading branch information
arkbriar committed Jan 23, 2024
1 parent ff4209b commit 49e0956
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/manager/risingwave_controller_manager_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ func getStandaloneStatusUtil(rw *risingwavev1alpha1.RisingWave, logger logr.Logg
}

func getStandaloneStatus(rw *risingwavev1alpha1.RisingWave, standaloneStatefulSet *appsv1.StatefulSet, logger logr.Logger) risingwavev1alpha1.ComponentReplicasStatus {
return getStandaloneStatusUtil(rw, logger, standaloneStatefulSet.Status.ReadyReplicas)
readyReplicas := lo.If(isObjectNil(standaloneStatefulSet), int32(0)).Else(standaloneStatefulSet.Status.ReadyReplicas)
return getStandaloneStatusUtil(rw, logger, readyReplicas)
}

func getOpenKruiseStandaloneStatus(rw *risingwavev1alpha1.RisingWave, standaloneStatefulSet *kruiseappsv1beta1.StatefulSet, logger logr.Logger) risingwavev1alpha1.ComponentReplicasStatus {
return getStandaloneStatusUtil(rw, logger, standaloneStatefulSet.Status.ReadyReplicas)
readyReplicas := lo.If(isObjectNil(standaloneStatefulSet), int32(0)).Else(standaloneStatefulSet.Status.ReadyReplicas)
return getStandaloneStatusUtil(rw, logger, readyReplicas)
}

func buildNodeGroupStatus[T any, TP ptrAsObject[T], G any](groups []G, nameAndReplicas func(*G) (string, int32), workloads []T, groupAndReadyReplicas func(TP) (string, int32)) risingwavev1alpha1.ComponentReplicasStatus {
Expand Down

0 comments on commit 49e0956

Please sign in to comment.