Skip to content

feat(kafka): add local NVMe reference with repair DaemonSet - #80

Merged
rawkode merged 3 commits into
mainfrom
feat/kafka-local-pv-repair
Aug 6, 2026
Merged

feat(kafka): add local NVMe reference with repair DaemonSet#80
rawkode merged 3 commits into
mainfrom
feat/kafka-local-pv-repair

Conversation

@rawkode

@rawkode rawkode commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add the CoreWeave local-NVMe Kafka reference architecture
  • add an opt-in, fail-closed local-PV repair DaemonSet
  • preserve author attribution: Chris for the initial reference and David for the repair DaemonSet

Verification

  • manifest validator and renderer tests
  • Linux repair-agent tests and image build in Docker
  • Kustomize renders and final adversarial review

@rawkode
rawkode marked this pull request as ready for review August 6, 2026 12:53
Copilot AI review requested due to automatic review settings August 6, 2026 12:53
@rawkode
rawkode merged commit 94c2d5f into main Aug 6, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new kafka-local-nvme reference architecture package for running Strimzi Kafka on CoreWeave node-local NVMe (/mnt/local/kafka), including an opt-in “fail-closed” repair DaemonSet plus supporting scripts/tests and documentation.

Changes:

  • Introduces a local-path provisioner Kustomize package and two Strimzi profiles (two-node, five-node) for Kafka on local PVs.
  • Adds an optional repair-agent (Go) and a renderer script to generate the DaemonSet + RBAC from an immutable config allowlist.
  • Adds validation/smoke-test scripts and customer-facing documentation plus licensing/third-party notices.

Reviewed changes

