Skip to content

feat: Intent-Based Node Types Implementation (Full, Validator, Archive, Gateway)#67

Merged
mvleandro merged 1 commit intomainfrom
feat/add-node-type
Dec 6, 2025
Merged

feat: Intent-Based Node Types Implementation (Full, Validator, Archive, Gateway)#67
mvleandro merged 1 commit intomainfrom
feat/add-node-type

Conversation

@mvleandro
Copy link
Owner

📝 Description

This PR introduces a significant architectural change to the blockchain-operator, moving from manual flag-based configuration to an Intent-Based approach.

The EthereumNode CRD now supports the nodeType field. Based on this field, the Operator automatically:

  • Infers the synchronization strategy (syncMode)
  • Adjusts Geth flags
  • Dynamically modifies the Pod topology (including conditional sidecar
    injection)

This drastically simplifies node provisioning while improving safety, consistency, and maintainability.


✨ Key Changes

✅ NodeType Abstraction

  • Added NodeType enum to the API with the following values:
    • full
    • archive
    • validator
    • gateway
  • syncMode is now optional and automatically inferred:
    • archivearchive sync
    • all others → snap sync

✅ Dynamic Pod Topology

  • Full refactor of the desiredStatefulSet method.

🧱 Validators

  • When nodeType: validator is set:
    • The Operator automatically injects the validator-client
      container (Prysm)
    • Required secret volumes for validator keys are mounted
      automatically

🌐 Gateways

  • RPC optimization flags are applied
  • API limits and resource allocations are increased for
    high-performance traffic

🗃️ Archives

  • Automatically configures:

    --gcmode=archive
    

✅ Security & RBAC

  • Fixed Controller permissions:
    • The Operator now has permission to list and read Secrets
      (core/secrets)
    • Required for validator key mounting and JWT management

✅ Documentation

  • README.md updated with:
    • New architecture overview
    • Revised Mermaid diagram (showing optional containers)
    • New manifest examples for each nodeType

🏗️ Implementation Details

📁 Modified File: api/v1/ethereumnode_types.go

  • Added the NodeType struct and constants

📁 Modified File: internal/controller/ethereumnode_controller.go

  • Argument inference logic
  • Conditional injection of containers and volumes
  • Updated RBAC markers (//+kubebuilder:rbac...)

🧪 How to Test

1️⃣ Deploy the Updated Operator

make docker-build IMG=blockchain-operator:v2
kind load docker-image blockchain-operator:v2 --name blockchain-operator
make deploy IMG=blockchain-operator:v2

2️⃣ Full Node Test (Default Snap Sync)

Apply the manifest:

apiVersion: infra.blockchain.corp/v1
kind: EthereumNode
metadata:
  name: test-full
  namespace: blockchain-operator-system
spec:
  nodeType: full
  network: sepolia
  replicas: 1
  storageSize: 500Gi

Expected Result:
The Pod should start with 2 containers (execution + consensus).


3️⃣ Validator Node Test

Create a mock secret:

kubectl create secret generic test-validator-validator-keys \
  --from-literal=password.txt=123 \
  -n blockchain-operator-system

Apply the manifest with nodeType: validator.

Expected Result:
The Pod should start with 3 containers, including the
validator-client, and the secret must be mounted at:

/secrets/validator

✅ Checklist

  • Code compiles successfully (make build)
  • Manual Kind tests executed successfully
  • Manifests generated and updated (make manifests)
  • Documentation (README.md) updated
  • Linting verified

@mvleandro mvleandro merged commit f9927bf into main Dec 6, 2025
0 of 6 checks passed
@mvleandro mvleandro deleted the feat/add-node-type branch December 6, 2025 22:19
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.

2 participants