Skip to content

feat(controllers): add --controllers feature flag to enable/disable controllers per cluster#18

Merged
igoramf merged 13 commits into
mainfrom
feat/controller-feature-flags
May 29, 2026
Merged

feat(controllers): add --controllers feature flag to enable/disable controllers per cluster#18
igoramf merged 13 commits into
mainfrom
feat/controller-feature-flags

Conversation

@igoramf
Copy link
Copy Markdown
Collaborator

@igoramf igoramf commented May 28, 2026

Summary

  • Each controller now has a unique ControllerName constant as its identifier
  • New --controllers flag (and controllers.enabled Helm value) controls which controllers start at runtime — default ["*"] preserves existing behavior
  • parseControllers validates the list at startup; unknown names are fatal errors
  • Each of the 5 controllers/API is gated behind if enabled(...) in main.go
  • Fixes the hub cluster crash caused by DecofileReconciler watching Revision.serving.knative.dev — set controllers.enabled: [decoredirect, operator-api] to disable decofile on hub

Usage

Hub cluster (infra_applications/hub/values.yaml):

controllers:
  enabled:
    - decoredirect
    - operator-api

All controllers (default):

controllers:
  enabled:
    - "*"

Invalid name → fatal error on startup:

ERROR  invalid --controllers flag  {"error": "unknown controller \"xpto\"; valid values: namespace, decofile, deco, decoredirect, operator-api"}

Test Plan

  • make test passes
  • helm template --set 'controllers.enabled[0]=decoredirect' --set 'controllers.enabled[1]=operator-api' renders --controllers=decoredirect,operator-api
  • helm template (default) renders no --controllers arg
  • Deploy to hub cluster with controllers.enabled: [decoredirect, operator-api] — operator starts without Knative crash

🤖 Generated with Claude Code


Summary by cubic

Adds a --controllers runtime flag and controllers.enabled Helm value to turn controllers on/off per cluster. Default enables all; on the hub you can disable decofile to avoid the Knative Revision crash.

  • New Features

    • --controllers (comma-separated names or "*"); unknown names fail fast with a clear error.
    • Controllers in cmd/main.go are gated via enabled(...); Valkey init/watchers and metrics run only when tenant is enabled; webhooks only when decofile is enabled.
    • Helm controllers.enabled; chart injects the flag only when not using ["*"]; parser tests added; hack/helm-generator injects the arg.
    • Build fix: Dockerfile and Makefile now build ./cmd to include new cmd/controllers.go.
  • Refactors

    • Renamed NamespaceReconciler to TenantReconciler.
    • Added ControllerName constants for tenant, decofile, deco, decoredirect, and operator-api.

Written for commit 84ca738. Summary will update on new commits.

Review in cubic

nicacioliveira
nicacioliveira previously approved these changes May 28, 2026
hugo-ccabral
hugo-ccabral previously approved these changes May 29, 2026
@igoramf igoramf dismissed stale reviews from hugo-ccabral and nicacioliveira via aa16b8d May 29, 2026 13:44
@igoramf igoramf merged commit d3040a5 into main May 29, 2026
5 checks passed
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.

3 participants