Skip to content

Commit 6d2fd33

Browse files
committed
Add IPv6 support for ScyllaClusters
This commit implements comprehensive IPv6 support for ScyllaClusters, enabling: - IPv6-only ScyllaDB clusters - Dual-stack (IPv4/IPv6) Kubernetes services - IPv6 broadcast address handling - IPv6-aware probe servers and health checks - IPv6 support for multi-datacenter communication Key changes: - Add ipFamily field to ScyllaCluster API with IPv4/IPv6 enum validation - Implement IPv6-aware networking helpers in pkg/helpers/networking.go - Add IPv6 support to ScyllaDB configuration (listen/rpc addresses, DNS lookups) - Update controllers to handle IPv6 service creation and endpoint management - Add comprehensive E2E tests for IPv6 scenarios - Include user documentation and working examples The implementation maintains full backward compatibility with existing IPv4-only deployments.
1 parent 03c16a5 commit 6d2fd33

File tree

37 files changed

+3002
-85
lines changed

37 files changed

+3002
-85
lines changed

assets/scylladb/managedconfig.cm.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,33 @@ metadata:
66
data:
77
{{ .ManagedConfigName | printf "%q" }}: |
88
cluster_name: "{{ .ClusterName }}"
9+
{{- if .Spec.IPFamily }}
10+
{{- if eq (deref .Spec.IPFamily) "IPv6" }}
11+
rpc_address: "::"
12+
api_address: "::1"
13+
listen_address: "::"
14+
seed_provider:
15+
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
16+
parameters:
17+
- seeds: "::1"
18+
{{- else }}
919
rpc_address: "0.0.0.0"
20+
api_address: "127.0.0.1"
21+
listen_address: "0.0.0.0"
22+
seed_provider:
23+
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
24+
parameters:
25+
- seeds: "127.0.0.1"
26+
{{- end }}
27+
{{- else }}
28+
rpc_address: "0.0.0.0"
29+
api_address: "127.0.0.1"
30+
listen_address: "0.0.0.0"
31+
seed_provider:
32+
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
33+
parameters:
34+
- seeds: "127.0.0.1"
35+
{{- end }}
1036
endpoint_snitch: "GossipingPropertyFileSnitch"
1137
internode_compression: "all"
1238

assets/scylladb/registry.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,10 @@ var (
2626
ScyllaDBSnitchConfigTemplate = lazy.New(func() *assets.ObjectTemplate[*corev1.ConfigMap] {
2727
return ParseObjectTemplateOrDie[*corev1.ConfigMap]("scylladb-snitch-config", scyllaDBSnitchConfigTemplateString)
2828
})
29+
30+
//go:embed "scylla-manager-agent-config.cm.yaml"
31+
scyllaDBManagerAgentConfigTemplateString string
32+
ScyllaDBManagerAgentConfigTemplate = lazy.New(func() *assets.ObjectTemplate[*corev1.ConfigMap] {
33+
return ParseObjectTemplateOrDie[*corev1.ConfigMap]("scylladb-manager-agent-config", scyllaDBManagerAgentConfigTemplateString)
34+
})
2935
)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
namespace: "{{ .Namespace }}"
5+
name: "{{ .Name }}"
6+
data:
7+
{{ .ScyllaAgentConfigFileName | printf "%q" }}: |
8+
# ScyllaDB API endpoint configuration based on IP family
9+
{{- if .Spec.IPFamily }}
10+
{{- if eq (deref .Spec.IPFamily) "IPv6" }}
11+
scylla:
12+
api_address: "::1"
13+
api_port: 10000
14+
{{- else }}
15+
scylla:
16+
api_address: "127.0.0.1"
17+
api_port: 10000
18+
{{- end }}
19+
{{- else }}
20+
scylla:
21+
api_address: "127.0.0.1"
22+
api_port: 10000
23+
{{- end }}
24+
25+
# Default ScyllaDB Manager Agent configuration
26+
# Additional configuration can be provided via customConfigSecretRef

deploy/operator.yaml

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/source/api-reference/groups/scylla.scylladb.com/scyllaclusters.rst

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/source/api-reference/groups/scylla.scylladb.com/scylladbdatacenters.rst

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/source/resources/scyllaclusters/basics.md

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,157 @@ Wait for it to deploy by watching status conditions.
203203
:::{include} ./../../.internal/wait-for-status-conditions.scyllacluster.code-block.md
204204
:::
205205

