Skip to content

Commit ea7595f

Browse files
Vonngclaude
andcommitted
refactor(kafka): pigsty-native rewrite with node-authoritative state
Rework the beta kafka module into pigsty house style under a strict convention-over-configuration purge, cutting task code by half while keeping the dynamic-KRaft safety model intact: * single-pass role (identity/install/config/launch/provision/monitor) replaces the 5-phase playbook; broker admission and rolling restart are serialized inside launch.yml; teardown moves to the kafka_remove role & kafka-rm.yml, replacing the protected kafka_clean workflow * node-authoritative bootstrap state: every member keeps authoritative /etc/kafka/manifest.yml & secrets.yml copies, files/kafka/<cls> is demoted to an auto-recovered admin cache, and the live-probe manifest reconstruction machinery is removed * PEM TLS everywhere (KIP-651): one kafka.pem bundle per node, system trust anchor /etc/pki/ca.crt, no PKCS12 stores or store passwords; certs issued via the shared openssl ownca chain with cert_validity, and CA changes now roll safely via the static fingerprint * monitoring: jmx + protocol exporter merge into one job=kafka target file discriminated by the role label; kafka_exporter job/dir removed, dashboards & recording rules updated; both exporters are always on and kafka_jmx_exporter_enabled is dropped (15-param public API) * controller port restored to kafka convention 9093; provision naming unified (pigsty-kafka-provision, cluster_id-salted digests); demo conf/demo/kafka.yml added and stale kafka package aliases fixed Validated on ubuntu24/arm64 and rocky10/arm64 sandboxes: fresh bootstrap, admin-cache self-heal, credential & certificate rotation, removal, and idempotent re-runs (changed=0). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 9022362 commit ea7595f

54 files changed

Lines changed: 1872 additions & 3811 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ pg-meta:
619619
There are other pro, beta, or pilot modules, and there will be more coming in the future:
620620

