apiVersion: apps/v1
kind: Deployment
metadata:
  name: acme
  namespace: acme-namespace
spec:
  replicas: 1
  selector:
    matchLabels:
      app: acme
      version: "v1"
  template:
    metadata:
      labels:
        app: acme
        version: "v1"
    spec:
      containers:
      - name: acme-app
        image: docker.io/studiofrancium/acme:latest
        env:
        - name: SPRING_PROFILES_ACTIVE
          value: prod
        - name: SPRING_DATASOURCE_URL
          value: jdbc:postgresql://acme-postgresql:5432/acme
        - name: SPRING_DATASOURCE_USERNAME
          value: acme
        - name: SPRING_DATASOURCE_PASSWORD
          valueFrom:
            secretKeyRef:
              name: acme-postgresql
              key: postgresql-password
        - name: JAVA_OPTS
          value: " -Xmx256m -Xms256m"
        resources:
          requests:
            memory: "256Mi"
            cpu: "500m"
          limits:
            memory: "512Mi"
            cpu: "1"
        ports:
        - name: http
          containerPort: 8080
        readinessProbe:
          httpGet:
            path: /management/health
            port: http
          initialDelaySeconds: 20
          periodSeconds: 15
          failureThreshold: 6
        livenessProbe:
          httpGet:
            path: /management/health
            port: http
          initialDelaySeconds: 120
