fix(kafka)!: require SCRAM-SHA-512 on the external listener

With external access on, the chart opens a listener on port 9094 of a
public LoadBalancer address, and it rendered that listener without any
authentication: whoever reached the address could produce and consume
on every topic. TLS on that listener only encrypts the session.

The KafkaUser name carries the release name because it is also the
SCRAM username and the name of its Secret, and two instances in one
namespace may declare the same user. A dot joins the two because a
user Secret readable by the tenant must never take the name of a
Secret Strimzi derives from a cluster name, and neither a release name
nor any of those Secrets can hold a dot.

BREAKING CHANGE: an instance with external access enabled refuses
clients that do not authenticate. The Kafka README gives the upgrade
sequences.

Assisted-by: LLM
Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
This commit is contained in:
Mattia Eleuteri authored and Aleksei Sviridkin committed 2026-11-23 14:11:55 +01:00
1 parent 7b9b4347b2
commit 9ecff91b74
13 files changed
+416 -21

No files matched your search

+8 -2
View File
@@ -18,7 +18,7 @@ type Config struct {
}
type ConfigSpec struct {
// Enable external access from outside the cluster.
// Enable external access from outside the cluster. The external listener (port 9094) accepts only clients that authenticate with SCRAM-SHA-512 as one of the `users`.
// +kubebuilder:default:=false
External bool `json:"external"`
// TLS configuration. Strimzi manages the cluster PKI automatically (no cert-manager is involved for this chart): the operator auto-creates `<release>-cluster-ca-cert` and `<release>-clients-ca-cert` secrets, both exposed for client trust setup. The internal TLS listener on 9093 is always on; this toggle only controls the external listener on 9094.
@@ -27,6 +27,9 @@ type ConfigSpec struct {
// Kafka version to deploy. Upgrade-only: once a cluster's KRaft metadata is at a given version, Strimzi refuses an in-place downgrade, so lowering this on a running cluster (e.g. v4.3 back to v4.2) leaves the Kafka CR stuck in a reconcile error. Pick the target version at creation and only ever raise it.
// +kubebuilder:default:="v4.3"
Version Version `json:"version"`
// Users allowed on the external listener. Each key `<name>` (lowercase letters, digits and `-`) becomes the SCRAM-SHA-512 username `<release>.<name>`, where `<release>` is `kafka-<application name>`, and its generated password is written to the Secret of the same name (keys `password` and `sasl.jaas.config`). Every user can read and write every topic.
// +kubebuilder:default:={}
Users map[string]User `json:"users,omitempty"`
// Topics configuration.
// +kubebuilder:default:={}
Topics []Topic `json:"topics,omitempty"`
@@ -69,7 +72,7 @@ type Resources struct {
}
type TLS struct {
// Enable TLS on the external listener. When unset, inherits the value of `external` (TLS is on when external access is enabled). Warning: setting this to false while external is true exposes Kafka over plaintext on a public IP via LoadBalancer. Strimzi does not provide authentication on this listener unless SCRAM, mTLS, or OAuth is separately configured. Use only in controlled networks.
// Enable TLS on the external listener. When unset, inherits the value of `external` (TLS is on when external access is enabled). The external listener always requires SCRAM-SHA-512 credentials from `users`; setting this to false while external is true sends all data unencrypted over a public IP and exposes the SCRAM authentication exchange to anyone on the path, although not the password itself, so use it only in controlled networks.
Enabled *bool `json:"enabled,omitempty"`
}
@@ -84,6 +87,9 @@ type Topic struct {
Replicas int `json:"replicas"`
}
type User struct {
}
// +kubebuilder:validation:Enum="t1.nano";"t1.micro";"t1.small";"t1.medium";"t1.large";"t1.xlarge";"t1.2xlarge";"t1.4xlarge";"c1.nano";"c1.micro";"c1.small";"c1.medium";"c1.large";"c1.xlarge";"c1.2xlarge";"c1.4xlarge";"s1.nano";"s1.micro";"s1.small";"s1.medium";"s1.large";"s1.xlarge";"s1.2xlarge";"s1.4xlarge";"u1.nano";"u1.micro";"u1.small";"u1.medium";"u1.large";"u1.xlarge";"u1.2xlarge";"u1.4xlarge";"m1.nano";"m1.micro";"m1.small";"m1.medium";"m1.large";"m1.xlarge";"m1.2xlarge";"m1.4xlarge";"nano";"micro";"small";"medium";"large";"xlarge";"2xlarge"
type ResourcesPreset string
+22
View File
@@ -54,6 +54,13 @@ func (in *Config) DeepCopyObject() runtime.Object {
func (in *ConfigSpec) DeepCopyInto(out *ConfigSpec) {
*out = *in
in.Tls.DeepCopyInto(&out.Tls)
if in.Users != nil {
in, out := &in.Users, &out.Users
*out = make(map[string]User, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.Topics != nil {
in, out := &in.Topics, &out.Topics
*out = make([]Topic, len(*in))
@@ -148,3 +155,18 @@ func (in *Topic) DeepCopy() *Topic {
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *User) DeepCopyInto(out *User) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new User.
func (in *User) DeepCopy() *User {
if in == nil {
return nil
}
out := new(User)
in.DeepCopyInto(out)
return out
}
@@ -0,0 +1,77 @@
package lineagecontrollerwebhook
import (
"context"
"os"
"testing"
cozyv1alpha1 "github.com/cozystack/cozystack/api/v1alpha1"
"sigs.k8s.io/yaml"
)
// TestKafkaRDSecrets_KafkaUserCredentialsAreTenantResources runs the Secrets
// the Strimzi User Operator writes for a Kafka instance through the Kafka
// ApplicationDefinition's selectors, as computeLabels does. A user's password
// Secret must be a tenant resource, or the tenant-secret API hides the
// credentials external clients need. A selector whose label value carried a
// template, such as strimzi.io/cluster: kafka-{{ .name }}, never matched,
// since only resourceNames are rendered.
func TestKafkaRDSecrets_KafkaUserCredentialsAreTenantResources(t *testing.T) {
raw, err := os.ReadFile("../../packages/system/kafka-rd/cozyrds/kafka.yaml")
if err != nil {
t.Fatalf("read kafka ApplicationDefinition: %v", err)
}
var appDef cozyv1alpha1.ApplicationDefinition
if err := yaml.Unmarshal(raw, &appDef); err != nil {
t.Fatalf("parse kafka ApplicationDefinition: %v", err)
}
// The context computeLabels builds for a Secret owned by the Kafka
// application "events" in tenant-test.
templateContext := map[string]string{"kind": "kafka", "name": "events", "namespace": "tenant-test"}
cases := []struct {
name string
objName string
labels map[string]string
want bool
}{
{
name: "a KafkaUser's generated credentials",
objName: "kafka-events.app",
labels: map[string]string{
"strimzi.io/cluster": "kafka-events",
"strimzi.io/kind": "KafkaUser",
"app.kubernetes.io/instance": "app",
"app.kubernetes.io/managed-by": "strimzi-user-operator",
},
want: true,
},
{
name: "the clients CA certificate",
objName: "kafka-events-clients-ca-cert",
labels: map[string]string{"strimzi.io/cluster": "kafka-events", "strimzi.io/kind": "Kafka"},
want: true,
},
{
name: "the clients CA private key",
objName: "kafka-events-clients-ca",
labels: map[string]string{"strimzi.io/cluster": "kafka-events", "strimzi.io/kind": "Kafka"},
want: false,
},
{
name: "the broker certificates",
objName: "kafka-events-kafka-brokers",
labels: map[string]string{"strimzi.io/cluster": "kafka-events", "strimzi.io/kind": "Kafka"},
want: false,
},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
got := matchResourceToExcludeInclude(context.Background(), tc.objName, templateContext, tc.labels, &appDef.Spec.Secrets)
if got != tc.want {
t.Errorf("tenant resource = %v, want %v", got, tc.want)
}
})
}
}
+60 -13
View File
@@ -26,23 +26,24 @@ Neither lowering the `version` field on a running cluster nor rolling the app ba
### Common parameters
| Name | Description | Type | Value |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- |
| `external` | Enable external access from outside the cluster. | `bool` | `false` |
| `tls` | TLS configuration. Strimzi manages the cluster PKI automatically (no cert-manager is involved for this chart): the operator auto-creates `<release>-cluster-ca-cert` and `<release>-clients-ca-cert` secrets, both exposed for client trust setup. The internal TLS listener on 9093 is always on; this toggle only controls the external listener on 9094. | `object` | `{}` |
| `tls.enabled` | Enable TLS on the external listener. When unset, inherits the value of `external` (TLS is on when external access is enabled). Warning: setting this to false while external is true exposes Kafka over plaintext on a public IP via LoadBalancer. Strimzi does not provide authentication on this listener unless SCRAM, mTLS, or OAuth is separately configured. Use only in controlled networks. | `*bool` | `null` |
| `version` | Kafka version to deploy. Upgrade-only: once a cluster's KRaft metadata is at a given version, Strimzi refuses an in-place downgrade, so lowering this on a running cluster (e.g. v4.3 back to v4.2) leaves the Kafka CR stuck in a reconcile error. Pick the target version at creation and only ever raise it. | `string` | `v4.3` |
| Name | Description | Type | Value |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- |
| `external` | Enable external access from outside the cluster. The external listener (port 9094) accepts only clients that authenticate with SCRAM-SHA-512 as one of the `users`. | `bool` | `false` |
| `tls` | TLS configuration. Strimzi manages the cluster PKI automatically (no cert-manager is involved for this chart): the operator auto-creates `<release>-cluster-ca-cert` and `<release>-clients-ca-cert` secrets, both exposed for client trust setup. The internal TLS listener on 9093 is always on; this toggle only controls the external listener on 9094. | `object` | `{}` |
| `tls.enabled` | Enable TLS on the external listener. When unset, inherits the value of `external` (TLS is on when external access is enabled). The external listener always requires SCRAM-SHA-512 credentials from `users`; setting this to false while external is true sends all data unencrypted over a public IP and exposes the SCRAM authentication exchange to anyone on the path, although not the password itself, so use it only in controlled networks. | `*bool` | `null` |
| `version` | Kafka version to deploy. Upgrade-only: once a cluster's KRaft metadata is at a given version, Strimzi refuses an in-place downgrade, so lowering this on a running cluster (e.g. v4.3 back to v4.2) leaves the Kafka CR stuck in a reconcile error. Pick the target version at creation and only ever raise it. | `string` | `v4.3` |
### Application-specific parameters
| Name | Description | Type | Value |
| ---------------------- | --------------------- | ---------- | ------ |
| `topics` | Topics configuration. | `[]object` | `[]` |
| `topics[i].name` | Topic name. | `string` | `""` |
| `topics[i].partitions` | Number of partitions. | `int` | `0` |
| `topics[i].replicas` | Number of replicas. | `int` | `0` |
| `topics[i].config` | Topic configuration. | `*object` | `null` |
| Name | Description | Type | Value |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ------ |
| `users` | Users allowed on the external listener. Each key `<name>` (lowercase letters, digits and `-`) becomes the SCRAM-SHA-512 username `<release>.<name>`, where `<release>` is `kafka-<application name>`, and its generated password is written to the Secret of the same name (keys `password` and `sasl.jaas.config`). Every user can read and write every topic. | `map[string]object` | `{}` |
| `topics` | Topics configuration. | `[]object` | `[]` |
| `topics[i].name` | Topic name. | `string` | `""` |
| `topics[i].partitions` | Number of partitions. | `int` | `0` |
| `topics[i].replicas` | Number of replicas. | `int` | `0` |
| `topics[i].config` | Topic configuration. | `*object` | `null` |
### Kafka configuration
@@ -105,3 +106,49 @@ topics:
partitions: 1
replicas: 3
```
## External access and SCRAM-SHA-512
The external listener (port 9094) accepts only clients that authenticate with SCRAM-SHA-512 as one of the `users`. For a user `app` of the application `events`, the User Operator writes the generated password to the Secret `kafka-events.app` in the application's namespace. Its `sasl.jaas.config` key holds a ready-made JAAS line, and the username is the Secret's name.
A client needs:
```properties
bootstrap.servers=<external address of kafka-events-kafka-external-bootstrap>:9094
security.protocol=SASL_SSL
sasl.mechanism=SCRAM-SHA-512
sasl.jaas.config=<the sasl.jaas.config key of the Secret kafka-events.app>
ssl.truststore.type=PEM
ssl.truststore.location=/path/to/ca.crt
```
`ca.crt` comes from the Secret `kafka-events-cluster-ca-cert`: the cluster CA signs the external listener's certificate. With `tls.enabled: false`, use `security.protocol=SASL_PLAINTEXT` and no truststore.
### Upgrading an instance that has external access
Versions before this one accepted anonymous clients on the external listener. The upgrade turns on SCRAM-SHA-512 and creates the declared `users` in the same step, so a client cannot hold credentials before it needs them. Pick one of two sequences.
**Maintenance window.** Declare the `users` and upgrade. External clients are refused from the moment the brokers restart with authentication on until they are given their Secret and the settings above.
**Credentials staged ahead.** The User Operator already runs on the previous version and creates SCRAM credentials for any `KafkaUser`, even while the listener does not ask for them. A cluster administrator creates, for each user, the `KafkaUser` the new chart will render, with the ownership metadata Helm needs to adopt it:
```yaml
apiVersion: kafka.strimzi.io/v1
kind: KafkaUser
metadata:
name: kafka-events.app
namespace: <namespace>
labels:
strimzi.io/cluster: kafka-events
app.kubernetes.io/managed-by: Helm
annotations:
meta.helm.sh/release-name: kafka-events
meta.helm.sh/release-namespace: <namespace>
spec:
authentication:
type: scram-sha-512
```
On a platform whose Strimzi still serves only `kafka.strimzi.io/v1beta2`, create it with that `apiVersion` instead; the platform upgrade's API conversion carries it over to `v1`.
The administrator then hands each client its Secret and the settings above, kept ready but not applied: a client that offers SASL to the old listener is refused. The same `users` are then declared and the application upgraded; Helm adopts the existing `KafkaUser`, so the password does not change, and each client switches to its new settings once the brokers have restarted.
@@ -21,6 +21,9 @@ rules:
resourceNames:
- {{ .Release.Name }}-clients-ca-cert
- {{ .Release.Name }}-cluster-ca-cert
{{- range $user, $u := .Values.users }}
- {{ $.Release.Name }}.{{ $user }}
{{- end }}
verbs: ["get", "list", "watch"]
- apiGroups:
- cozystack.io
+5
View File
@@ -41,6 +41,11 @@ spec:
port: 9094
type: loadbalancer
tls: {{ $tlsEnabled }}
{{- /* The listener sits on a public LoadBalancer address, so it never
accepts an anonymous client. Credentials come from the KafkaUsers
rendered in users.yaml. */}}
authentication:
type: scram-sha-512
{{- end }}
config:
{{- if eq (int .Values.kafka.replicas) 1 }}
+30
View File
@@ -0,0 +1,30 @@
{{- /*
Each KafkaUser name is also its SCRAM username and the name of the Secret the
User Operator writes its generated password into, and the tenant can read
that Secret. A dot joins the release and the user because no other Secret in
the namespace can take that name: application names are DNS-1035 labels, so
no release name holds a dot, and Strimzi names every Secret of a cluster,
per-node certificates included, from its cluster name with hyphens only. With
a hyphen, a user name could spell another release's CA key or a node's
private key, since <release>-<user> and <other-release>-<suffix> overlap.
*/}}
{{- range $user, $u := .Values.users }}
{{- if not (regexMatch "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" $user) }}
{{- fail (printf "invalid Kafka user name %q: it may contain only lowercase letters, digits and \"-\", and must start and end with a letter or a digit (it becomes part of a Kubernetes object name)" $user) }}
{{- end }}
{{- if gt (len (printf "%s.%s" $.Release.Name $user)) 253 }}
{{- fail (printf "Kafka user name %q is too long: %s.%s, its KafkaUser and Secret name, must fit in 253 characters" $user $.Release.Name $user) }}
{{- end }}
---
apiVersion: kafka.strimzi.io/v1
kind: KafkaUser
metadata:
name: {{ $.Release.Name }}.{{ $user }}
labels:
strimzi.io/cluster: {{ $.Release.Name }}
app.kubernetes.io/instance: {{ $.Release.Name }}
app.kubernetes.io/managed-by: {{ $.Release.Service }}
spec:
authentication:
type: scram-sha-512
{{- end }}
@@ -0,0 +1,165 @@
suite: external listener requires SCRAM-SHA-512 credentials
# With external: true the chart opens port 9094 on a public LoadBalancer
# address. It used to render that listener without an authentication block, so
# any client that reached the address could produce and consume.
templates:
- templates/kafka.yaml
- templates/users.yaml
- templates/dashboard-resourcemap.yaml
release:
name: kafka-test
namespace: tenant-test
tests:
- it: requires SCRAM-SHA-512 on the external listener
template: templates/kafka.yaml
set:
external: true
asserts:
- contains:
path: spec.kafka.listeners
content:
name: external
port: 9094
type: loadbalancer
tls: true
authentication:
type: scram-sha-512
- it: keeps requiring credentials when TLS is turned off on the external listener
template: templates/kafka.yaml
set:
external: true
tls:
enabled: false
asserts:
- contains:
path: spec.kafka.listeners
content:
name: external
port: 9094
type: loadbalancer
tls: false
authentication:
type: scram-sha-512
- it: leaves the internal listeners as they are
template: templates/kafka.yaml
set:
external: true
asserts:
- contains:
path: spec.kafka.listeners
content:
name: plain
port: 9092
type: internal
tls: false
- contains:
path: spec.kafka.listeners
content:
name: tls
port: 9093
type: internal
tls: true
- it: renders no external listener without external access
template: templates/kafka.yaml
asserts:
- lengthEqual:
path: spec.kafka.listeners
count: 2
- it: renders no KafkaUser by default
template: templates/users.yaml
asserts:
- hasDocuments:
count: 0
- it: declares one SCRAM-SHA-512 KafkaUser per user, named after the release
template: templates/users.yaml
set:
users:
app: {}
analytics: {}
asserts:
- hasDocuments:
count: 2
- isKind:
of: KafkaUser
- equal:
path: spec.authentication.type
value: scram-sha-512
- equal:
path: metadata.labels["strimzi.io/cluster"]
value: kafka-test
- matchRegex:
path: metadata.name
pattern: ^kafka-test\.(analytics|app)$
- it: lets the tenant read each user's generated credentials Secret
template: templates/dashboard-resourcemap.yaml
set:
users:
app: {}
documentSelector:
path: kind
value: Role
asserts:
- contains:
path: rules
content:
apiGroups: [""]
resources: [secrets]
resourceNames:
- kafka-test-clients-ca-cert
- kafka-test-cluster-ca-cert
- kafka-test.app
verbs: ["get", "list", "watch"]
- it: refuses a user name that is not a valid object name
template: templates/users.yaml
set:
users:
App_1: {}
asserts:
- failedTemplate:
errorPattern: 'invalid Kafka user name "App_1"'
# Under a hyphen join these keys spelled Secrets Strimzi owns: this
# release's cluster CA certificate, broker 0's certificate of a migrated
# cluster, and the cluster CA key of a release named kafka-test-other.
- it: names no user's credentials after a Secret Strimzi owns
template: templates/users.yaml
set:
users:
cluster-ca-cert: {}
kafka-0: {}
other-cluster-ca: {}
asserts:
- hasDocuments:
count: 3
- matchRegex:
path: metadata.name
pattern: ^kafka-test\.(cluster-ca-cert|kafka-0|other-cluster-ca)$
- it: refuses a user whose KafkaUser name would pass 253 characters
template: templates/users.yaml
set:
users:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: {}
asserts:
- failedTemplate:
errorPattern: 'is too long: kafka-test\.a+, its KafkaUser and Secret name, must fit in 253 characters'
- it: accepts a user whose KafkaUser name is exactly 253 characters
template: templates/users.yaml
set:
users:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: {}
asserts:
- hasDocuments:
count: 1
@@ -154,6 +154,8 @@ tests:
port: 9094
type: loadbalancer
tls: false
authentication:
type: scram-sha-512
- notContains:
path: spec.kafka.listeners
content:
@@ -161,6 +163,8 @@ tests:
port: 9094
type: loadbalancer
tls: true
authentication:
type: scram-sha-512
- it: creates external loadbalancer listener with tls when external is true
release:
@@ -176,6 +180,8 @@ tests:
port: 9094
type: loadbalancer
tls: true
authentication:
type: scram-sha-512
- it: configures internal listeners by default and omits external
release:
@@ -23,6 +23,8 @@ tests:
port: 9094
type: loadbalancer
tls: true
authentication:
type: scram-sha-512
# Case 2: external=false, tls.enabled unset → no external listener at all
- it: does not create external listener when external is false and tls.enabled is unset
@@ -52,6 +54,8 @@ tests:
port: 9094
type: loadbalancer
tls: false
authentication:
type: scram-sha-512
# Case 4: external=true, tls.enabled=true → explicit TLS on listener
- it: enables TLS on external listener when tls.enabled is explicitly true
@@ -69,6 +73,8 @@ tests:
port: 9094
type: loadbalancer
tls: true
authentication:
type: scram-sha-512
# Case 5b: external=false, tls.enabled=false → no external listener (both explicitly false)
- it: does not create external listener when both external and tls.enabled are explicitly false
@@ -116,6 +122,8 @@ tests:
port: 9094
type: loadbalancer
tls: true
authentication:
type: scram-sha-512
# J-2: external=true, tls.enabled=false → explicit override wins: TLS is off
- it: "kindIs-guard: explicit tls.enabled=false overrides external=true"
@@ -133,6 +141,8 @@ tests:
port: 9094
type: loadbalancer
tls: false
authentication:
type: scram-sha-512
# J-3: external=false, tls.enabled=true → external gate wins: no listener rendered
- it: "kindIs-guard: external gate suppresses listener even when tls.enabled=true"
+10 -2
View File
@@ -8,7 +8,7 @@
},
"properties": {
"external": {
"description": "Enable external access from outside the cluster.",
"description": "Enable external access from outside the cluster. The external listener (port 9094) accepts only clients that authenticate with SCRAM-SHA-512 as one of the `users`.",
"type": "boolean",
"default": false
},
@@ -18,7 +18,7 @@
"default": {},
"properties": {
"enabled": {
"description": "Enable TLS on the external listener. When unset, inherits the value of `external` (TLS is on when external access is enabled). Warning: setting this to false while external is true exposes Kafka over plaintext on a public IP via LoadBalancer. Strimzi does not provide authentication on this listener unless SCRAM, mTLS, or OAuth is separately configured. Use only in controlled networks.",
"description": "Enable TLS on the external listener. When unset, inherits the value of `external` (TLS is on when external access is enabled). The external listener always requires SCRAM-SHA-512 credentials from `users`; setting this to false while external is true sends all data unencrypted over a public IP and exposes the SCRAM authentication exchange to anyone on the path, although not the password itself, so use it only in controlled networks.",
"type": "boolean"
}
}
@@ -32,6 +32,14 @@
"v4.2"
]
},
"users": {
"description": "Users allowed on the external listener. Each key `\u003cname\u003e` (lowercase letters, digits and `-`) becomes the SCRAM-SHA-512 username `\u003crelease\u003e.\u003cname\u003e`, where `\u003crelease\u003e` is `kafka-\u003capplication name\u003e`, and its generated password is written to the Secret of the same name (keys `password` and `sasl.jaas.config`). Every user can read and write every topic.",
"type": "object",
"default": {},
"additionalProperties": {
"type": "object"
}
},
"topics": {
"description": "Topics configuration.",
"type": "array",
+11 -2
View File
@@ -5,11 +5,11 @@
## @section Common parameters
##
## @param {bool} external - Enable external access from outside the cluster.
## @param {bool} external - Enable external access from outside the cluster. The external listener (port 9094) accepts only clients that authenticate with SCRAM-SHA-512 as one of the `users`.
external: false
## @typedef {struct} TLS - TLS configuration for the external listener.
## @field {*bool} enabled - Enable TLS on the external listener. When unset, inherits the value of `external` (TLS is on when external access is enabled). Warning: setting this to false while external is true exposes Kafka over plaintext on a public IP via LoadBalancer. Strimzi does not provide authentication on this listener unless SCRAM, mTLS, or OAuth is separately configured. Use only in controlled networks.
## @field {*bool} enabled - Enable TLS on the external listener. When unset, inherits the value of `external` (TLS is on when external access is enabled). The external listener always requires SCRAM-SHA-512 credentials from `users`; setting this to false while external is true sends all data unencrypted over a public IP and exposes the SCRAM authentication exchange to anyone on the path, although not the password itself, so use it only in controlled networks.
## @param {TLS} tls - TLS configuration. Strimzi manages the cluster PKI automatically (no cert-manager is involved for this chart): the operator auto-creates `<release>-cluster-ca-cert` and `<release>-clients-ca-cert` secrets, both exposed for client trust setup. The internal TLS listener on 9093 is always on; this toggle only controls the external listener on 9094.
tls: {}
@@ -31,6 +31,15 @@ version: "v4.3"
## @field {int} replicas - Number of replicas.
## @field {*object} [config] - Topic configuration.
## @typedef {struct} User - Kafka user. Its password is generated by the Strimzi User Operator.
## @param {map[string]User} users - Users allowed on the external listener. Each key `<name>` (lowercase letters, digits and `-`) becomes the SCRAM-SHA-512 username `<release>.<name>`, where `<release>` is `kafka-<application name>`, and its generated password is written to the Secret of the same name (keys `password` and `sasl.jaas.config`). Every user can read and write every topic.
users: {}
## Example:
## users:
## app: {}
## analytics: {}
## @param {[]Topic} topics - Topics configuration.
topics: []
## Example:
+9 -2
View File
@@ -8,7 +8,7 @@ spec:
plural: kafkas
singular: kafka
openAPISchema: |-
{"title":"Chart Values","type":"object","x-cozystack-name":{"type":"string","description":"Kafka cluster name. The KRaft controller pods are named `kafka-<name>-c-<hash>-<id>` with an 8-character hash, and that pod hostname must fit the 63-character DNS-1123 label limit even for the smallest cluster.","maxLength":44},"properties":{"external":{"description":"Enable external access from outside the cluster.","type":"boolean","default":false},"tls":{"description":"TLS configuration. Strimzi manages the cluster PKI automatically (no cert-manager is involved for this chart): the operator auto-creates `<release>-cluster-ca-cert` and `<release>-clients-ca-cert` secrets, both exposed for client trust setup. The internal TLS listener on 9093 is always on; this toggle only controls the external listener on 9094.","type":"object","default":{},"properties":{"enabled":{"description":"Enable TLS on the external listener. When unset, inherits the value of `external` (TLS is on when external access is enabled). Warning: setting this to false while external is true exposes Kafka over plaintext on a public IP via LoadBalancer. Strimzi does not provide authentication on this listener unless SCRAM, mTLS, or OAuth is separately configured. Use only in controlled networks.","type":"boolean"}}},"version":{"description":"Kafka version to deploy. Upgrade-only: once a cluster's KRaft metadata is at a given version, Strimzi refuses an in-place downgrade, so lowering this on a running cluster (e.g. v4.3 back to v4.2) leaves the Kafka CR stuck in a reconcile error. Pick the target version at creation and only ever raise it.","type":"string","default":"v4.3","enum":["v4.3","v4.2"]},"topics":{"description":"Topics configuration.","type":"array","default":[],"items":{"type":"object","required":["name","partitions","replicas"],"properties":{"config":{"description":"Topic configuration.","type":"object","x-kubernetes-preserve-unknown-fields":true},"name":{"description":"Topic name.","type":"string"},"partitions":{"description":"Number of partitions.","type":"integer"},"replicas":{"description":"Number of replicas.","type":"integer"}}}},"kafka":{"description":"Kafka configuration.","type":"object","default":{},"required":["replicas","resourcesPreset","size","storageClass"],"properties":{"controllerStorageSize":{"description":"Persistent Volume size for KRaft controller metadata.","default":"5Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"replicas":{"description":"Number of Kafka replicas.","type":"integer","default":3},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available to each replica.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Memory (RAM) available to each replica.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resources` is omitted.","type":"string","default":"c1.small","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]},"size":{"description":"Persistent Volume size for Kafka.","default":"10Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"storageClass":{"description":"StorageClass used to store the Kafka data.","type":"string","default":"","x-kubernetes-validations":[{"rule":"self == oldSelf","message":"storageClass is immutable"}],"x-cozystack-options":{"source":"storageclass"}}}},"schedulingClass":{"description":"Name of a SchedulingClass CR (cluster-scoped, group cozystack.io) used in place of the tenant's for this application's pods. A pod gets its class when it is created, so running pods keep theirs until they are recreated. Must be the tenant's own class or one listed in the tenant's `allowedSchedulingClasses`. Setting any other valLine truncated
{"title":"Chart Values","type":"object","x-cozystack-name":{"type":"string","description":"Kafka cluster name. The KRaft controller pods are named `kafka-<name>-c-<hash>-<id>` with an 8-character hash, and that pod hostname must fit the 63-character DNS-1123 label limit even for the smallest cluster.","maxLength":44},"properties":{"external":{"description":"Enable external access from outside the cluster. The external listener (port 9094) accepts only clients that authenticate with SCRAM-SHA-512 as one of the `users`.","type":"boolean","default":false},"tls":{"description":"TLS configuration. Strimzi manages the cluster PKI automatically (no cert-manager is involved for this chart): the operator auto-creates `<release>-cluster-ca-cert` and `<release>-clients-ca-cert` secrets, both exposed for client trust setup. The internal TLS listener on 9093 is always on; this toggle only controls the external listener on 9094.","type":"object","default":{},"properties":{"enabled":{"description":"Enable TLS on the external listener. When unset, inherits the value of `external` (TLS is on when external access is enabled). The external listener always requires SCRAM-SHA-512 credentials from `users`; setting this to false while external is true sends all data unencrypted over a public IP and exposes the SCRAM authentication exchange to anyone on the path, although not the password itself, so use it only in controlled networks.","type":"boolean"}}},"version":{"description":"Kafka version to deploy. Upgrade-only: once a cluster's KRaft metadata is at a given version, Strimzi refuses an in-place downgrade, so lowering this on a running cluster (e.g. v4.3 back to v4.2) leaves the Kafka CR stuck in a reconcile error. Pick the target version at creation and only ever raise it.","type":"string","default":"v4.3","enum":["v4.3","v4.2"]},"users":{"description":"Users allowed on the external listener. Each key `<name>` (lowercase letters, digits and `-`) becomes the SCRAM-SHA-512 username `<release>.<name>`, where `<release>` is `kafka-<application name>`, and its generated password is written to the Secret of the same name (keys `password` and `sasl.jaas.config`). Every user can read and write every topic.","type":"object","default":{},"additionalProperties":{"type":"object"}},"topics":{"description":"Topics configuration.","type":"array","default":[],"items":{"type":"object","required":["name","partitions","replicas"],"properties":{"config":{"description":"Topic configuration.","type":"object","x-kubernetes-preserve-unknown-fields":true},"name":{"description":"Topic name.","type":"string"},"partitions":{"description":"Number of partitions.","type":"integer"},"replicas":{"description":"Number of replicas.","type":"integer"}}}},"kafka":{"description":"Kafka configuration.","type":"object","default":{},"required":["replicas","resourcesPreset","size","storageClass"],"properties":{"controllerStorageSize":{"description":"Persistent Volume size for KRaft controller metadata.","default":"5Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"replicas":{"description":"Number of Kafka replicas.","type":"integer","default":3},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"CPU available to each replica.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Memory (RAM) available to each replica.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resources` is omitted.","type":"string","default":"c1.small","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]},"size":{"description":"Persistent Volume size for Kafka.","default":"10Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"sLine truncated
release:
prefix: kafka-
labels:
@@ -25,13 +25,20 @@ spec:
tags:
- messaging
icon: PHN2ZyB3aWR0aD0iMTQ0IiBoZWlnaHQ9IjE0NCIgdmlld0JveD0iMCAwIDE0NCAxNDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxNDQiIGhlaWdodD0iMTQ0IiByeD0iMjQiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl82ODFfMjgyMCkiLz4KPHB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iPgo8c3RvcC8+CjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzQzNDE0MSIvPgo8L2xpbmVhckdyYWRpZW50Pgo8L2RlZnM+Cjwvc3ZnPgo=
keysOrder: [["apiVersion"], ["appVersion"], ["kind"], ["metadata"], ["metadata", "name"], ["spec", "external"], ["spec", "tls"], ["spec", "version"], ["spec", "topics"], ["spec", "kafka"], ["spec", "kafka", "replicas"], ["spec", "kafka", "resources"], ["spec", "kafka", "resourcesPreset"], ["spec", "kafka", "size"], ["spec", "kafka", "storageClass"], ["spec", "kafka", "controllerStorageSize"], ["spec", "schedulingClass"]]
keysOrder: [["apiVersion"], ["appVersion"], ["kind"], ["metadata"], ["metadata", "name"], ["spec", "external"], ["spec", "tls"], ["spec", "version"], ["spec", "users"], ["spec", "topics"], ["spec", "kafka"], ["spec", "kafka", "replicas"], ["spec", "kafka", "resources"], ["spec", "kafka", "resourcesPreset"], ["spec", "kafka", "size"], ["spec", "kafka", "storageClass"], ["spec", "kafka", "controllerStorageSize"], ["spec", "schedulingClass"]]
secrets:
exclude: []
include:
- resourceNames:
- kafka-{{ .name }}-clients-ca-cert
- kafka-{{ .name }}-cluster-ca-cert
# The User Operator copies a KafkaUser's labels onto the Secret holding
# its generated password and adds strimzi.io/kind. Label values are not
# templated, unlike resourceNames, so the selector names no cluster: the
# Secret is only matched against the Kafka instance its ownership leads
# to, which already scopes it to this cluster.
- matchLabels:
strimzi.io/kind: KafkaUser
services:
exclude: []
include: