## Copyright (c) 2021 Oracle and/or its affiliates.
## Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
apiVersion: apps/v1
kind: Deployment
metadata:
  name: inventory-python
spec:
  replicas: 1
  selector:
    matchLabels:
      app: inventory
  template:
    metadata:
      labels:
        app: inventory
        version: python
    spec:
      containers:
      - name: inventory
        image: ${DOCKER_REGISTRY}/inventory-python:0.1
        imagePullPolicy: Always
        ports:
          - containerPort: 8080
        env:
          - name: TNS_ADMIN
            value: "/msdataworkshop/creds"
#            value: "/usr/lib/oracle/19.9/client64/lib/network/admin"
          - name: DB_CONNECT_STRING
            value: "${INVENTORY_DB_ALIAS}"
          - name: DB_USER
            value: "inventoryuser"
          - name: DB_CONNECTION_COUNT
            value: "2"
          - name: WORKERS
            value: "1"
          - name: HTTP_THREADS
            value: "16"
          - name: PORT
            value: "8080"
          - name: DEBUG_MODE
            value: "1"
          - name: AQ_CONSUMER_THREADS
            value: "1"
          - name: QUEUE_OWNER
            value: "AQ"
          - name: OCI_REGION
            value: "${OCI_REGION-}"
          - name: VAULT_SECRET_OCID
            value: "${VAULT_SECRET_OCID-}"
          - name: DB_PASSWORD
            valueFrom:
              secretKeyRef:
                name: dbuser
                key: dbpassword
                optional: true #not needed/used if using VAULT_SECRET_OCID exists
        readinessProbe:
          exec:
            command:
            - cat
            - /tmp/InventoryReady
          initialDelaySeconds: 0
          periodSeconds: 1
          timeoutSeconds: 1
          successThreshold: 1
          failureThreshold: 1
        volumeMounts:
        - name: creds
#          mountPath: /usr/lib/oracle/19.9/client64/lib/network/admin
          mountPath: /msdataworkshop/creds
      restartPolicy: Always
      volumes:
      - name: creds
        secret:
          secretName: inventory-db-tns-admin-secret
