apiVersion: v1
kind: Namespace
metadata:
  name: keeweb
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: keeweb-nginx
  namespace: keeweb
data:
  keeweb.conf: |
    server {
        listen 80;
        root /keeweb;
        index index.html;
        server_name _;
        server_tokens off;
        location / {
            try_files $uri $uri/ =404;
        }
        location ~ /\. {
            deny all;
        }
    }
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: keeweb
  namespace: keeweb
spec:
  replicas: 1
  selector:
    matchLabels:
      app: keeweb
  template:
    metadata:
      labels:
        app: keeweb
    spec:
      containers:
        - name: keeweb
          image: antelle/keeweb:latest
          ports:
            - containerPort: 80
          volumeMounts:
            - name: nginx-conf
              mountPath: /etc/nginx/conf.d/keeweb.conf
              subPath: keeweb.conf
      volumes:
        - name: nginx-conf
          configMap:
            name: keeweb-nginx
---
apiVersion: v1
kind: Service
metadata:
  name: keeweb
  namespace: keeweb
spec:
  selector:
    app: keeweb
  ports:
    - port: 80
      targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: keeweb
  namespace: keeweb
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt
spec:
  ingressClassName: traefik
  tls:
    - hosts:
        - keys.roysland.net
      secretName: keeweb-tls
  rules:
    - host: keys.roysland.net
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: keeweb
                port:
                  number: 80
