apiVersion: apps/v1
kind: Deployment
metadata:
  name: besu-validator
  namespace: besu-network
  labels:
    app: besu-validator
    role: validator
spec:
  replicas: 1
  selector:
    matchLabels:
      app: besu-validator
  template:
    metadata:
      labels:
        app: besu-validator
        role: validator
    spec:
      nodeSelector:
        pool: system  # Use existing system nodes (no quota needed)
      containers:
      - name: besu
        image: hyperledger/besu:latest
        command: ["besu"]
        args:
          - "--network=dev"
          - "--rpc-http-enabled"
          - "--rpc-http-host=0.0.0.0"
          - "--rpc-http-port=8545"
          - "--rpc-ws-enabled"
          - "--rpc-ws-host=0.0.0.0"
          - "--rpc-ws-port=8546"
          - "--host-allowlist=*"
          - "--data-path=/data"
        ports:
        - containerPort: 8545
          name: http-rpc
          protocol: TCP
        - containerPort: 8546
          name: ws-rpc
          protocol: TCP
        - containerPort: 30303
          name: p2p
          protocol: TCP
        volumeMounts:
        - name: data
          mountPath: /data
        resources:
          requests:
            cpu: 500m
            memory: 2Gi
          limits:
            cpu: 1000m
            memory: 4Gi
      volumes:
      - name: data
        emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
  name: besu-validator
  namespace: besu-network
spec:
  selector:
    app: besu-validator
  ports:
  - port: 8545
    targetPort: 8545
    name: http-rpc
    protocol: TCP
  - port: 8546
    targetPort: 8546
    name: ws-rpc
    protocol: TCP
  - port: 30303
    targetPort: 30303
    name: p2p
    protocol: TCP
  type: LoadBalancer

