# vexplor Frontend Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: vexplor-frontend
  namespace: vexplor
  labels:
    app: vexplor-frontend
    component: frontend
spec:
  replicas: 2
  selector:
    matchLabels:
      app: vexplor-frontend
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  template:
    metadata:
      labels:
        app: vexplor-frontend
        component: frontend
    spec:
      imagePullSecrets:
        - name: harbor-registry
      containers:
        - name: vexplor-frontend
          image: harbor.wace.me/vexplor/vexplor-frontend:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 3000
              protocol: TCP
          envFrom:
            - configMapRef:
                name: vexplor-config
          env:
            - name: PORT
              value: "3000"
            - name: HOSTNAME
              value: "0.0.0.0"
            - name: NODE_ENV
              value: "production"
            - name: NEXT_PUBLIC_API_URL
              value: "https://api.vexplor.com/api"
            # 서버사이드 렌더링시 내부 백엔드 호출용
            - name: SERVER_API_URL
              value: "http://vexplor-backend-service:3001"
          resources:
            requests:
              memory: "256Mi"
              cpu: "100m"
            limits:
              memory: "1Gi"
              cpu: "500m"
          livenessProbe:
            httpGet:
              path: /
              port: 3000
            initialDelaySeconds: 30
            periodSeconds: 10
            timeoutSeconds: 5
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /
              port: 3000
            initialDelaySeconds: 10
            periodSeconds: 5
            timeoutSeconds: 3
            failureThreshold: 3

---
# Frontend Service
apiVersion: v1
kind: Service
metadata:
  name: vexplor-frontend-service
  namespace: vexplor
  labels:
    app: vexplor-frontend
spec:
  type: ClusterIP
  selector:
    app: vexplor-frontend
  ports:
    - name: http
      port: 3000
      targetPort: 3000
      protocol: TCP

