---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: bender-server
  labels:
    app.kubernetes.io/name: bender
    app.kubernetes.io/instance: bender-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: bender
      app.kubernetes.io/instance: bender-server
  template:
    metadata:
      labels:
        app.kubernetes.io/name: bender
        app.kubernetes.io/instance: bender-server
        aadpodidbinding: bender
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "8000"
        prometheus.io/path: "/api/v1/metrics"
    spec:
      containers:
        - name: server
          image: sierrasoftworks/bender:latest
          imagePullPolicy: IfNotPresent
          resources:
            requests:
              cpu: 10m
              memory: 100Mi
            limits:
              cpu: 500m
              memory: 500Mi
          env:
            - name: ENVIRONMENT
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: ASPNETCORE_ENVIRONMENT
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: JAEGER_COLLECTOR_ENDPOINT
              value: http://otel-collector.open-telemetry:14268/api/traces?format=jaeger.thrift
          ports:
            - name: http
              containerPort: 8000
              protocol: TCP
          readinessProbe:
            httpGet:
              port: http
              path: /api/v1/health
            initialDelaySeconds: 5
            periodSeconds: 1
          livenessProbe:
            httpGet:
              port: http
              path: /api/v1/health
            initialDelaySeconds: 30
            periodSeconds: 1