Copilot reviewed 40 out of 40 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
README.md Adds top-level index entry for the new Kafka local NVMe reference.
kafka-local-nvme/THIRD_PARTY_NOTICES.md Documents third-party provenance for provisioner manifests.
kafka-local-nvme/tests/render-kafka-local-pv-repair-manifest-test.sh Tests the renderer output for required resources and safety constraints.
kafka-local-nvme/scripts/validate.sh Validates manifests render and runs Go + renderer tests.
kafka-local-nvme/scripts/smoke-test.sh Provides a basic produce/consume readback smoke test using kubectl.
kafka-local-nvme/scripts/render-kafka-local-pv-repair-manifest.sh Renders the repair DaemonSet/RBAC/ConfigMap from inputs + allowlist.
kafka-local-nvme/README.md Package entry-point documentation and operator guidance.
kafka-local-nvme/provisioner/local-path/storage-class.yaml Defines kafka-local StorageClass with local PV behavior.
kafka-local-nvme/provisioner/local-path/repair/service-account.yaml ServiceAccount for the optional repair DaemonSet.
kafka-local-nvme/provisioner/local-path/repair/rbac.yaml Namespaced Role/RoleBinding for repair PVC reads.
kafka-local-nvme/provisioner/local-path/repair/daemonset.template.yaml Template for repair ConfigMap + ClusterRole/Binding + DaemonSet.
kafka-local-nvme/provisioner/local-path/rbac.yaml Provisioner RBAC (derived from Rancher local-path-provisioner).
kafka-local-nvme/provisioner/local-path/namespace.yaml Namespace for the local-path provisioner components.
kafka-local-nvme/provisioner/local-path/kustomization.yaml Kustomize entry for provisioning stack resources.
kafka-local-nvme/provisioner/local-path/deployment.yaml Deploys pinned local-path-provisioner v0.0.36.
kafka-local-nvme/provisioner/local-path/config-map.yaml Provisioner config + helper pod setup/teardown scripts.
kafka-local-nvme/profiles/two-node/topic.yaml Two-node profile KafkaTopic definition.
kafka-local-nvme/profiles/two-node/kustomization.yaml Two-node profile kustomization entry.
kafka-local-nvme/profiles/two-node/kafka.yaml Two-node Kafka cluster CR with listeners/config.
kafka-local-nvme/profiles/two-node/controllers.yaml Two-node controllers KafkaNodePool manifest.
kafka-local-nvme/profiles/two-node/brokers.yaml Two-node brokers KafkaNodePool manifest.
kafka-local-nvme/profiles/five-node/topic.yaml Five-node profile KafkaTopic definition.
kafka-local-nvme/profiles/five-node/kustomization.yaml Five-node profile kustomization entry.
kafka-local-nvme/profiles/five-node/kafka.yaml Five-node Kafka cluster CR (enables Cruise Control).
kafka-local-nvme/profiles/five-node/controllers.yaml Five-node controllers KafkaNodePool manifest.
kafka-local-nvme/profiles/five-node/brokers.yaml Five-node brokers KafkaNodePool manifest.
kafka-local-nvme/LICENSE Adds package-level Apache-2.0 license text.
kafka-local-nvme/internal/repair/types.go Defines core repair types/config structures and interfaces.
kafka-local-nvme/internal/repair/select.go Implements candidate selection and expected path validation.
kafka-local-nvme/internal/repair/repair_test.go Linux-only tests for selection/mount verification/hierarchy behavior.
kafka-local-nvme/internal/repair/mount_linux.go Verifies host mount signature via /proc/1/mountinfo.
kafka-local-nvme/internal/repair/identity.go Verifies live node identity matches allowlist.
kafka-local-nvme/internal/repair/fs_linux.go Safely recreates missing directory hierarchy under /mnt/local.
kafka-local-nvme/internal/repair/engine_linux.go Orchestrates read-only verification + safe hierarchy creation loop.
kafka-local-nvme/internal/repair/api.go Implements in-cluster Kubernetes API reader and config loading.
kafka-local-nvme/go.mod Declares the Go module for the repair agent.
kafka-local-nvme/docs/customer-reference-architecture.md Customer-facing architecture scope/limits and operational boundaries.
kafka-local-nvme/Dockerfile Builds the repair agent container image (distroless runtime).
kafka-local-nvme/cmd/kafka-local-pv-repair/main.go Repair agent entrypoint and reconciliation loop.
kafka-local-nvme/.dockerignore Docker build context exclusions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +24 to +40
token, err := os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/token")
if err != nil {
return nil, err
}
ca, err := os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/ca.crt")
if err != nil {
return nil, err
}
pool := x509.NewCertPool()
if !pool.AppendCertsFromPEM(ca) {
return nil, errors.New("invalid service account CA")
}
host, port := os.Getenv("KUBERNETES_SERVICE_HOST"), os.Getenv("KUBERNETES_SERVICE_PORT")
if host == "" || port == "" {
return nil, ErrUnavailable
}
return &APIReader{&http.Client{Transport: &http.Transport{TLSClientConfig: &tls.Config{RootCAs: pool, MinVersion: tls.VersionTLS12}}}, "https://" + host + ":" + port, string(token)}, nil
Comment on lines +10 to +13
command -v kubectl >/dev/null 2>&1 || {
printf 'kubectl is required for Kustomize rendering.\n' >&2
exit 1
}
--nodes nodes.tsv | kubectl apply -f -
```

5. Obtain the required Pod Security approval for `hostPID` and a read-write `/mnt/local` hostPath. The container runs as root only to create missing root-owned hierarchy components, with `CHOWN` and `DAC_OVERRIDE` as its only added capabilities. Check the DaemonSet rollout and logs, and serialize all related operator maintenance. A newly rendered authorization changes the Pod template and rolls the DaemonSet automatically.

The repository does not install the Repair DaemonSet through its normal Kustomizations. When explicitly rendered and applied, it is a privileged host-storage component: it uses `hostPID` to inspect `/proc/1/mountinfo` and a read-write hostPath for `/mnt/local`. Its trust boundary requires a Pod Security exception, deliberate operator ownership, and serialized maintenance.

The agent may recreate only missing components of the exact managed directory hierarchy for a Bound local PV with an authorized same Node identity and a verified host mount signature. It does not restore data, delete directories, or write Kubernetes PV/PVC objects. Kafka rebuilds only from healthy replicas; this is not a claim of automatic reboot or replacement recovery, cleanup, or provider validation. It runs as root solely to create missing root-owned directories, with only `CHOWN` and `DAC_OVERRIDE` added after dropping all capabilities.
Comment thread kafka-local-nvme/go.mod
@@ -0,0 +1,3 @@
module github.com/coreweave/reference-architecture/kafka-local-nvme

go 1.24.0
@@ -0,0 +1,12 @@
FROM golang:1.24-alpine AS build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants