#
# Start a simple telemeter cluster that can be scale up to handle multiple traffic.
# Expects that an authorization service is running in the same namespace.
#
kind: List
apiVersion: v1
items:
- kind: Deployment
  apiVersion: apps/v1
  metadata:
    name: telemeter-client
  spec:
    selector:
      matchLabels:
        app: telemeter-client
    template:
      metadata:
        labels:
          app: telemeter-client
      spec:
        volumes:
        - name: credentials
          secret:
            secretName: telemeter-client
        containers:
        - name: client
          image: openshift/origin-telemeter:v4.0
          resources:
            requests:
              cpu: 5m
              memory: 20Mi
            limits:
              cpu: 20m
              memory: 50Mi
          volumeMounts:
          - name: credentials
            mountPath: /etc/telemeter
          env:
          - name: TO
            valueFrom:
              secretKeyRef:
                name: telemeter-client
                key: to
          - name: ID
            valueFrom:
              secretKeyRef:
                name: telemeter-client
                key: id
          command:
          - /usr/bin/telemeter-client
          - --to=$(TO)
          - --id=$(ID)
          - --from=https://prometheus-k8s.openshift-monitoring.svc:9091
          - --from-ca-file=/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt
          - --from-token-file=/var/run/secrets/kubernetes.io/serviceaccount/token
          - --to-token-file=/etc/telemeter/token
          - --anonymize-salt-file=/etc/telemeter/salt
          - --match-file=/etc/telemeter/rules