621621
[![SUPABASE](https://img.shields.io/badge/SUPABASE-%233FCF8E?style=flat&logo=supabase&labelColor=3FCF8E&logoColor=white)](https://pigsty.io/docs/pgsql/kernel/supabase)
622-
[![KAFKA](https://img.shields.io/badge/KAFKA-%23231F20?style=flat&logo=apachekafka&labelColor=231F20&logoColor=white)](https://pigsty.io/docs/pilot/kafka)
622+
[![KAFKA](https://img.shields.io/badge/KAFKA-%23231F20?style=flat&logo=apachekafka&labelColor=231F20&logoColor=white)](https://pigsty.io/docs/kafka)
623623
[![MYSQL](https://img.shields.io/badge/MYSQL-%234479A1?style=flat&logo=mysql&labelColor=4479A1&logoColor=white)](https://pigsty.io/docs/pilot/mysql)
624624
[![DUCKDB](https://img.shields.io/badge/DUCKDB-%23FFF000?style=flat&logo=duckdb&labelColor=FFF000&logoColor=white)](https://pigsty.io/docs/pilot/duckdb)
625625
[![TIGERBEETLE](https://img.shields.io/badge/TIGERBEETLE-%231919191?style=flat&logo=openbugbounty&labelColor=1919191&logoColor=white)](https://pigsty.io/docs/pilot/tigerbeetle)

conf/build/dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ all:
4444
# pg16-main,pg16-time,pg16-gis,pg16-rag,pg16-fts,pg16-olap,pg16-feat,pg16-lang,pg16-type,pg16-util,pg16-func,pg16-admin,pg16-stat,pg16-sec,pg16-fdw,pg16-sim,pg16-etl,
4545
# pg15-main,pg15-time,pg15-gis,pg15-rag,pg15-fts,pg15-olap,pg15-feat,pg15-lang,pg15-type,pg15-util,pg15-func,pg15-admin,pg15-stat,pg15-sec,pg15-fdw,pg15-sim,pg15-etl,
4646
# pg14-main,pg14-time,pg14-gis,pg14-rag,pg14-fts,pg14-olap,pg14-feat,pg14-lang,pg14-type,pg14-util,pg14-func,pg14-admin,pg14-stat,pg14-sec,pg14-fdw,pg14-sim,pg14-etl,
47-
# infra-extra, kafka, java-runtime, sealos, tigerbeetle, polardb, ivorysql
47+
# infra-extra, kafka-stack, java-runtime, sealos, tigerbeetle, polardb, ivorysql
4848
#]
4949

5050
# building spec

conf/build/oss.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ all:
3434
# pg16-main,pg16-time,pg16-gis,pg16-rag,pg16-fts,pg16-olap,pg16-feat,pg16-lang,pg16-type,pg16-util,pg16-func,pg16-admin,pg16-stat,pg16-sec,pg16-fdw,pg16-sim,pg16-etl,
3535
# pg15-main,pg15-time,pg15-gis,pg15-rag,pg15-fts,pg15-olap,pg15-feat,pg15-lang,pg15-type,pg15-util,pg15-func,pg15-admin,pg15-stat,pg15-sec,pg15-fdw,pg15-sim,pg15-etl,
3636
# pg14-main,pg14-time,pg14-gis,pg14-rag,pg14-fts,pg14-olap,pg14-feat,pg14-lang,pg14-type,pg14-util,pg14-func,pg14-admin,pg14-stat,pg14-sec,pg14-fdw,pg14-sim,pg14-etl,
37-
# infra-extra, kafka, java-runtime, sealos, tigerbeetle, polardb, ivorysql
37+
# infra-extra, kafka-stack, java-runtime, sealos, tigerbeetle, polardb, ivorysql
3838
#]
3939

4040
children:

conf/demo/demo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ all:
137137
138138
# install all postgresql18 extensions
139139
pg_version: 18 # default postgres version
140-
repo_extra_packages: [ pg18-core ,pg18-time ,pg18-gis ,pg18-rag ,pg18-fts ,pg18-olap ,pg18-feat ,pg18-lang ,pg18-type ,pg18-util ,pg18-func ,pg18-admin ,pg18-stat ,pg18-sec ,pg18-fdw ,pg18-sim ,pg18-etl]
140+
repo_extra_packages: [ pg18-core ,pg18-time ,pg18-gis ,pg18-rag ,pg18-fts ,pg18-olap ,pg18-feat ,pg18-lang ,pg18-type ,pg18-util ,pg18-func ,pg18-admin ,pg18-stat ,pg18-sec ,pg18-fdw ,pg18-sim ,pg18-etl ,kafka-stack ,java-runtime]
141141
pg_extensions: [pg18-time ,pg18-gis ,pg18-rag ,pg18-fts ,pg18-feat ,pg18-lang ,pg18-type ,pg18-util ,pg18-func ,pg18-admin ,pg18-stat ,pg18-sec ,pg18-fdw ,pg18-sim ,pg18-etl ] #,pg18-olap]
142142

143143
#----------------------------------------------#

conf/demo/kafka.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
#==============================================================#
3+
# File : kafka.yml
4+
# Desc : pigsty: 4 node kafka demo (dynamic KRaft)
5+
# Ctime : 2026-07-17
6+
# Mtime : 2026-07-17
7+
# Docs : https://pigsty.io/docs/kafka
8+
# License : Apache-2.0 @ https://pigsty.io/docs/about/license/
9+
# Copyright : 2018-2026 Ruohang Feng / Vonng (rh@vonng.com)
10+
#==============================================================#
11+
12+
# One pass installation with:
13+
# ./deploy.yml
14+
# ./kafka.yml -l kf-main
15+
# ./kafka.yml -l kf-test
16+
#==============================================================#
17+
# 1. kf-meta-1 @ 10.10.10.10:9092 single-node dev cluster (plaintext)
18+
# 2. kf-test-1 @ 10.10.10.11:9092 \
19+
# 3. kf-test-2 @ 10.10.10.12:9092 --- 3-node production baseline (scram)
20+
# 4. kf-test-3 @ 10.10.10.13:9092 / dynamic KRaft, TLS/SCRAM/ACL, RF=3/minISR=2
21+
#==============================================================#
22+
# kafka clients are cluster-aware and connect to every broker directly:
23+
# bootstrap with e.g. 10.10.10.11:9092,10.10.10.12:9092,10.10.10.13:9092
24+
25+
26+
all:
27+
children:
28+
29+
# infra cluster for proxy, monitor, alert, etc..
30+
infra: { hosts: { 10.10.10.10: { infra_seq: 1 } } }
31+
32+
# single-node kafka dev cluster: combined broker/controller, plaintext
33+
kf-meta:
34+
hosts:
35+
10.10.10.10: { kafka_seq: 1 }
36+
vars:
37+
kafka_cluster: kf-meta
38+
kafka_topics:
39+
- { name: quickstart.events ,partitions: 1 ,replication_factor: 1 ,config: { retention.ms: 86400000 } }
40+
41+
# 3-node production baseline: dynamic KRaft, TLS/SCRAM/ACL, RF=3/minISR=2
42+
kf-test:
43+
hosts:
44+
10.10.10.11: { kafka_seq: 1 }
45+
10.10.10.12: { kafka_seq: 2 }
46+
10.10.10.13: { kafka_seq: 3 }
47+
vars:
48+
kafka_cluster: kf-test
49+
kafka_security: scram
50+
kafka_users: # app principal with prefixed topic/group acls
51+
- name: test-app
52+
password: KafkaApp.Test
53+
acls:
54+
- { resource: topic ,name: 'test.' ,pattern: prefixed ,operations: [ Read, Write, Describe ] }
55+
- { resource: group ,name: 'test.' ,pattern: prefixed ,operations: [ Read ] }
56+
- { resource: cluster ,name: kafka-cluster ,operations: [ Describe, IdempotentWrite ] }
57+
kafka_topics:
58+
- name: test.events
59+
partitions: 3
60+
replication_factor: 3
61+
config: { min.insync.replicas: 2 ,cleanup.policy: delete ,retention.ms: 604800000 }
62+
63+
vars:
64+
version: v4.4.0 # pigsty version string
65+
admin_ip: 10.10.10.10 # admin node ip address
66+
region: default # upstream mirror region: default|china|europe
67+
infra_portal: # infra services exposed via portal
68+
home : { domain: i.pigsty } # default domain name
69+
70+
# kafka & java packages are required in the local repo for the kafka module (if using local repo)
71+
repo_extra_packages: [ kafka-stack ,java-runtime ]
72+
73+
#----------------------------------------------#
74+
# PASSWORD : https://pigsty.io/docs/setup/security/
75+
#----------------------------------------------#
76+
grafana_admin_password: pigsty
77+
grafana_view_password: DBUser.Viewer
78+
...

conf/fat.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ all:
134134
pg16-full,pg16-time,pg16-gis,pg16-rag,pg16-fts,pg16-olap,pg16-feat,pg16-lang,pg16-type,pg16-util,pg16-func,pg16-admin,pg16-stat,pg16-sec,pg16-fdw,pg16-sim,pg16-etl,
135135
pg15-full,pg15-time,pg15-gis,pg15-rag,pg15-fts,pg15-olap,pg15-feat,pg15-lang,pg15-type,pg15-util,pg15-func,pg15-admin,pg15-stat,pg15-sec,pg15-fdw,pg15-sim,pg15-etl,
136136
pg14-full,pg14-time,pg14-gis,pg14-rag,pg14-fts,pg14-olap,pg14-feat,pg14-lang,pg14-type,pg14-util,pg14-func,pg14-admin,pg14-stat,pg14-sec,pg14-fdw,pg14-sim,pg14-etl,
137-
infra-extra, kafka, java-runtime, sealos, tigerbeetle, polardb, ivorysql
137+
infra-extra, kafka-stack, java-runtime, sealos, tigerbeetle, polardb, ivorysql
138138
]
139139

140140
#----------------------------------------------#

0 commit comments

Comments
 (0)