apiVersion: apps/v1
kind: Deployment
metadata:
  name: main-dep
  namespace: main-namespace
spec:
  replicas: 1
  selector:
    matchLabels:
      app: main-app
  template:
    metadata:
      labels:
        app: main-app
    spec:
      containers:
        - name: main-container
          image: robsondepaula/main-app:2_07
          env:
            - name: SVC_BASE_URL
              valueFrom:
                configMapKeyRef:
                  name: main-app-config
                  key: svc_base_url
            - name: SVC_PORT
              valueFrom:
                configMapKeyRef:
                  name: main-app-config
                  key: svc_port
            - name: APP_PORT
              valueFrom:
                configMapKeyRef:
                  name: main-app-config
                  key: app_port
            - name: MESSAGE
              valueFrom:
                configMapKeyRef:
                  name: main-app-config
                  key: message
        - name: pingpong-container
          image: robsondepaula/pingpong:2_07
          envFrom:
          - secretRef:
              name: db-password
          env:
            - name: SVC_PORT
              valueFrom:
                configMapKeyRef:
                  name: main-svc-config
                  key: SVC_PORT
            - name: POSTGRES_HOST
              valueFrom:
                configMapKeyRef:
                  name: main-svc-config
                  key: POSTGRES_HOST
            - name: POSTGRES_PORT
              valueFrom:
                configMapKeyRef:
                  name: main-svc-config
                  key: POSTGRES_PORT
            - name: POSTGRES_USER
              valueFrom:
                configMapKeyRef:
                  name: main-svc-config
                  key: POSTGRES_USER
            - name: POSTGRES_DB
              valueFrom:
                configMapKeyRef:
                  name: main-svc-config
                  key: POSTGRES_DB
            - name: POSTGRES_TABLE
              valueFrom:
                configMapKeyRef:
                  name: main-svc-config
                  key: POSTGRES_TABLE