How strrl/cloudflare-tunnel-ingress-controller works
Project type and purpose
• This is an open-source Kubernetes “Ingress Controller” / operator written in Go.
• It watches Kubernetes Ingress resources annotated with a special class (cloudflare-tunnel), automatically provisions or reuses a Cloudflare Tunnel, updates DNS, and runs “cloudflared” connector pods under the hood so that any Kubernetes Service can be exposed securely through Cloudflare’s network.
File structure
• cmd/cloudflare-tunnel-ingress-controller: the entry point (main.go) that sets up the controller loop.
• pkg/cloudflare-controller: logic for speaking to the Cloudflare API (tunnel creation, DNS record management, etc.).
• pkg/controller: Kubernetes controller logic (watching Ingress resources, creating connector pods, updating Ingress status, etc.).
• pkg/exposure: shared abstractions for constructing exposure configuration.
• helm/cloudflare-tunnel-ingress-controller: Helm Chart to package and deploy the controller as a Kubernetes Deployment, RBAC, ServiceAccount, etc.
• image/cloudflare-tunnel-ingress-controller/Dockerfile: container image for the controller and embedded “cloudflared” binary.
• hack/dev: example manifests for local development (namespaces, ingress-class, etc.).
• .github/workflows: CI pipelines for unit tests, integration tests, container image builds, Helm linting.
README for additional insights
• Describes how the controller bootstraps a Cloudflare Tunnel if it doesn’t exist, how users annotate a Kubernetes Ingress to route traffic, and how the Helm Chart parameters configure API tokens and account IDs.
• Emphasizes a feedback loop: user writes an Ingress → controller reconciles → calls Cloudflare API → deploys connector pods → updates DNS → traffic flows.
Final advice
• Be very detailed: break the controller into its two main subcomponents (K8s watcher vs. API client).
• Conditional logic (e.g., “if tunnel doesn’t exist → create”).