Skip to content

only handle requeue_after if the run is successful #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gaelgatelement
Copy link
Contributor

@gaelgatelement gaelgatelement commented Mar 24, 2025

Description of the change:
Handle nil presence in the event of failure.

Motivation for the change
If there's a fatal error on requeue_after for example due to a wrong call :

- operator_sdk.util.requeue_after:
  time: {}

The controller panics :

}
{"level":"info","ts":"2024-03-11T16:45:56Z","msg":"Observed a panic in reconciler: interface conversion: interface {} is nil, not string","controller":"elementdeployment-controller","object":{"name":"instance-fa8e320aa36f3185","namespace":"element-tests-fa8e32"},"namespace":"element-tests-fa8e32","name":"instance-fa8e320aa36f3185","reconcileID":"83f6b092-0335-42ba-ba7d-e15ae2f93e42"}
panic: interface conversion: interface {} is nil, not string [recovered]
        panic: interface conversion: interface {} is nil, not string

goroutine 164 [running]:
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile.func1()
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:116 +0x1e5
panic({0x192af60?, 0xc000e68900?})
        /usr/local/go/src/runtime/panic.go:770 +0x132
github.com/operator-framework/ansible-operator-plugins/internal/ansible/controller.(*AnsibleOperatorReconciler).Reconcile(0xc000134e10, {0x1e4ca28, 0xc000528330}, {{{0xc0004f9608?, 0x5?}, {0xc0004812a0?, 0xc000383d10?}}})
        ansible-operator-plugins/internal/ansible/controller/reconcile.go:194 +0x27e5
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0x1e51758?, {0x1e4ca28?, 0xc000528330?}, {{{0xc0004f9608?, 0xb?}, {0xc0004812a0?, 0x0?}}})
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:119 +0xb7
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc0004c1860, {0x1e4ca60, 0xc0004beaa0}, {0x19ab0c0, 0xc000522020})
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:316 +0x3bc
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc0004c1860, {0x1e4ca60, 0xc0004beaa0})
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:266 +0x1be
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:227 +0x79
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2 in goroutine 133
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:223 +0x50c

@openshift-ci openshift-ci bot requested review from fabianvf and joelanford March 24, 2025 16:23
@gaelgatelement gaelgatelement changed the title only hanlded requeue_after if the run is successful only handle requeue_after if the run is successful Mar 24, 2025
@acornett21
Copy link
Contributor

acornett21 commented May 20, 2025

Hi @gaelgatelement sorry for the delay on this, I only work on this in my free time. The extreme nesting of this code makes it very hard to read and isn't very go-idiomatic.

Is it possible to:

  • add another test that covers this?
  • provide an example for others to test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants