Skip to content

Commit 809d52c

Browse files
authored
Fix nil pointer on cluster update (#552)
1 parent c1570e9 commit 809d52c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

controllers/flinkcluster/flinkcluster_updater.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ func (updater *ClusterStatusUpdater) deriveClusterStatus(
218218
var observedConfigMap = observed.configMap
219219
cmStatus := &status.Components.ConfigMap
220220
if !isComponentUpdated(observedConfigMap, observed.cluster) && shouldUpdateCluster(observed) {
221+
*cmStatus = new(v1beta1.ConfigMapStatus)
221222
recorded.Components.ConfigMap.DeepCopyInto(*cmStatus)
222223
(*cmStatus).State = v1beta1.ComponentStateUpdating
223224
} else if observedConfigMap != nil {
@@ -236,6 +237,7 @@ func (updater *ClusterStatusUpdater) deriveClusterStatus(
236237
var observedJmStatefulSet = observed.jmStatefulSet
237238
jmStatus := &status.Components.JobManager
238239
if !isComponentUpdated(observedJmStatefulSet, observed.cluster) && shouldUpdateCluster(observed) {
240+
*jmStatus = new(v1beta1.JobManagerStatus)
239241
recorded.Components.JobManager.DeepCopyInto(*jmStatus)
240242
(*jmStatus).State = v1beta1.ComponentStateUpdating
241243
} else if observedJmStatefulSet != nil {
@@ -393,6 +395,7 @@ func (updater *ClusterStatusUpdater) deriveClusterStatus(
393395
var observedTmStatefulSet = observed.tmStatefulSet
394396
tmStatus := &status.Components.TaskManager
395397
if !isComponentUpdated(observedTmStatefulSet, observed.cluster) && shouldUpdateCluster(observed) {
398+
*tmStatus = new(v1beta1.TaskManagerStatus)
396399
recorded.Components.TaskManager.DeepCopyInto(*tmStatus)
397400
(*tmStatus).State = v1beta1.ComponentStateUpdating
398401
} else if observedTmStatefulSet != nil {
@@ -417,6 +420,7 @@ func (updater *ClusterStatusUpdater) deriveClusterStatus(
417420
var observedTmDeployment = observed.tmDeployment
418421
tmStatus := &status.Components.TaskManager
419422
if !isComponentUpdated(observedTmDeployment, observed.cluster) && shouldUpdateCluster(observed) {
423+
*tmStatus = new(v1beta1.TaskManagerStatus)
420424
recorded.Components.TaskManager.DeepCopyInto(*tmStatus)
421425
(*tmStatus).State = v1beta1.ComponentStateUpdating
422426
} else if observedTmDeployment != nil {

0 commit comments

Comments
 (0)