Skip to content

Kubernetes Operator

Kubernetes Operator

Source on GitHub: HDB-HeliosDB-Proxy-Operator

The HeliosProxy Kubernetes operator declares five CRDs under heliosproxy.dev/v1alpha1:

KindPurpose
HeliosProxyThe proxy instance + node list
PoolProfilePer-instance pool tuning (mode, max_pool_size, etc.)
RoutingRuleRouting-hints configuration
AuditPolicyaudit-chain plugin + masking rules + audit backend
TenantQuotaPer-tenant limits + cost budgets seeded into plugin KV

Apply a HeliosProxy

apiVersion: heliosproxy.dev/v1alpha1
kind: HeliosProxy
metadata:
name: analytics
namespace: data
spec:
replicas: 2
image: ghcr.io/dimensigon/hdb-heliosdb-proxy:0.4.0
nodes:
- host: pg-primary.db.svc
port: 5432
role: primary
weight: 100
- host: pg-standby.db.svc
port: 5432
role: standby
weight: 100
poolProfileRef: default-pool
plugins:
- name: cost-governor
source: oci://registry.example.com/org/cost-governor:1.0.0

What the reconciler does

  1. Resolves refs. Looks up referenced sub-CRDs; surfaces a RefMissing condition for each unresolved ref but proceeds (the proxy can boot from inline-spec values).
  2. Renders proxy.toml from the merged spec.
  3. Owns three objects: a ConfigMap with the rendered TOML, a Deployment with the right replicas + image + ports + CM mount + liveness/readiness probes, and a ClusterIP Service exposing the postgres + admin ports. All have OwnerReferences so kubectl delete heliosproxy <name> cleans up the stack.
  4. Drives a config-hash annotation on the pod template — when the rendered TOML changes the deployment rolls automatically.
  5. Polls /topology on a 5-second cadence and updates status.currentPrimary / healthyNodes / unhealthyNodes.

Status transitions are honest: Pending until any pod is ready, Degraded while ReadyReplicas < spec.Replicas, Ready when they match. The polling client hard-fails over after 3 seconds so a hung proxy doesn’t block reconcile.