apiVersion: apps/v1
kind: Deployment
metadata:
  name: autoflow-web
  namespace: etri-aisw
spec:
  replicas: 1
  selector:
    matchLabels:
      app: autoflow-web
  template:
    metadata:
      labels:
        app: autoflow-web
    spec:
      nodeSelector:
        nodegroup: cpu
      containers:
        - name: autoflow-web
          image: autoflow-web:latest
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 80
          livenessProbe:
            httpGet:
              path: /autoflow/index.html
              port: 80
            initialDelaySeconds: 30
            periodSeconds: 15
          readinessProbe:
            httpGet:
              path: /autoflow/index.html
              port: 80
            initialDelaySeconds: 30
            periodSeconds: 15
---
apiVersion: v1
kind: Service
metadata:
  name: autoflow-web-svc
  namespace: etri-aisw
spec:
  selector:
    app: autoflow-web
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
  type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: autoflow-web-ingress
  namespace: etri-aisw
  annotations:
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: ip
    alb.ingress.kubernetes.io/backend-protocol: HTTP
    # [수정 필요] 실제 서브넷 ID 및 보안 그룹 ID 입력 필요
    alb.ingress.kubernetes.io/subnets: subnet-xxxx, subnet-yyyy
    alb.ingress.kubernetes.io/group.name: etri-group
    alb.ingress.kubernetes.io/security-groups: sg-xxxx
    alb.ingress.kubernetes.io/customer-owned-ipv4-pool: ipv4pool-xxxx
    alb.ingress.kubernetes.io/healthcheck-protocol: HTTP
    alb.ingress.kubernetes.io/healthcheck-path: /autoflow/index.html
    alb.ingress.kubernetes.io/healthcheck-interval-seconds: "15"
    alb.ingress.kubernetes.io/healthy-threshold-count: "2"
    alb.ingress.kubernetes.io/unhealthy-threshold-count: "3"
    alb.ingress.kubernetes.io/success-codes: "200"
spec:
  ingressClassName: alb
  rules:
    - http:
        paths:
          - path: /autoflow
            pathType: Prefix
            backend:
              service:
                name: autoflow-web-svc
                port:
                  number: 80
