apiVersion: apps/v1
kind: Deployment
metadata:
  name: golf-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: golf-app
  template:
    metadata:
      labels:
        app: golf-app
    spec:
      containers:
      - name: myapp
        image: <IMAGE>
        resources:
          limits:
            memory: "512Mi"
            cpu: "500m"
        ports:
        - containerPort: 8080
        env: 
        - name: spring.datasource.username
          valueFrom:
            secretKeyRef:
              name: golf-db-secret
              key: golf-db-username
        - name: spring.datasource.password
          valueFrom:
            secretKeyRef:
              name: golf-db-secret
              key: golf-db-password
        - name: spring.mail.username
          valueFrom:
            secretKeyRef:
              name: golf-app-secret
              key: mail-username           
        - name: spring.mail.password
          valueFrom:
            secretKeyRef:
              name: golf-app-secret
              key: mail-password  
        - name: google.recaptcha.key.site
          valueFrom:
            secretKeyRef:
              name: golf-app-secret
              key: recaptcha-site
        - name: google.recaptcha.key.secret
          valueFrom:
            secretKeyRef:
              name: golf-app-secret
              key: recaptcha-secret
        - name: cors.allowedOrigins
          valueFrom:
            secretKeyRef:
              name: golf-app-secret
              key: allowed-origins
        - name: PG_SERVER
          valueFrom:
            configMapKeyRef:
              name: golf-db-configmap
              key: database_url
        - name: spring.datasource.url
          value: jdbc:postgresql://${PG_SERVER}/golf
        - name: spring.profiles.active
          value: prod
