summaryrefslogtreecommitdiff
path: root/f3s/webdav/helm-chart/templates/deployment.yaml
blob: d528ce273fdf9bfe834c568199e6b860f278a25f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
apiVersion: apps/v1
kind: Deployment
metadata:
  name: webdav
  namespace: services
spec:
  replicas: 1
  selector:
    matchLabels:
      app: webdav
  template:
    metadata:
      labels:
        app: webdav
    spec:
      securityContext:
        fsGroup: 65534
        seLinuxOptions:
          type: spc_t
      initContainers:
      - name: setup
        image: httpd:2.4
        command:
        - /bin/bash
        - -c
        - |
          cp -r /usr/local/apache2/conf/* /apache-conf/
          cp -r /usr/local/apache2/logs /apache-logs-init/
          echo "Include conf/extra/httpd-dav.conf" >> /apache-conf/httpd.conf
          sed -i 's/Listen 80/Listen 8080/' /apache-conf/httpd.conf
          sed -i 's/User daemon/User #65534/' /apache-conf/httpd.conf
          sed -i 's/Group daemon/Group #65534/' /apache-conf/httpd.conf
          mkdir -p /lock-dir/apache2
          chown -R 65534:65534 /apache-conf /apache-logs-init /lock-dir
        volumeMounts:
        - name: apache-conf
          mountPath: /apache-conf
        - name: apache-logs
          mountPath: /apache-logs-init
        - name: webdav-lock
          mountPath: /lock-dir
      containers:
      - name: webdav
        image: httpd:2.4
        securityContext:
          runAsUser: 65534
          runAsGroup: 65534
        ports:
        - containerPort: 8080
        volumeMounts:
        - name: webdav-data
          mountPath: /var/www/webdav
        - name: webdav-config
          mountPath: /usr/local/apache2/conf/extra/httpd-dav.conf
          subPath: httpd-dav.conf
        - name: webdav-htpasswd
          mountPath: /etc/apache2/webdav.htpasswd
          subPath: webdav.htpasswd
        - name: webdav-lock
          mountPath: /var/lock
        - name: apache-conf
          mountPath: /usr/local/apache2/conf
        - name: apache-logs
          mountPath: /usr/local/apache2/logs
      volumes:
      - name: webdav-data
        persistentVolumeClaim:
          claimName: filebrowser-data-pvc
      - name: webdav-config
        configMap:
          name: webdav-config
      - name: webdav-htpasswd
        secret:
          secretName: webdav-htpasswd
      - name: webdav-lock
        emptyDir: {}
      - name: apache-conf
        emptyDir: {}
      - name: apache-logs
        emptyDir: {}
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: webdav-config
  namespace: services
data:
  httpd-dav.conf: |
    LoadModule dav_module modules/mod_dav.so
    LoadModule dav_fs_module modules/mod_dav_fs.so
    LoadModule auth_basic_module modules/mod_auth_basic.so
    LoadModule authn_file_module modules/mod_authn_file.so
    LoadModule authz_user_module modules/mod_authz_user.so

    DavLockDB /var/lock/apache2/DavLock
    DocumentRoot "/var/www/webdav"

    <Directory "/var/www/webdav">
        Dav On
        Options Indexes FollowSymLinks

        AuthType Basic
        AuthName "WebDAV"
        AuthUserFile /etc/apache2/webdav.htpasswd
        Require valid-user
    </Directory>