apiVersion: v1
kind: Service
metadata:
  name: wiki
  labels:
    run: wiki
spec:
  ports:
    - name: http
      port: 80
      targetPort: 80
  selector:
    run: wiki
# Uncomment the following if you wnat to expose an IP
#  type: LoadBalancer
#status:
#  loadBalancer: {}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: wiki
  annotations:
    nfs.io/storage-path: "wiki"
spec:
  storageClassName: managed-nfs-storage
  accessModes:
    - ReadOnlyMany
  resources:
    requests:
      storage: 5Mi
status: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: wiki
spec:
  replicas: 1
  selector:
    matchLabels:
      run: wiki
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        run: wiki
    spec:
      containers:
        - image: linuxserver/nginx
          name: wiki
          ports:
            - containerPort: 80
          resources: {}
          volumeMounts:
            - mountPath: /usr/share/nginx/html
              name: wiki
      restartPolicy: Always
      volumes:
        - name: wiki
          persistentVolumeClaim:
            claimName: wiki
status: {}
---
# Hosting
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: wiki-ingress
  annotations:
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
    ## basic auth for wiki
#    # 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:
    - wiki.monkeybox.org
    secretName: wiki-tls
  rules:
  - host: wiki.monkeybox.org
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: wiki
            port:
              number: 80
