Skip to content

fix: make Project Contour ingress integration opt-in (crash loop without HTTPProxy CRD)#272

Open
amuraru wants to merge 1 commit into
masterfrom
fix/contour-httpproxy-optional
Open

fix: make Project Contour ingress integration opt-in (crash loop without HTTPProxy CRD)#272
amuraru wants to merge 1 commit into
masterfrom
fix/contour-httpproxy-optional

Conversation

@amuraru

@amuraru amuraru commented Jul 11, 2026

Copy link
Copy Markdown

Problem

Installing the operator on a cluster without Project Contour puts the pod in CrashLoopBackOff — even when Contour ingress is never used. This is the crash loop reported in #229.

Root cause: the KafkaCluster controller unconditionally registers a watch on Project Contour's HTTPProxy CRD:

// controllers/kafkacluster_controller.go
contourWatches(builder)   // -> Owns(&contour.HTTPProxy{})

When the projectcontour.io/v1 HTTPProxy CRD is absent, controller-runtime can never sync that informer, so mgr.Start fails with:

failed to wait for KafkaCluster caches to sync kind source: *v1.HTTPProxy: timed out waiting for cache to be synced

…and the process exits → crash loop. The Helm chart never shipped or required the Contour CRD, so a clean install is broken out of the box (the reporter's workaround was to manually kubectl apply the Contour CRDs).

This unconditional watch was introduced in #82 ("Adding Contour Ingress support").

Fix (Option A: opt-in flag, mirroring cert-manager)

  • New --contour-enabled flag (default false), matching the existing --cert-manager-enabled pattern. The Contour HTTPProxy watch is only registered when it's set.
  • Wired through the Helm chart as contour.enabled (default false) → --contour-enabled={{ .Values.contour.enabled }}.
  • Default installs now start cleanly with no dependency on Project Contour. Users of ingressController: contour opt in via contour.enabled=true (which requires the HTTPProxy CRD to be installed).

Tests

  • New regression test controllers/tests/contourwatch: boots an envtest API server without the Contour CRD and asserts the manager stays healthy when Contour is disabled. Verified it fails before the fix (reproduces the exact *v1.HTTPProxy sync timeout) and passes after (TDD red→green).
  • Existing Contour integration specs (Label("contour")) still pass with contour.enabled=true.
  • The e2e suite installs Contour as a dependency, so it now sets contour.enabled=true to keep exercising the integration end-to-end.

Upgrade note

Deployments that rely on Contour ingress must set contour.enabled=true after this change (previously always-on). Default/envoy users are unaffected and no longer need the Contour CRD.

Notes

Fixes #229
Introduced by #82

🤖 Generated with Claude Code

The KafkaCluster controller unconditionally registered a watch on Project
Contour's HTTPProxy CRD (Owns(&contour.HTTPProxy{}), added in #82). On any
cluster without Project Contour installed, controller-runtime could never sync
the HTTPProxy informer, so the manager failed to start ("failed to wait for
KafkaCluster caches to sync kind source: *v1.HTTPProxy") and the operator pod
entered CrashLoopBackOff -- even when Contour ingress was never used.

Gate the Contour watch behind a new --contour-enabled flag (default false),
mirroring the existing --cert-manager-enabled pattern, and wire it through the
Helm chart (contour.enabled, default false). Default installs now start cleanly
without Project Contour's CRD; users of `ingressController: contour` opt in via
contour.enabled=true (which requires the HTTPProxy CRD to be installed).

Add an envtest regression test that boots a manager without the Contour CRD and
asserts it stays healthy when Contour is disabled. The e2e suite, which installs
Contour as a dependency, sets contour.enabled=true to keep exercising the
integration.

Fixes #229
Introduced by #82

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@amuraru amuraru requested a review from dobrerazvan July 11, 2026 13:13
@amuraru

amuraru commented Jul 11, 2026

Copy link
Copy Markdown
Author

cc @dobrerazvan — this gates the Project Contour HTTPProxy watch you added in #82 behind a new --contour-enabled flag (default off), so default installs no longer crash-loop without the Contour CRD (#229). Would appreciate your review, especially the upgrade note: deployments using ingressController: contour must now set contour.enabled=true.

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.

Fix Kafka Operator Crash Loop - Dependency of Project Contour's HTTPProxy Custom Resource Definition (CRD)

1 participant