Skip to content

Commit

Permalink
Fix nil pointer on cluster update (#552)
Browse files Browse the repository at this point in the history
  • Loading branch information
regadas authored Dec 12, 2022
1 parent c1570e9 commit 809d52c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions controllers/flinkcluster/flinkcluster_updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ func (updater *ClusterStatusUpdater) deriveClusterStatus(
var observedConfigMap = observed.configMap
cmStatus := &status.Components.ConfigMap
if !isComponentUpdated(observedConfigMap, observed.cluster) && shouldUpdateCluster(observed) {
*cmStatus = new(v1beta1.ConfigMapStatus)
recorded.Components.ConfigMap.DeepCopyInto(*cmStatus)
(*cmStatus).State = v1beta1.ComponentStateUpdating
} else if observedConfigMap != nil {
Expand All @@ -236,6 +237,7 @@ func (updater *ClusterStatusUpdater) deriveClusterStatus(
var observedJmStatefulSet = observed.jmStatefulSet
jmStatus := &status.Components.JobManager
if !isComponentUpdated(observedJmStatefulSet, observed.cluster) && shouldUpdateCluster(observed) {
*jmStatus = new(v1beta1.JobManagerStatus)
recorded.Components.JobManager.DeepCopyInto(*jmStatus)
(*jmStatus).State = v1beta1.ComponentStateUpdating
} else if observedJmStatefulSet != nil {
Expand Down Expand Up @@ -393,6 +395,7 @@ func (updater *ClusterStatusUpdater) deriveClusterStatus(
var observedTmStatefulSet = observed.tmStatefulSet
tmStatus := &status.Components.TaskManager
if !isComponentUpdated(observedTmStatefulSet, observed.cluster) && shouldUpdateCluster(observed) {
*tmStatus = new(v1beta1.TaskManagerStatus)
recorded.Components.TaskManager.DeepCopyInto(*tmStatus)
(*tmStatus).State = v1beta1.ComponentStateUpdating
} else if observedTmStatefulSet != nil {
Expand All @@ -417,6 +420,7 @@ func (updater *ClusterStatusUpdater) deriveClusterStatus(
var observedTmDeployment = observed.tmDeployment
tmStatus := &status.Components.TaskManager
if !isComponentUpdated(observedTmDeployment, observed.cluster) && shouldUpdateCluster(observed) {
*tmStatus = new(v1beta1.TaskManagerStatus)
recorded.Components.TaskManager.DeepCopyInto(*tmStatus)
(*tmStatus).State = v1beta1.ComponentStateUpdating
} else if observedTmDeployment != nil {
Expand Down

0 comments on commit 809d52c

Please sign in to comment.