---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: user
  labels:
    name: user
    app.kubernetes.io/name: user
spec:
  replicas: 1
  selector:
    matchLabels:
      app: user
      app.kubernetes.io/name: user
  template:
    metadata:
      labels:
        name: user
        app: user
        app.kubernetes.io/name: user
      annotations:
        sidecar.istio.io/rewriteAppHTTPProbers: "true"
    spec:
      containers:
      - name: user
        image: iad.ocir.io/oracle/ateam/mushop-user:1.1.0
        imagePullPolicy: Always
        ports:
        - name: http
          containerPort: 3000
        env:
        - name: OADB_USER
          valueFrom:
            secretKeyRef:
              name: user-oadb-credentials
              key: oadb_user
        - name: OADB_PW
          valueFrom:
            secretKeyRef:
              name: user-oadb-credentials
              key: oadb_pw
        - name: OADB_SERVICE
          valueFrom:
            secretKeyRef:
              name: user-oadb-connection
              key: oadb_service
        resources:
          limits:
            cpu: 300m
            memory: 300Mi
          requests:
            cpu: 100m
            memory: 100Mi
        securityContext:
          capabilities:
            drop:
              - all
            add:
              - NET_BIND_SERVICE
          readOnlyRootFilesystem: true
        livenessProbe:
          httpGet:
            path: /health
            port: http
          initialDelaySeconds: 300
          periodSeconds: 30
        readinessProbe:
          httpGet:
            path: /health
            port: http
          initialDelaySeconds: 10
          periodSeconds: 5
        volumeMounts:
        - name: wallet
          mountPath: "/usr/lib/oracle/19.3/client64/lib/network/admin"
      volumes:
      - name: wallet
        secret:
          secretName: user-oadb-wallet
          defaultMode: 256