# services/sui-metrics/base/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sui-metrics
  namespace: sui-metrics
  labels:
    app: sui-metrics
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sui-metrics
  template:
    metadata:
      labels:
        app: sui-metrics
    spec:
      serviceAccountName: sui-metrics
      containers:
        - name: vmagent
          image: victoriametrics/vmagent:v1.103.0
          imagePullPolicy: IfNotPresent
          args:
            - -promscrape.config=/etc/vmagent/config/vmagent.yaml
            - -remoteWrite.url=$(REMOTE_WRITE_URL)
            - -remoteWrite.tmpDataPath=/var/lib/vmagent
            - -loggerFormat=json
          ports:
            - name: http
              containerPort: 8429
              protocol: TCP
          env:
            - name: TZ
              value: Etc/UTC
            - name: REMOTE_WRITE_URL
              value: http://victoria-metrics-single.monitoring.svc.cluster.local:8428/api/v1/write
          resources:
            requests:
              cpu: 100m
              memory: 256Mi
            limits:
              cpu: 500m
              memory: 512Mi
          volumeMounts:
            - name: config
              mountPath: /etc/vmagent/config
              readOnly: true
            - name: data
              mountPath: /var/lib/vmagent
          securityContext:
            allowPrivilegeEscalation: false
            runAsNonRoot: true
            runAsUser: 65534
            runAsGroup: 65534
            capabilities:
              drop: ["ALL"]
      volumes:
        - name: config
          configMap:
            name: sui-metrics-config
        - name: data
          emptyDir: {}
