apiVersion: v1
kind: Service
metadata:
  name: default-site
  labels:
    run: default-site
spec:
  ports:
    - name: http
      port: 80
      targetPort: 80
  selector:
    run: default-site
  type: LoadBalancer
# Uncomment the following if you wnat to expose an IP
#status:
#  loadBalancer: {}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: default-site
  annotations:
    nfs.io/storage-path: "default-site"
spec:
  storageClassName: managed-nfs-storage
  accessModes:
    - ReadOnlyMany
  resources:
    requests:
      storage: 5Mi
status: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: default-site
spec:
  replicas: 2
  selector:
    matchLabels:
      run: default-site
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        run: default-site
    spec:
      containers:
        - image: nginx
          name: default-site
          ports:
            - containerPort: 80
          resources: {}
          volumeMounts:
            - mountPath: /usr/share/nginx/html
              name: default-site
      restartPolicy: Always
      volumes:
        - name: default-site
          persistentVolumeClaim:
            claimName: default-site
status: {}
---
# Hosting
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: default-site-ingress
  annotations:
    cert-manager.io/cluster-issuer: "letsencrypt-wildcard-prod"
    ### basic auth for default
    ## type of authentication
    #nginx.ingress.kubernetes.io/auth-type: basic
    ## name of the secret that contains the user/password definitions
    #nginx.ingress.kubernetes.io/auth-secret: basic-auth
    ## message to display with an appropriate context why the authentication is required
    #nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - Octoprint'
spec:
  tls:
  - hosts:
    - "*.monkeybox.org"
    secretName: default-site-tls
  rules:
  - host: "*.monkeybox.org"
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: default
            port:
              number: 80
