apiVersion: v1
kind: ConfigMap
metadata:
  name: solidityscan-config
  namespace: besu-network
data:
  ENABLE_SOLIDITYSCAN: "true"
  SOLIDITYSCAN_AUTO_SCAN: "true"
  SOLIDITYSCAN_API_URL: "https://api.solidityscan.com"
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: solidityscan-integration
  namespace: besu-network
  labels:
    app: solidityscan-integration
spec:
  replicas: 1
  selector:
    matchLabels:
      app: solidityscan-integration
  template:
    metadata:
      labels:
        app: solidityscan-integration
    spec:
      containers:
        - name: solidityscan-integration
          image: solidityscan/integration:v1.0.0
          imagePullPolicy: IfNotPresent
          envFrom:
            - configMapRef:
                name: solidityscan-config
          env:
            - name: SOLIDITYSCAN_API_KEY
              valueFrom:
                secretKeyRef:
                  name: solidityscan-secrets
                  key: api-key
            - name: BLOCKSCOUT_URL
              value: "http://blockscout:4000"
            - name: RPC_URL
              value: "http://besu-rpc:8545"
          resources:
            requests:
              cpu: "100m"
              memory: "256Mi"
            limits:
              cpu: "500m"
              memory: "512Mi"
          livenessProbe:
            httpGet:
              path: /health
              port: 8080
            initialDelaySeconds: 30
            periodSeconds: 30
          readinessProbe:
            httpGet:
              path: /ready
              port: 8080
            initialDelaySeconds: 10
            periodSeconds: 10
---
apiVersion: v1
kind: Service
metadata:
  name: solidityscan-integration
  namespace: besu-network
  labels:
    app: solidityscan-integration
spec:
  type: ClusterIP
  ports:
    - port: 8080
      targetPort: 8080
      protocol: TCP
  selector:
    app: solidityscan-integration
---
# Secret should be created using:
# kubectl create secret generic solidityscan-secrets \
#   --from-literal=api-key='<your-api-key>' \
#   -n besu-network
