mirror of
https://github.com/hanzoai/nchain.git
synced 2026-10-30 18:27:22 +00:00
7 CRDs (nchain.hanzo.ai/v1alpha1):
- NodeCluster: protocol-agnostic blockchain node cluster
- Chain: blockchain/subnet/L2 definition
- Indexer: blockchain data indexer
- Explorer: block explorer UI+API
- Bridge: cross-chain bridge
- Gateway: RPC/API gateway with routing + rate limiting
- Network: top-level composer (creates all child CRDs)
Protocol driver architecture:
- LuxDriver: full luxd flag generation, snow consensus, staking keys,
snapshot restore, chain tracking, startup scripting (487 lines)
- EthereumDriver: reth command generation, standard EVM ports
- GenericDriver: passthrough for any containerized node
Key design principles:
- Composable: each CRD stands alone or composes via Network
- Orthogonal: validators, indexers, explorers, bridges, gateways
are independent concerns with independent CRDs
- Complete: covers the full lifecycle from bootstrap to production
- Protocol-agnostic: driver pattern isolates blockchain-specific logic
- Do everything exactly once: one way to manage any blockchain
Replaces both HanzoNetwork (hanzo-operator) and LuxNetwork (lux-operator)
with a unified, deeper, protocol-agnostic alternative.
6,215 lines Go | go build + go vet clean
32 lines
795 B
Go
32 lines
795 B
Go
package controller
|
|
|
|
import (
|
|
"github.com/hanzoai/nchain/internal/manifests"
|
|
)
|
|
|
|
// commonLabels builds the standard label set used by all controllers.
|
|
func commonLabels(name, component string, extra map[string]string) map[string]string {
|
|
return manifests.MergeLabels(
|
|
manifests.StandardLabels(name, component, "", ""),
|
|
extra,
|
|
)
|
|
}
|
|
|
|
// selectorLabels returns minimal selector labels for a controller name
|
|
// and component.
|
|
func selectorLabels(name, component string) map[string]string {
|
|
return map[string]string{
|
|
"app.kubernetes.io/name": name,
|
|
"app.kubernetes.io/instance": name,
|
|
"app.kubernetes.io/component": component,
|
|
}
|
|
}
|
|
|
|
// derefInt32 returns the value pointed to, or the default.
|
|
func derefInt32(p *int32, def int32) int32 {
|
|
if p != nil {
|
|
return *p
|
|
}
|
|
return def
|
|
}
|