feat: per-listener dedicated Service type for external listeners#1350
Draft
feat: per-listener dedicated Service type for external listeners#1350
Conversation
…ices Add support for per-listener annotations and loadBalancerSourceRanges on ExternalListener. When an external listener has `annotations` set, it gets its own dedicated LoadBalancer Service per broker (named `lb-<listenerName>-<podName>`) instead of sharing the default per-broker LB (`lb-<podName>`). This enables use cases like: - external-1: private LB with private DNS (internal annotations) - external-2: public LB with public DNS (internet-facing annotations) Listeners without per-listener annotations continue to share the default per-broker LB, preserving full backwards compatibility. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…ener The TestHelmValuesCompat test requires the CRD ExternalListener type to have the same fields as the Helm chart ExternalListener so that CRD→Helm serialization round-trips correctly. Also regenerated the values schema. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Replace the implicit annotations-trigger-split model with an explicit Type field on ExternalListener. When Type is set on a listener, it gets its own dedicated per-broker Service of that type. When not set, it shares the default per-broker Service (existing behavior). This aligns more closely with Strimzi's design where each listener is an independent access path with its own service type, while maintaining full backwards compatibility. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Rebuilds the gen binary to match CI and regenerates the schema. This removes the stale top-level gateway section and ensures the schema matches what CI produces. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Update generated files to match CI's controller-gen v0.20.1 output: - values.go: fix field alignment in ExternalListener.AsString() - crd-docs.adoc: add docs for type, annotations, loadBalancerSourceRanges - zz_generated.deepcopy.go: add deepcopy for new ExternalListener fields - cluster.redpanda.com_redpandas.yaml: add CRD schema for new fields Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
This PR is stale because it has been open 5 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
|
This PR is stale because it has been open 5 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds opt-in support for per-listener Service type, enabling external listeners to get their own dedicated Service per broker instead of sharing the default one. This aligns with Strimzi's listener model where each listener is an independent access path, while maintaining full backwards compatibility.
Problem
Currently, all external listeners share a single LoadBalancer Service per broker (
lb-redpanda-0, etc.) with global annotations fromexternal.annotations. This makes it impossible to have:service.beta.kubernetes.io/aws-load-balancer-internal: "true")service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing)...because both listeners share the same Service and therefore the same annotations.
Solution
Three new optional fields on each external listener definition:
typeLoadBalancerorNodePortannotationsmap[string]stringtypeis set)loadBalancerSourceRanges[]stringtypeisLoadBalancer)Behavior
typeset (default): Listener ports are included in the sharedlb-<podName>Service — existing behavior, fully backwards compatibletypeset: Listener ports move to a dedicatedlb-<listenerName>-<podName>Service of the specified type. Those ports are excluded from the shared LBtypeset, the shared LB is not created (no empty Services)typeis the explicit opt-in —annotationsalone does not trigger a dedicated ServiceDesign alignment with Strimzi
Strimzi treats each listener as a fully independent access path with its own
type(LoadBalancer, NodePort, Ingress, etc.), and each listener always gets its own Services. Our design follows the same principle — thetypefield on a listener declares it as independent — but defaults to sharing whentypeis not set, preserving backwards compatibility.Examples
All examples below use the
RedpandaCRD (cluster.redpanda.com/v1alpha2). The same configuration works with Helm-only installs by placing theclusterSpeccontents directly invalues.yaml.Previous behavior: Single LB per broker (unchanged, still the default)
This is how external listeners work today and continues to work unchanged:
Result: One LB Service per broker, all listeners combined:
lb-redpanda-0aws-load-balancer-internal: "true"kafka-default:9094,admin-default:9645lb-redpanda-1aws-load-balancer-internal: "true"kafka-default:9094,admin-default:9645lb-redpanda-2aws-load-balancer-internal: "true"kafka-default:9094,admin-default:9645New: Dedicated LB per listener (opt-in via per-listener
type)Private listener on an internal LB, public listener on an internet-facing LB:
Result: Two LB Services per broker — private (shared) and public (dedicated):
lb-redpanda-0aws-load-balancer-internal: "true"kafka-private:9094,admin-private:9645lb-public-redpanda-0aws-load-balancer-scheme: internet-facingkafka-public:9095203.0.113.0/24lb-redpanda-1aws-load-balancer-internal: "true"kafka-private:9094,admin-private:9645lb-public-redpanda-1aws-load-balancer-scheme: internet-facingkafka-public:9095203.0.113.0/24lb-redpanda-2aws-load-balancer-internal: "true"kafka-private:9094,admin-private:9645lb-public-redpanda-2aws-load-balancer-scheme: internet-facingkafka-public:9095203.0.113.0/24New: All listeners dedicated (no shared LB)
When every listener has its own
type, no shared LB is created:Result: Two dedicated LBs per broker, no shared LB:
lb-private-redpanda-0aws-load-balancer-internal: "true"kafka-private:9094lb-public-redpanda-0aws-load-balancer-scheme: internet-facingkafka-public:9095lb-private-redpanda-1aws-load-balancer-internal: "true"kafka-private:9094lb-public-redpanda-1aws-load-balancer-scheme: internet-facingkafka-public:9095lb-private-redpanda-2aws-load-balancer-internal: "true"kafka-private:9094lb-public-redpanda-2aws-load-balancer-scheme: internet-facingkafka-public:9095GCP example: Internal and external LoadBalancers
Azure example: Internal and public LoadBalancers
Result: Per broker, one internal LB (shared, from global annotations) and one public LB (dedicated):
lb-redpanda-0azure-load-balancer-internal: "true"kafka-private:9094lb-public-redpanda-0azure-load-balancer-resource-group: my-rgkafka-public:9095lb-redpanda-1azure-load-balancer-internal: "true"kafka-private:9094lb-public-redpanda-1azure-load-balancer-resource-group: my-rgkafka-public:9095lb-redpanda-2azure-load-balancer-internal: "true"kafka-private:9094lb-public-redpanda-2azure-load-balancer-resource-group: my-rgkafka-public:9095Mixed Service types: LB + NodePort
The
typefield also enables mixed Service types — one listener as LoadBalancer, another as NodePort:Helm-only usage
The same configuration works without the Redpanda CRD by placing it directly in
values.yaml:Changes
charts/redpanda/values.goType,Annotations,LoadBalancerSourceRangestoExternalListener; addedHasDedicatedService(),ServicePortsForListener,ServicePortsExcludingListenersmethodscharts/redpanda/service.loadbalancer.goType: shared LB excludes dedicated listeners, new dedicated Service per listener name per broker with per-listener typeoperator/api/redpanda/v1alpha2/redpanda_clusterspec_types.goType,Annotations,LoadBalancerSourceRangesto CRDExternalListenercharts/redpanda/chart/templates/_service.loadbalancer.go.tplcharts/redpanda/chart/templates/_values.go.tplcharts/redpanda/chart/values.schema.jsoncharts/redpanda/values_partial.gen.goTest plan
typenot set)typeverifying dedicated Service creationtypesetTestHelmValuesCompatpasses (CRD↔Helm round-trip)🤖 Generated with Claude Code