kind: Deployment
apiVersion: apps/v1
metadata:
  name: ttn-operator
  labels:
    app.kubernetes.io/name: ttn-operator
    app.kubernetes.io/part-of: device-registry
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: ttn-operator
      app.kubernetes.io/part-of: device-registry
  template:
    metadata:
      labels:
        app.kubernetes.io/name: ttn-operator
        app.kubernetes.io/part-of: device-registry
    spec:
      serviceAccountName: ttn-operator
      containers:
        - name: service
          image: ghcr.io/drogue-iot/ttn-operator:latest
          imagePullPolicy: Always
          env:
            - name: RUST_LOG
              value: debug
            - name: RUST_BACKTRACE
              value: "1"
            - name: BIND_ADDR
              value: 0.0.0.0:8080
            - name: HEALTH__BIND_ADDR
              value: "0.0.0.0:9090"
            - name: NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: REGISTRY__CLIENT_ID
              valueFrom:
                secretKeyRef:
                  name: keycloak-client-secret-services
                  key: CLIENT_ID
            - name: REGISTRY__CLIENT_SECRET
              valueFrom:
                secretKeyRef:
                  name: keycloak-client-secret-services
                  key: CLIENT_SECRET
          readinessProbe:
            initialDelaySeconds: 2
            periodSeconds: 1
            timeoutSeconds: 1
            failureThreshold: 3
            httpGet:
              port: 9090
              path: /readiness
          livenessProbe:
            initialDelaySeconds: 2
            periodSeconds: 1
            timeoutSeconds: 1
            failureThreshold: 3
            httpGet:
              port: 9090
              path: /liveness
          ports:
            - containerPort: 8080
              name: api
              protocol: TCP
          resources:
            limits:
              memory: 128Mi
