apiVersion: apps/v1
kind: Deployment
metadata:
  name: carts
  labels:
    name: carts
    app.kubernetes.io/name: carts
spec:
  replicas: 1
  selector:
    matchLabels:
      app: carts
      app.kubernetes.io/name: carts
  template:
    metadata:
      labels:
        name: carts
        app.kubernetes.io/name: carts
      annotations:
        sidecar.istio.io/rewriteAppHTTPProbers: "true"
        prometheus.io/scrape: "true"
        prometheus.io/path: /metrics
        prometheus.io/port: "80"
    spec:
      containers:
      - name: carts
        image: iad.ocir.io/oracle/ateam/mushop-carts:1.5.0
        imagePullPolicy: IfNotPresent
        ports:
            - name: http
              containerPort: 80
        env:
        - name: ZIPKIN
          value: zipkin.jaeger.svc.cluster.local
        - name: JAVA_OPTS
          value: -Xms64m -Xmx128m -XX:+UseG1GC -Dlogging.level.mushop.carts=TRACE  -Djava.security.egd=file:/dev/urandom -Dspring.zipkin.enabled=false
        - name: OADB_USER
          valueFrom:
            secretKeyRef:
              name: carts-oadb-credentials
              key: oadb_user
        - name: OADB_PW
          valueFrom:
            secretKeyRef:
              name: carts-oadb-credentials
              key: oadb_pw
        - name: OADB_SERVICE
          valueFrom:
            secretKeyRef:
              name: carts-oadb-connection
              key: oadb_service   
        volumeMounts:
        - mountPath: /tmp
          name: tmp-volume
        # for init container
        - name: wallet
          mountPath: /usr/lib/oracle/19.3/client64/lib/network/admin/
          readOnly: true
      volumes:
        - name: tmp-volume
          emptyDir:
            medium: Memory
        # local wallet
        - name: wallet
          secret:
            secretName: carts-oadb-wallet
            defaultMode: 256
        # service init configMap
        - name: initdb
          configMap:
            name: mushop-carts-init
            items:
            - key: atp.init.sql
              path: service.sql
      nodeSelector:
        beta.kubernetes.io/os: linux
