HIPsHanzo Proposals
Back to HIPs
HIP-257FinalStandards TrackOperator

Datastore CRD

Hanzo Platform Team
Created: 2026-05-19

HIP-401: Datastore CRD

Abstract

The Datastore CRD models a stateful workload with persistent storage. It is the canonical primitive backing ClickHouse (hanzoai/datastore). Type-routed siblings — SQL, KV, DocDB, S3 — are thin facades that delegate to the same reconciler with a spec.type discriminator. The operator materializes a StatefulSet, headless and ClusterIP Services, PersistentVolumeClaim templates, and KMSSecret references.

Specification

Group + version

hanzo.ai/v1 (group configurable).

Spec fields

FieldTypeDescription
typestringclickhouse, postgresql, valkey, docdb, minio
imageImageSpecrepository, tag, pullPolicy
replicasintStatefulSet replica count
storageStorageSpecstorageClassName, size, retentionPolicy
resourcesResourceRequirementsrequests/limits
env, envFrom[]EnvVar / []EnvFromSourceenvironment
volumes, volumeMountsarrayextra volumes beyond storage
credentialsSecretstringsecret holding root creds
kmsSecrets[]KMSSecretRefKMS-managed secrets
backupBackupSpecschedule, s3 target, retention
serviceAliases[]stringextra DNS aliases for ClusterIP
ports[]ServicePortexposed ports
networkPolicyNetworkPolicySpecoptional
serviceMonitorServiceMonitorSpecoptional Prometheus scrape
command, args[]stringcontainer entrypoint

Example CR

apiVersion: hanzo.ai/v1
kind: Datastore
metadata:
  name: datastore
  namespace: hanzo
spec:
  type: clickhouse
  image:
    repository: ghcr.io/hanzoai/datastore
    tag: "26"
  replicas: 1
  storage:
    storageClassName: do-block-storage
    size: 50Gi
    retentionPolicy: Retain
  credentialsSecret: clickhouse-credentials

Generated K8s resources

  • StatefulSet (one Pod per replica, stable hostnames)
  • Headless Service (for replica discovery)
  • ClusterIP Service (for client traffic; aliases via serviceAliases)
  • PersistentVolumeClaim per replica (from volumeClaimTemplates)
  • NetworkPolicy (if requested)
  • KMSSecret references (if kmsSecrets)

Operator reconciler

  • Rust: ~/work/hanzo/operator/src/controllers/datastore.rs

Related services

  • Datastore (ClickHouse): HIP-496 (datastore)
  • SQL (Postgres): HIP-502 (sql)
  • KV (Valkey): HIP-498 (kv)
  • S3 (MinIO): HIP-476 (s3), HIP-477 (s3-demo)
  • Insights-KV (Valkey): HIP-454
  • Insights-SQL (Postgres): HIP-456

Status

Implemented in hanzoai/operator v0.3.0+. Backs all stateful workloads in do-sfo3-hanzo-k8s.