Skip to content

fix(applications): wire newArgocdClientFn in Application controller connector - #373

Open
gravufo wants to merge 1 commit into
crossplane-contrib:mainfrom
gravufo:fix/application-controller-nil-client-connector
Open

fix(applications): wire newArgocdClientFn in Application controller connector#373
gravufo wants to merge 1 commit into
crossplane-contrib:mainfrom
gravufo:fix/application-controller-nil-client-connector

Conversation

@gravufo

@gravufo gravufo commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #372.

Setup() for the Application controller built its connector without setting newArgocdClientFn, leaving it nil. Every Connect() call then invokes that nil function pointer inside NewExternal(), panicking on every reconcile. controller-runtime recovers the panic and requeues with backoff instead of crashing, so the resource silently never gets its status populated — no error, no event, nothing beyond a bare Reconciling log line forever.

This brings applications/controller.go in line with projects/controller.go and cluster/controller.go, which already wire their respective newArgocdClientFn (projects.NewProjectServiceClient, etc.) into the connector.

Change

func Setup(mgr ctrl.Manager, o xpcontroller.Options) error {
	return SetupWithExternalConnector(mgr, o, &connector{
		kube:              mgr.GetClient(),
		newArgocdClientFn: applications.NewApplicationServiceClient,
	})
}

Test plan

  • go build ./pkg/controller/cluster/applications/...
  • go vet ./pkg/controller/cluster/applications/...
  • Verified in a live cluster: before the fix, Application managed resources never populated .status and the controller logged only a repeating bare Reconciling line with no follow-up (unlike Cluster/Project, which log the full observe/update sequence). Manually patching .status directly on the object and observing it survive multiple poll cycles untouched confirmed the controller was never reaching any status-updating code path.

@gravufo
gravufo force-pushed the fix/application-controller-nil-client-connector branch from 6b403d9 to a1aa899 Compare August 24, 2026 21:33
…onnector

Setup() built the connector without setting newArgocdClientFn (unlike every
other controller, e.g. projects), leaving it nil. Connect() -> NewExternal()
then invokes that nil function pointer, which panics. controller-runtime
recovers the panic and requeues with backoff instead of crashing, so the
Application managed resource silently never reconciles: no error is logged,
no event is recorded, and .status is never populated, even though the
underlying ArgoCD Application is healthy.

Signed-off-by: Christian Artin <cartin@genetec.com>
@gravufo
gravufo force-pushed the fix/application-controller-nil-client-connector branch from a1aa899 to eba4e73 Compare August 24, 2026 21:37
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.

Application controller never reconciles: nil newArgocdClientFn panics on Connect

1 participant