apiVersion: apps/v1
kind: Deployment
metadata:
  name: llink-web
spec:
  selector:
    matchLabels:
      app: llink-web
  replicas: 2
  template:
    metadata:
      labels:
        app: llink-web
    spec:
      serviceAccountName: default-service-account
      containers:
        - name: llink-web
          image: "llink-web"
          ports:
            - containerPort: 80
          resources:
            requests:
              memory: "64Mi"
              cpu: 20m
            limits:
              memory: "64Mi"
              cpu: 50m
          readinessProbe:
            httpGet:
              path: /health
              port: 80
            initialDelaySeconds: 2
            periodSeconds: 10
          livenessProbe:
            httpGet:
              path: /health
              port: 80
            initialDelaySeconds: 10
            periodSeconds: 30

---

apiVersion: v1
kind: Service
metadata:
  name: llink-web
spec:
  selector:
    app: llink-web
  ports:
    - port: 80
      targetPort: 80
      protocol: TCP

---

kind: HTTPRoute
apiVersion: gateway.networking.k8s.io/v1beta1
metadata:
  name: llink-web
spec:
  parentRefs:
    - kind: Gateway
      name: external-gateway
  hostnames:
    - llink.flowy.live
  rules:
    - backendRefs:
        - name: llink-web
          port: 80

---

apiVersion: networking.gke.io/v1
kind: HealthCheckPolicy
metadata:
  name: llink-web-service-health-check
spec:
  default:
    checkIntervalSec: 15
    timeoutSec: 15
    healthyThreshold: 1
    unhealthyThreshold: 2
    logConfig:
      enabled: true
    config:
      type: HTTP
      httpHealthCheck:
        portSpecification: USE_FIXED_PORT
        port: 80
        requestPath: /health
  targetRef:
    group: ""
    kind: Service
    name: llink-web
