apiVersion: v1
kind: Namespace
metadata:
  name: cube-werewolf
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: werewolf
  namespace: cube-werewolf
  labels:
    app: werewolf
spec:
  replicas: 1
  selector:
    matchLabels:
      app: werewolf
  template:
    metadata:
      labels:
        app: werewolf
    spec:
      imagePullSecrets:
        - name: registry-creds
      containers:
        - name: werewolf
          image: registry.famzheng.me/mochi/werewolf:latest
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 8080
              name: http
          readinessProbe:
            httpGet:
              path: /healthz
              port: http
            initialDelaySeconds: 1
            periodSeconds: 5
          livenessProbe:
            httpGet:
              path: /healthz
              port: http
            initialDelaySeconds: 5
            periodSeconds: 15
          resources:
            requests:
              cpu: 10m
              memory: 16Mi
            limits:
              cpu: 200m
              memory: 64Mi
---
apiVersion: v1
kind: Service
metadata:
  name: werewolf
  namespace: cube-werewolf
spec:
  selector:
    app: werewolf
  ports:
    - name: http
      port: 80
      targetPort: 8080
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: werewolf
  namespace: cube-werewolf
spec:
  ingressClassName: traefik
  rules:
    - host: werewolf.famzheng.me
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: werewolf
                port:
                  number: 80
