apiVersion: apps/v1
kind: Deployment
metadata:
  name: prometheus-deployment
  namespace: monitoring
  labels:
    app: prometheus-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: prometheus-server
  template:
    metadata:
      labels:
        app: prometheus-server
    spec:
      containers:
        - name: prometheus
          image: allardkrings/riscv64-prometheus
          imagePullPolicy: Always
          command: ["prometheus"]
          args:
            - "--config.file=/etc/prometheus/prometheus.yml"
            - "--storage.tsdb.path=/prometheus/"
          ports:
            - containerPort: 9090
          volumeMounts:
#            - name: prometheus-config-volume
#              mountPath: /etc/prometheus/
            - name: prometheus-storage-volume
              mountPath: /prometheus/
      volumes:
        - name: prometheus-config-volume
          configMap:
            defaultMode: 420
            name: prometheus-server-conf
        - name: prometheus-storage-volume
          emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
  name: prometheus-service
  namespace: monitoring
  annotations:
      prometheus.io/scrape: 'true'
      prometheus.io/port:   '9090'
spec:
  selector:
    app: prometheus-server
  type: ClusterIP
  ports:
    - port: 9090
      targetPort: 9090
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: prometheus-http
  namespace: monitoring
spec:
  entryPoints:
    - web
  routes:
  - match: Host(`prometheus-riscv.allarddcs.nl`)
    kind: Rule
    services:
    - name: prometheus-service
      port: 9090
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: prometheus-tls
  namespace: monitoring
spec:
  entryPoints:
    - websecure
  routes:
  - match: Host(`prometheus-riscv.allarddcs.nl`)
    kind: Rule
    services:
    - name: prometheus-service
      port: 9090
  tls:
    certResolver: letsencrypt
