apiVersion: apps/v1
kind: Deployment
metadata:
  name: ccip-monitor
  namespace: besu-network
  labels:
    app: ccip-monitor
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ccip-monitor
  template:
    metadata:
      labels:
        app: ccip-monitor
    spec:
      containers:
        - name: ccip-monitor
          image: ccip-monitor:v1.0.0
          imagePullPolicy: IfNotPresent
          env:
            - name: RPC_URL
              valueFrom:
                configMapKeyRef:
                  name: ccip-config
                  key: rpc_url
            - name: CCIP_SENDER_ADDRESS
              valueFrom:
                configMapKeyRef:
                  name: ccip-config
                  key: sender_address
            - name: CCIP_RECEIVER_ADDRESS
              valueFrom:
                configMapKeyRef:
                  name: ccip-config
                  key: receiver_address
            - name: LINK_TOKEN_ADDRESS
              valueFrom:
                configMapKeyRef:
                  name: ccip-config
                  key: link_token_address
            - name: METRICS_PORT
              value: "8000"
            - name: POLL_INTERVAL
              value: "30"
          ports:
            - name: metrics
              containerPort: 8000
              protocol: TCP
          resources:
            requests:
              cpu: "100m"
              memory: "256Mi"
            limits:
              cpu: "500m"
              memory: "512Mi"
          livenessProbe:
            httpGet:
              path: /metrics
              port: metrics
            initialDelaySeconds: 30
            periodSeconds: 30
          readinessProbe:
            httpGet:
              path: /metrics
              port: metrics
            initialDelaySeconds: 10
            periodSeconds: 10
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: ccip-config
  namespace: besu-network
data:
  rpc_url: "http://besu-rpc:8545"
  sender_address: ""
  receiver_address: ""
  link_token_address: ""
---
apiVersion: v1
kind: Service
metadata:
  name: ccip-monitor
  namespace: besu-network
  labels:
    app: ccip-monitor
spec:
  type: ClusterIP
  ports:
    - name: metrics
      port: 8000
      targetPort: 8000
      protocol: TCP
  selector:
    app: ccip-monitor

