---
# Source: spring-boot-app-api/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-deploy-stable
  labels:
    app: spring-boot-api
spec:
  selector:
    matchLabels:
      app: spring-boot-api
  replicas: 3
  strategy:
    type: RollingUpdate #Parameterize?
  template:
    metadata:
      labels:
        app: spring-boot-api
        version: stable
      annotations:
        prometheus.io/path: '/api/actuator/prometheus'
        prometheus.io/port: '8080'
        prometheus.io/scrape: 'true'
    spec:
      containers:
        - name: spring-boot-app-api
          image: "mtarng/jackson-api:v1.0"
          imagePullPolicy: Always
          resources:
            limits:
              cpu: 500m
              memory: 1024Mi
            requests:
              cpu: 250m
              memory: 64Mi
            
          ports:
          - containerPort: 8080
            name: api
          - containerPort: 5005
            name: jvm-debug
          
          env:
          - name: SERVER_SERVLET_CONTEXT_PATH
            value: "/api"
          - name: spring.profiles.active
            value: "development"
          - name: DB_CONNSTR # a mongo database connection string (ex: mongodb://db.com/myDb)
            valueFrom:
              secretKeyRef:
                name: jackson-secrets
                key: DB_CONNSTR
          - name: DB_NAME # a mongo database name (ex: myDb)
            valueFrom:
              secretKeyRef:
                name: jackson-secrets
                key: DB_NAME
          - name: EXCLUDE_FILTER # [optional] a (regex capable) list of classes to exclude from loading (ex: TitleRepository,PersonRepository)
            value: ""
          - name: ALLOWED_ORIGIN # For CORS stuff
            value: "*"
          - name: OAUTH_KEYSET_URI
            valueFrom:
              secretKeyRef:
                name: jackson-secrets
                key: OAUTH_KEYSET_URI
          - name: OAUTH_RES_ID
            valueFrom:
              secretKeyRef:
                name: jackson-secrets
                key: OAUTH_RES_ID
          - name: JAEGER_AGENT_HOST
            value: "jaeger-agent.jaeger.svc.cluster.local"
          - name: JAEGER_AGENT_PORT
            value: "6831"
