Skip to content

Commit cb8645a

Browse files
Merge pull request #686 from ratailor/OSPRH-16968
Do not update status when reconciler exits due to panic
2 parents 3ba8662 + 4dc3f36 commit cb8645a

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

controllers/autoscaling_controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ func (r *AutoscalingReconciler) Reconcile(ctx context.Context, req ctrl.Request)
148148
// Always patch the instance status when exiting this function so we can
149149
// persist any changes.
150150
defer func() {
151+
// Don't update the status, if reconciler Panics
152+
if r := recover(); r != nil {
153+
Log.Info(fmt.Sprintf("panic during reconcile %v\n", r))
154+
panic(r)
155+
}
151156
condition.RestoreLastTransitionTimes(
152157
&instance.Status.Conditions, savedConditions)
153158
if instance.Status.Conditions.IsUnknown(condition.ReadyCondition) {

controllers/ceilometer_controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ func (r *CeilometerReconciler) Reconcile(ctx context.Context, req ctrl.Request)
151151
// Always patch the instance status when exiting this function so we can
152152
// persist any changes.
153153
defer func() {
154+
// Don't update the status, if reconciler Panics
155+
if r := recover(); r != nil {
156+
Log.Info(fmt.Sprintf("panic during reconcile %v\n", r))
157+
panic(r)
158+
}
154159
condition.RestoreLastTransitionTimes(
155160
&instance.Status.Conditions, savedConditions)
156161
if instance.Status.Conditions.IsUnknown(condition.ReadyCondition) {

controllers/logging_controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ func (r *LoggingReconciler) Reconcile(ctx context.Context, req ctrl.Request) (re
115115
// Always patch the instance status when exiting this function so we can
116116
// persist any changes.
117117
defer func() {
118+
// Don't update the status, if reconciler Panics
119+
if r := recover(); r != nil {
120+
Log.Info(fmt.Sprintf("panic during reconcile %v\n", r))
121+
panic(r)
122+
}
118123
condition.RestoreLastTransitionTimes(
119124
&instance.Status.Conditions, savedConditions)
120125
if instance.Status.Conditions.IsUnknown(condition.ReadyCondition) {

controllers/metricstorage_controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ func (r *MetricStorageReconciler) Reconcile(ctx context.Context, req ctrl.Reques
174174
// Always patch the instance status when exiting this function so we can
175175
// persist any changes.
176176
defer func() {
177+
// Don't update the status, if reconciler Panics
178+
if r := recover(); r != nil {
179+
Log.Info(fmt.Sprintf("panic during reconcile %v\n", r))
180+
panic(r)
181+
}
177182
condition.RestoreLastTransitionTimes(
178183
&instance.Status.Conditions, savedConditions)
179184
if instance.Status.Conditions.IsUnknown(condition.ReadyCondition) {

controllers/telemetry_controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ func (r *TelemetryReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
113113
// Always patch the instance status when exiting this function so we can
114114
// persist any changes.
115115
defer func() {
116+
// Don't update the status, if reconciler Panics
117+
if r := recover(); r != nil {
118+
Log.Info(fmt.Sprintf("panic during reconcile %v\n", r))
119+
panic(r)
120+
}
116121
condition.RestoreLastTransitionTimes(
117122
&instance.Status.Conditions, savedConditions)
118123
if instance.Status.Conditions.IsUnknown(condition.ReadyCondition) {

0 commit comments

Comments
 (0)