# Create a secret containing your GitHub token first:
# kubectl create secret generic github-token --from-literal=token=YOUR_TOKEN_HERE

apiVersion: apps/v1
kind: Deployment
metadata:
  name: github-exporter
  labels:
    app.kubernetes.io/name: github-exporter
    app.kubernetes.io/version: '0.3.3'
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/name: github-exporter
  template:
    metadata:
      labels:
        app.kubernetes.io/name: github-exporter
      annotations:
        prometheus.io/scrape: 'true'
        prometheus.io/port: '9612'
    spec:
      containers:
      - name: github-exporter
        image: 'xrstf/github_exporter:0.3.3'
        args:
        - -listen=0.0.0.0:9162
        - -repo=xrstf/github_exporter
        env:
        - name: GITHUB_TOKEN
          valueFrom:
            secretKeyRef:
              name: github-token
              key: token
        ports:
        - name: metrics
          containerPort: 9162
          protocol: TCP
        livenessProbe:
          httpGet:
            path: /metrics
            port: metrics
        readinessProbe:
          httpGet:
            path: /metrics
            port: metrics
        resources:
          requests:
            cpu: 50m
            memory: 64Mi
          limits:
            cpu: 1
            memory: 128Mi
        securityContext:
          runAsNonRoot: true
          runAsUser: 65534
