apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend
  namespace: vzzpr-backend
  labels:
    app: backend
    version: v1.0.0
spec:
  replicas: 2
  selector:
    matchLabels:
      app: backend
  template:
    metadata:
      labels:
        app: backend
        version: v1.0.0
    spec:
      containers:
        - name: backend
          image: qtechdevexperts/vzzpr-backend:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 7440
              name: http
              protocol: TCP
          envFrom:
            - configMapRef:
                name: vzzpr-config
            - secretRef:
                name: vzzpr-secrets
          env:
            - name: REDIS_HOST
              value: "redis"
            - name: REDIS_PORT
              value: "6370"
            - name: NODE_OPTIONS
              value: "--max-old-space-size=4096"
            - name: PORT
              value: "7440"
            - name: NODE_ENV
              value: "development"
            - name: CORS_ORIGINS
              value: "*"
            - name: APP_URL
              value: "https://backend.vzzpr.com/api/v1"
          resources:
            requests:
              cpu: "200m"
              memory: "512Mi"
            limits:
              cpu: "2"
              memory: "4Gi"
          livenessProbe:
            httpGet:
              path: /api/v1/video/health
              port: 7440
            initialDelaySeconds: 60
            periodSeconds: 30
            timeoutSeconds: 10
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /api/v1/video/health
              port: 7440
            initialDelaySeconds: 30
            periodSeconds: 10
            timeoutSeconds: 5
            failureThreshold: 3
          securityContext:
            allowPrivilegeEscalation: false
            runAsNonRoot: true
            runAsUser: 1000
            runAsGroup: 1000
            capabilities:
              drop:
                - ALL
---
apiVersion: v1
kind: Service
metadata:
  name: backend
  namespace: vzzpr-backend
  labels:
    app: backend
spec:
  selector:
    app: backend
  ports:
    - port: 7440
      targetPort: 7440
      protocol: TCP
      name: http
  type: ClusterIP 