Skip to content

Commit 4d0ee77

Browse files
Merge pull request #557 from ratailor/OSPRH-16970
Do not update status when reconciler exits due to panic
2 parents 69d208a + 70719ee commit 4d0ee77

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

controllers/ironic_controller.go

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

controllers/ironicapi_controller.go

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

controllers/ironicconductor_controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ func (r *IronicConductorReconciler) Reconcile(ctx context.Context, req ctrl.Requ
140140
// Always patch the instance status when exiting this function so we can
141141
// persist any changes.
142142
defer func() {
143+
// Don't update the status, if reconciler Panics
144+
if r := recover(); r != nil {
145+
Log.Info(fmt.Sprintf("panic during reconcile %v\n", r))
146+
panic(r)
147+
}
143148
condition.RestoreLastTransitionTimes(
144149
&instance.Status.Conditions, savedConditions)
145150
if instance.Status.Conditions.IsUnknown(condition.ReadyCondition) {

controllers/ironicinspector_controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ func (r *IronicInspectorReconciler) Reconcile(
165165
// Always patch the instance status when exiting this function so we can
166166
// persist any changes.
167167
defer func() {
168+
// Don't update the status, if reconciler Panics
169+
if r := recover(); r != nil {
170+
Log.Info(fmt.Sprintf("panic during reconcile %v\n", r))
171+
panic(r)
172+
}
168173
condition.RestoreLastTransitionTimes(
169174
&instance.Status.Conditions, savedConditions)
170175
if instance.Status.Conditions.IsUnknown(condition.ReadyCondition) {

controllers/ironicneutronagent_controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ func (r *IronicNeutronAgentReconciler) Reconcile(
138138
// Always patch the instance status when exiting this function so we can
139139
// persist any changes.
140140
defer func() {
141+
// Don't update the status, if reconciler Panics
142+
if r := recover(); r != nil {
143+
Log.Info(fmt.Sprintf("panic during reconcile %v\n", r))
144+
panic(r)
145+
}
141146
condition.RestoreLastTransitionTimes(
142147
&instance.Status.Conditions, savedConditions)
143148
if instance.Status.Conditions.IsUnknown(condition.ReadyCondition) {

0 commit comments

Comments
 (0)