apiVersion: apps/v1
kind: Deployment
metadata:
  name: server
  labels:
    app.kubernetes.io/name: drogue-ajour
    app.kubernetes.io/instance: ajour
    app.kubernetes.io/component: server
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: drogue-ajour
      app.kubernetes.io/instance: ajour
      app.kubernetes.io/component: server
  template:
    metadata:
      labels:
        app.kubernetes.io/name: drogue-ajour
        app.kubernetes.io/instance: ajour
        app.kubernetes.io/component: server
    spec:
      serviceAccountName: builder
      containers:
      - name: server
        image: ghcr.io/drogue-iot/drogue-ajour:latest
        imagePullPolicy: Always
        env:
          - name: RUST_LOG
            value: drogue_ajour=debug
          - name: OCI_REGISTRY_PREFIX
            valueFrom:
              secretKeyRef:
                name: container-registry
                key: prefix
          - name: OCI_REGISTRY_TOKEN
            valueFrom:
              secretKeyRef:
                name: container-registry
                key: token
          - name: DROGUE_TOKEN
            valueFrom:
              secretKeyRef:
                name: drogue-config
                key: token
          - name: DROGUE_USER
            valueFrom:
              secretKeyRef:
                name: drogue-config
                key: user
          - name: DROGUE_DEVICE_REGISTRY
            valueFrom:
              secretKeyRef:
                name: drogue-config
                key: registry-url
          - name: DROGUE_MQTT_INTEGRATION
            valueFrom:
              secretKeyRef:
                name: drogue-config
                key: mqtt-integration
          - name: MQTT_GROUP_ID
            value: firmware
        ports:
        - containerPort: 8080
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8080
        readinessProbe:
          httpGet:
            path: /healthz
            port: 8080
