---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: kyma-metrics-collector
  name: kyma-metrics-collector
  namespace: kcp-system
spec:
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: kyma-metrics-collector
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: kyma-metrics-collector
    spec:
      containers:
      - image: ko://github.com/kyma-project/control-plane/kyma-metrics-collector/cmd
        imagePullPolicy: Always
        name: kyma-metrics-collector
        args:
          - "-log-level=debug"
        env:
          - name: PUBLIC_CLOUD_SPECS
            valueFrom:
              configMapKeyRef:
                name: public-cloud-specs
                key: providers
          - name: KEB_URL
            value: http://kcp-kyma-environment-broker.kcp-system/runtimes
          - name: EDP_URL
#           value: http://edp-mock.kcp-system:8080
          - name: EDP_NAMESPACE
            value: kyma-dev
          - name: EDP_DATASTREAM_NAME
            value: consumption-metrics-new-test
          - name: EDP_DATASTREAM_VERSION
            value: "1"
          - name: EDP_DATASTREAM_ENV
            value: dev
        volumeMounts:
          - mountPath: /gardener
            name: gardener-kubeconfig
            readOnly: true
          - mountPath: /edp-credentials
            name: edp
            readOnly: true
        ports:
        - containerPort: 8080
          name: http
          protocol: TCP

        ## readiness and liveness probe
      restartPolicy: Always
      schedulerName: default-scheduler
      terminationGracePeriodSeconds: 30
      volumes:
      - name: gardener-kubeconfig
        secret:
          secretName: gardener-credentials
      - name: edp
        secret:
          secretName: kyma-metrics-collector