206+
## IPv6 and Dual-Stack Networking
207+
208+
You can run ScyllaDB clusters on IPv6-only networks or use both IPv4 and IPv6 together (dual-stack).
209+
210+
### IPv6 Configuration
211+
212+
Use the `ipFamily` field to specify which IP version ScyllaDB should use:
213+
214+
```yaml
215+
apiVersion: scylla.scylladb.com/v1
216+
kind: ScyllaCluster
217+
metadata:
218+
name: scylla-ipv6
219+
spec:
220+
version: {{imageTag}}
221+
ipFamily: IPv6
222+
223+
network:
224+
dnsPolicy: ClusterFirst
225+
226+
datacenter:
227+
name: dc1
228+
racks:
229+
- name: rack1
230+
members: 3
231+
storage:
232+
capacity: 10Gi
233+
resources:
234+
requests:
235+
cpu: 1
236+
memory: 4Gi
237+
exposeOptions:
238+
broadcastOptions:
239+
nodes:
240+
type: PodIP
241+
clients:
242+
type: PodIP
243+
```
244+
245+
### Dual-Stack Configuration
246+
247+
For dual-stack environments (both IPv4 and IPv6), you typically only need to specify the IP family for ScyllaDB:
248+
249+
```yaml
250+
apiVersion: scylla.scylladb.com/v1
251+
kind: ScyllaCluster
252+
metadata:
253+
name: scylla-dual-stack
254+
spec:
255+
version: {{imageTag}}
256+
ipFamily: IPv4
257+
258+
network:
259+
dnsPolicy: ClusterFirst
260+
261+
datacenter:
262+
name: dc1
263+
racks:
264+
- name: rack1
265+
members: 3
266+
storage:
267+
capacity: 10Gi
268+
resources:
269+
requests:
270+
cpu: 1
271+
memory: 4Gi
272+
exposeOptions:
273+
broadcastOptions:
274+
nodes:
275+
type: PodIP
276+
clients:
277+
type: PodIP
278+
```
279+
280+
**Advanced**: If you need explicit control over service networking, you can configure it manually:
281+
282+
```yaml
283+
apiVersion: scylla.scylladb.com/v1
284+
kind: ScyllaCluster
285+
metadata:
286+
name: scylla-dual-stack-explicit
287+
spec:
288+
version: {{imageTag}}
289+
ipFamily: IPv4
290+
network:
291+
ipFamilyPolicy: PreferDualStack
292+
ipFamilies: ["IPv4", "IPv6"] # IPv4 first, then IPv6
293+
datacenter:
294+
name: dc1
295+
racks:
296+
- name: rack1
297+
members: 3
298+
storage:
299+
capacity: 10Gi
300+
resources:
301+
requests:
302+
cpu: 1
303+
memory: 4Gi
304+
exposeOptions:
305+
broadcastOptions:
306+
nodes:
307+
type: PodIP
308+
clients:
309+
type: PodIP
310+
```
311+
312+
### What happens by default
313+
314+
::::{important}
315+
**DNS Configuration for IPv6**
316+
317+
When using IPv6, it's recommended to explicitly set `dnsPolicy: ClusterFirst` in the network configuration:
318+
319+
```yaml
320+
spec:
321+
network:
322+
dnsPolicy: ClusterFirst
323+
```
324+
325+
This will make sure proper IPv6 DNS resolution within the Kubernetes cluster, which is essential for ScyllaDB nodes to discover each other using IPv6 addresses.
326+
::::
327+
328+
::::{important}
329+
**If you don't specify an IP family, ScyllaCluster will pick one automatically:**
330+
331+
- **IPv4-only clusters**: Uses IPv4 (works like before)
332+
- **IPv6-only clusters**: Uses IPv6 automatically
333+
- **Dual-stack clusters**: Uses the **first IP family** from your `network.ipFamilies` list
334+
- **No configuration**: Defaults to IPv4 for compatibility
335+
336+
This means existing clusters keep working without any changes.
337+
::::
338+
339+
### Configuration Options
340+
341+
| Field | What it does | Default | Required? |
342+
|-------|-------------|---------|-----------|
343+
| `ipFamily` | IP version for ScyllaDB communication | Auto-detected or IPv4 | **Recommended** |
344+
| `network.ipFamilyPolicy` | How services handle IP versions | `SingleStack` | Only for advanced dual-stack |
345+
| `network.ipFamilies` | Which IP versions to support for services | `["IPv4"]` | Only for advanced dual-stack |
346+
347+
::::{note}
348+
**When do you need `network` configuration?**
349+
350+
- **Most cases**: Just set `ipFamily`, Kubernetes will auto-detect service networking
351+
- **Advanced dual-stack**: Use `network` fields only if you need explicit control over service IP families
352+
- **IPv4-only or IPv6-only clusters**: Just `ipFamily` is sufficient, no `network` config needed
353+
::::
354+
355+
For detailed IPv6 configuration, troubleshooting, and examples, see the [IPv6 Networking Guide](./ipv6-networking.md).
356+
206357
## Forcing a rolling restart
207358

208359
When you change a ScyllaDB config option that's not live reloaded by ScyllaDB, or want to trigger a rolling restart for a different reason, ScyllaCluster allows triggering the rolling restarts declaratively by changing `ScyllaCluster.spec.forceRedeploymentReason` to any other value. This will trigger a rolling restart of all ScyllaDB nodes in sequence, always respecting the [PodDistruptionsBudget](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/#pod-disruption-budgets) and keeping the cluster available.

docs/source/resources/scyllaclusters/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
:maxdepth: 1
55

66
basics
7+
ipv6-networking
78
clients/index
89
nodeoperations/index
910
multidc/index

0 commit comments

Comments
 (0)