apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend
  namespace: tasteby
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
  selector:
    matchLabels:
      app: backend
  template:
    metadata:
      labels:
        app: backend
    spec:
      imagePullSecrets:
        - name: ocir-secret
      containers:
        - name: backend
          image: icn.ocir.io/idyhsdamac8c/tasteby/backend:latest
          ports:
            - containerPort: 8000
          envFrom:
            - configMapRef:
                name: tasteby-config
            - secretRef:
                name: tasteby-secrets
          volumeMounts:
            - name: oracle-wallet
              mountPath: /etc/oracle/wallet
              readOnly: true
            - name: oci-config
              mountPath: /root/.oci
              readOnly: true
          resources:
            requests:
              cpu: 300m
              memory: 512Mi
            limits:
              cpu: 800m
              memory: 1024Mi
          readinessProbe:
            tcpSocket:
              port: 8000
            initialDelaySeconds: 30
            periodSeconds: 10
          livenessProbe:
            tcpSocket:
              port: 8000
            initialDelaySeconds: 60
            periodSeconds: 30
      volumes:
        - name: oracle-wallet
          secret:
            secretName: oracle-wallet
        - name: oci-config
          secret:
            secretName: oci-config
---
apiVersion: v1
kind: Service
metadata:
  name: backend
  namespace: tasteby
spec:
  selector:
    app: backend
  ports:
    - port: 8000
      targetPort: 8000
