feat(miner-deployment): add Kubernetes StatefulSet + Secret example for AMS fleet-mode - #5246
feat(miner-deployment): add Kubernetes StatefulSet + Secret example for AMS fleet-mode#5246davion-knight wants to merge 2 commits into
Conversation
…or AMS fleet-mode Add k8s/ example manifests so an operator can deploy N isolated miner workers with kubectl instead of hand-rolling manifests or being limited to docker run/compose (JSONbored#5181). Uses a StatefulSet (not a Deployment) with volumeClaimTemplates so each replica gets its OWN PersistentVolumeClaim — the miner's local SQLite ledgers are not safe for concurrent multi-pod access, so per-pod isolated storage is the safety property. Built on the existing Dockerfile image (entrypoint gittensory-miner, continuous 'run' worker, /data/miner state). Ships a Secret template (GITHUB_TOKEN + optional provider keys), a k8s/README.md deploy/scale guide, and a validation test asserting well-formed manifests pass, a malformed one fails, and the per-pod-storage invariant holds (no shared PVC across replicas). Packaging only — no runtime/governor/claim control-flow touched. Closes JSONbored#5181
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5246 +/- ##
=======================================
Coverage 94.34% 94.34%
=======================================
Files 473 473
Lines 39982 39982
Branches 14576 14576
=======================================
Hits 37722 37722
Misses 1585 1585
Partials 675 675
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review result - reject/close recommendedReview updated: 2026-07-12 11:25:32 UTC
🛑 Suggested Action - Reject/Close
Review summary Blockers
Nits — 5 non-blocking
Why this is blocked
CI checks failing
Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
|
Gittensory is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-code); Possible leaked secret in the diff (generic_secret_assignment)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
JSONbored
left a comment
There was a problem hiding this comment.
Closing:
k8s/miner-deployment.yaml:32 sets `runAsUser: 1000` and mounts the PVC at `/data/miner` without `fsGroup`, so on the common root-owned `ReadWriteOnce` PVC path the worker cannot create its SQLite files; add the group ownership policy under the pod security context, e.g. `securityContext:\n runAsNonRoot: true\n runAsUser: 1000\n runAsGroup: 1000\n fsGroup: 1000\n fsGroupChangePolicy: OnRootMismatch`.
Adds
k8s/example manifests so an operator can run N isolated miner workers on a small cluster withkubectl, instead of hand-rolling manifests or being limited todocker run/compose (#5181). Built on the existingpackages/gittensory-miner/Dockerfileimage.Why a StatefulSet (not a Deployment)
Requirement #4 mandates per-pod isolated storage, never a shared PVC across replicas — because the miner keeps all state in local SQLite ledgers (
claim-ledger.sqlite3, …) that are not safe for concurrent multi-pod access. A Deployment can only mount one shared PVC across every replica; a StatefulSet'svolumeClaimTemplatesgive each replica its own PVC. So the manifest is a StatefulSet (ink8s/miner-deployment.yaml, filename per the issue), documented ink8s/README.md.What's included
k8s/miner-deployment.yaml— StatefulSet: configurablereplicas, per-podvolumeClaimTemplatefor/data/miner, CLI-worker resource requests/limits, runs the continuousrunworker,GITTENSORY_MINER_CONFIG_DIR+ secret-sourcedGITHUB_TOKEN(+ optional provider keys), non-root securityContext.k8s/miner-secret.example.yaml—Secrettemplate forGITHUB_TOKENand optionalANTHROPIC_API_KEY/OPENAI_API_KEYplaceholders.k8s/README.md— deploy sequence (kubectl applysecret → statefulset) + scaling (kubectl scale) + the StatefulSet rationale.Validation
test/unit/miner-k8s-manifests.test.ts(7 tests): the real manifests are well-formed Kubernetes (StatefulSet + Secret), a deliberately malformed manifest fails the structural validator, and the per-pod-storage invariant is asserted (hasvolumeClaimTemplates, rejects a shared-PVC config). Both sides exercised as real tests.src/**logic, no runtime/governor/claim control-flow touched.Closes #5181