## 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-micronaut-native-image
spec:
  replicas: 1
  selector:
    matchLabels:
      app: inventory
  template:
    metadata:
      labels:
        app: inventory
        version: micronaut-native-image
    spec:
      containers:
        - name: inventory
          image: ${DOCKER_REGISTRY}/inventory-micronaut-native-image:0.1
          imagePullPolicy: Always
          env:
            - name: JDBC_USER
              value: "inventoryuser"
            - name: JDBC_URL
              value: "jdbc:oracle:thin:@${INVENTORY_DB_ALIAS}?TNS_ADMIN=/msdataworkshop/creds"
            - name: orderqueuename
              value: "ORDERQUEUE"
            - name: inventoryqueuename
              value: "inventoryqueue"
            - name: OCI_REGION
              value: "%OCI_REGION%"
            - name: VAULT_SECRET_OCID
              value: "%VAULT_SECRET_OCID%"
            - name: JDBC_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: dbuser
                  key: dbpassword
                  optional: true #not needed/used if using VAULT_SECRET_OCID exists
          volumeMounts:
            - name: creds
              mountPath: /msdataworkshop/creds
          ports:
            - containerPort: 8080
      restartPolicy: Always
      volumes:
        - name: creds
          secret:
            secretName: inventory-db-tns-admin-secret