From cc8982315f2623888f76224c43318692812c9764 Mon Sep 17 00:00:00 2001 From: Gerrit Gogel Date: Tue, 5 Dec 2023 14:20:40 +0100 Subject: [PATCH] add k8s manifests --- compose/docker-compose-kompose.yml | 109 ++++++++++++++++++ k8s/db-deployment.yaml | 50 ++++++++ k8s/db-service.yaml | 19 +++ k8s/memcached-deployment.yaml | 33 ++++++ k8s/memcached-service.yaml | 16 +++ k8s/seafile-caddy-deployment.yaml | 46 ++++++++ k8s/seafile-caddy-ingress.yaml | 30 +++++ k8s/seafile-caddy-service.yaml | 24 ++++ k8s/seafile-data-persistentvolumeclaim.yaml | 14 +++ ...seafile-mariadb-persistentvolumeclaim.yaml | 14 +++ k8s/seafile-server-deployment.yaml | 60 ++++++++++ k8s/seafile-server-service.yaml | 28 +++++ k8s/seahub-avatars-persistentvolumeclaim.yaml | 14 +++ k8s/seahub-custom-persistentvolumeclaim.yaml | 14 +++ k8s/seahub-deployment.yaml | 52 +++++++++ k8s/seahub-media-deployment.yaml | 48 ++++++++ k8s/seahub-media-service.yaml | 19 +++ k8s/seahub-service.yaml | 16 +++ 18 files changed, 606 insertions(+) create mode 100644 compose/docker-compose-kompose.yml create mode 100644 k8s/db-deployment.yaml create mode 100644 k8s/db-service.yaml create mode 100644 k8s/memcached-deployment.yaml create mode 100644 k8s/memcached-service.yaml create mode 100644 k8s/seafile-caddy-deployment.yaml create mode 100644 k8s/seafile-caddy-ingress.yaml create mode 100644 k8s/seafile-caddy-service.yaml create mode 100644 k8s/seafile-data-persistentvolumeclaim.yaml create mode 100644 k8s/seafile-mariadb-persistentvolumeclaim.yaml create mode 100644 k8s/seafile-server-deployment.yaml create mode 100644 k8s/seafile-server-service.yaml create mode 100644 k8s/seahub-avatars-persistentvolumeclaim.yaml create mode 100644 k8s/seahub-custom-persistentvolumeclaim.yaml create mode 100644 k8s/seahub-deployment.yaml create mode 100644 k8s/seahub-media-deployment.yaml create mode 100644 k8s/seahub-media-service.yaml create mode 100644 k8s/seahub-service.yaml diff --git a/compose/docker-compose-kompose.yml b/compose/docker-compose-kompose.yml new file mode 100644 index 0000000..8a1d9d9 --- /dev/null +++ b/compose/docker-compose-kompose.yml @@ -0,0 +1,109 @@ +version: '3.8' +services: + seafile-server: + image: ggogel/seafile-server:11.0.2 + volumes: + - seafile-data:/shared + environment: + - DB_HOST=db + - DB_ROOT_PASSWD=db_dev + - TIME_ZONE=Europe/Berlin + - HTTPS=true + - SEAFILE_URL=seafile.mydomain.com # Mandatory on first deployment! + depends_on: + - db + - memcached + - seafile-caddy + networks: + - seafile-net + expose: + - 8001 + - 8080 + - 8082 + - 8083 + labels: + kompose.volume.size: 1Gi + kompose.service.expose.storage-class-name: default + + seahub: + image: ggogel/seahub:11.0.2 + volumes: + - seafile-data:/shared + - seahub-avatars:/shared/seafile/seahub-data/avatars + - seahub-custom:/shared/seafile/seahub-data/custom + environment: + - SEAFILE_ADMIN_EMAIL=me@example.com + - SEAFILE_ADMIN_PASSWORD=asecret + depends_on: + - seafile-server + - seafile-caddy + - seahub-media + networks: + - seafile-net + expose: + - 8000 + + seahub-media: + image: ggogel/seahub-media:11.0.2 + volumes: + - seahub-avatars:/usr/share/caddy/media/avatars + - seahub-custom:/usr/share/caddy/media/custom + depends_on: + - seafile-caddy + networks: + - seafile-net + expose: + - 80 + labels: + kompose.volume.size: 100Mi + kompose.service.expose.storage-class-name: default + + db: + image: mariadb:10.11.6 + environment: + - MYSQL_ROOT_PASSWORD=db_dev + - MYSQL_LOG_CONSOLE=true + - MARIADB_AUTO_UPGRADE=true + volumes: + - seafile-mariadb:/var/lib/mysql + networks: + - seafile-net + expose: + - 3306 + labels: + kompose.volume.size: 1Gi + kompose.service.expose.storage-class-name: default + + memcached: + image: memcached:1.6.22 + entrypoint: memcached -m 1024 + networks: + - seafile-net + expose: + - 11211 + + seafile-caddy: + image: ggogel/seafile-caddy:2.7.5 + networks: + - seafile-net + - default + labels: + kompose.service.expose: localhost + kompose.service.expose.ingress-class-name: nginx + nginx.ingress.kubernetes.io/proxy-body-size: 0 + nginx.ingress.kubernetes.io/proxy-connect-timeout: 36000 + nginx.ingress.kubernetes.io/proxy-read-timeout: 36000 + nginx.ingress.kubernetes.io/proxy-send-timeout: 36000 + nginx.ingress.kubernetes.io/send-timeout: 36000 + expose: + - 80 + +networks: + seafile-net: + internal: true + +volumes: + seafile-data: + seafile-mariadb: + seahub-avatars: + seahub-custom: \ No newline at end of file diff --git a/k8s/db-deployment.yaml b/k8s/db-deployment.yaml new file mode 100644 index 0000000..314b89b --- /dev/null +++ b/k8s/db-deployment.yaml @@ -0,0 +1,50 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.service.expose.storage-class-name: default + kompose.volume.size: 1Gi + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: db + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.service.expose.storage-class-name: default + kompose.volume.size: 1Gi + creationTimestamp: null + labels: + io.kompose.network/compose-seafile-net: "true" + io.kompose.service: db + spec: + containers: + - env: + - name: MARIADB_AUTO_UPGRADE + value: "true" + - name: MYSQL_LOG_CONSOLE + value: "true" + - name: MYSQL_ROOT_PASSWORD + value: db_dev + image: mariadb:10.11.6 + name: db + ports: + - containerPort: 3306 + protocol: TCP + resources: {} + volumeMounts: + - mountPath: /var/lib/mysql + name: seafile-mariadb + restartPolicy: Always + volumes: + - name: seafile-mariadb + persistentVolumeClaim: + claimName: seafile-mariadb +status: {} diff --git a/k8s/db-service.yaml b/k8s/db-service.yaml new file mode 100644 index 0000000..666004c --- /dev/null +++ b/k8s/db-service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.expose.storage-class-name: default + kompose.volume.size: 1Gi + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + ports: + - name: "3306" + port: 3306 + targetPort: 3306 + selector: + io.kompose.service: db +status: + loadBalancer: {} diff --git a/k8s/memcached-deployment.yaml b/k8s/memcached-deployment.yaml new file mode 100644 index 0000000..a56c7b7 --- /dev/null +++ b/k8s/memcached-deployment.yaml @@ -0,0 +1,33 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: memcached + name: memcached +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: memcached + strategy: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.network/compose-seafile-net: "true" + io.kompose.service: memcached + spec: + containers: + - command: + - memcached + - -m + - "1024" + image: memcached:1.6.22 + name: memcached + ports: + - containerPort: 11211 + protocol: TCP + resources: {} + restartPolicy: Always +status: {} diff --git a/k8s/memcached-service.yaml b/k8s/memcached-service.yaml new file mode 100644 index 0000000..1fb2edb --- /dev/null +++ b/k8s/memcached-service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: memcached + name: memcached +spec: + ports: + - name: "11211" + port: 11211 + targetPort: 11211 + selector: + io.kompose.service: memcached +status: + loadBalancer: {} diff --git a/k8s/seafile-caddy-deployment.yaml b/k8s/seafile-caddy-deployment.yaml new file mode 100644 index 0000000..2bbe9e1 --- /dev/null +++ b/k8s/seafile-caddy-deployment.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.service.expose: localhost + kompose.service.expose.ingress-class-name: nginx + nginx.ingress.kubernetes.io/proxy-body-size: "0" + nginx.ingress.kubernetes.io/proxy-connect-timeout: "36000" + nginx.ingress.kubernetes.io/proxy-read-timeout: "36000" + nginx.ingress.kubernetes.io/proxy-send-timeout: "36000" + nginx.ingress.kubernetes.io/send-timeout: "36000" + creationTimestamp: null + labels: + io.kompose.service: seafile-caddy + name: seafile-caddy +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: seafile-caddy + strategy: {} + template: + metadata: + annotations: + kompose.service.expose: localhost + kompose.service.expose.ingress-class-name: nginx + nginx.ingress.kubernetes.io/proxy-body-size: "0" + nginx.ingress.kubernetes.io/proxy-connect-timeout: "36000" + nginx.ingress.kubernetes.io/proxy-read-timeout: "36000" + nginx.ingress.kubernetes.io/proxy-send-timeout: "36000" + nginx.ingress.kubernetes.io/send-timeout: "36000" + creationTimestamp: null + labels: + io.kompose.network/compose-default: "true" + io.kompose.network/compose-seafile-net: "true" + io.kompose.service: seafile-caddy + spec: + containers: + - image: ggogel/seafile-caddy:2.7.5 + name: seafile-caddy + ports: + - containerPort: 80 + protocol: TCP + resources: {} + restartPolicy: Always +status: {} diff --git a/k8s/seafile-caddy-ingress.yaml b/k8s/seafile-caddy-ingress.yaml new file mode 100644 index 0000000..506f2b7 --- /dev/null +++ b/k8s/seafile-caddy-ingress.yaml @@ -0,0 +1,30 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + kompose.service.expose: localhost + kompose.service.expose.ingress-class-name: nginx + nginx.ingress.kubernetes.io/proxy-body-size: "0" + nginx.ingress.kubernetes.io/proxy-connect-timeout: "36000" + nginx.ingress.kubernetes.io/proxy-read-timeout: "36000" + nginx.ingress.kubernetes.io/proxy-send-timeout: "36000" + nginx.ingress.kubernetes.io/send-timeout: "36000" + creationTimestamp: null + labels: + io.kompose.service: seafile-caddy + name: seafile-caddy +spec: + ingressClassName: nginx + rules: + - host: localhost + http: + paths: + - backend: + service: + name: seafile-caddy + port: + number: 80 + path: / + pathType: Prefix +status: + loadBalancer: {} diff --git a/k8s/seafile-caddy-service.yaml b/k8s/seafile-caddy-service.yaml new file mode 100644 index 0000000..ff48d5c --- /dev/null +++ b/k8s/seafile-caddy-service.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.expose: localhost + kompose.service.expose.ingress-class-name: nginx + nginx.ingress.kubernetes.io/proxy-body-size: "0" + nginx.ingress.kubernetes.io/proxy-connect-timeout: "36000" + nginx.ingress.kubernetes.io/proxy-read-timeout: "36000" + nginx.ingress.kubernetes.io/proxy-send-timeout: "36000" + nginx.ingress.kubernetes.io/send-timeout: "36000" + creationTimestamp: null + labels: + io.kompose.service: seafile-caddy + name: seafile-caddy +spec: + ports: + - name: "80" + port: 80 + targetPort: 80 + selector: + io.kompose.service: seafile-caddy +status: + loadBalancer: {} diff --git a/k8s/seafile-data-persistentvolumeclaim.yaml b/k8s/seafile-data-persistentvolumeclaim.yaml new file mode 100644 index 0000000..3a4b7ea --- /dev/null +++ b/k8s/seafile-data-persistentvolumeclaim.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: seafile-data + name: seafile-data +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +status: {} diff --git a/k8s/seafile-mariadb-persistentvolumeclaim.yaml b/k8s/seafile-mariadb-persistentvolumeclaim.yaml new file mode 100644 index 0000000..ababe0c --- /dev/null +++ b/k8s/seafile-mariadb-persistentvolumeclaim.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: seafile-mariadb + name: seafile-mariadb +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +status: {} diff --git a/k8s/seafile-server-deployment.yaml b/k8s/seafile-server-deployment.yaml new file mode 100644 index 0000000..d2a1d66 --- /dev/null +++ b/k8s/seafile-server-deployment.yaml @@ -0,0 +1,60 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.service.expose.storage-class-name: default + kompose.volume.size: 1Gi + creationTimestamp: null + labels: + io.kompose.service: seafile-server + name: seafile-server +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: seafile-server + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.service.expose.storage-class-name: default + kompose.volume.size: 1Gi + creationTimestamp: null + labels: + io.kompose.network/compose-seafile-net: "true" + io.kompose.service: seafile-server + spec: + containers: + - env: + - name: DB_HOST + value: db + - name: DB_ROOT_PASSWD + value: db_dev + - name: HTTPS + value: "true" + - name: SEAFILE_URL + value: seafile.mydomain.com + - name: TIME_ZONE + value: Europe/Berlin + image: ggogel/seafile-server:11.0.2 + name: seafile-server + ports: + - containerPort: 8001 + protocol: TCP + - containerPort: 8080 + protocol: TCP + - containerPort: 8082 + protocol: TCP + - containerPort: 8083 + protocol: TCP + resources: {} + volumeMounts: + - mountPath: /shared + name: seafile-data + restartPolicy: Always + volumes: + - name: seafile-data + persistentVolumeClaim: + claimName: seafile-data +status: {} diff --git a/k8s/seafile-server-service.yaml b/k8s/seafile-server-service.yaml new file mode 100644 index 0000000..f443a78 --- /dev/null +++ b/k8s/seafile-server-service.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.expose.storage-class-name: default + kompose.volume.size: 1Gi + creationTimestamp: null + labels: + io.kompose.service: seafile-server + name: seafile-server +spec: + ports: + - name: "8001" + port: 8001 + targetPort: 8001 + - name: "8080" + port: 8080 + targetPort: 8080 + - name: "8082" + port: 8082 + targetPort: 8082 + - name: "8083" + port: 8083 + targetPort: 8083 + selector: + io.kompose.service: seafile-server +status: + loadBalancer: {} diff --git a/k8s/seahub-avatars-persistentvolumeclaim.yaml b/k8s/seahub-avatars-persistentvolumeclaim.yaml new file mode 100644 index 0000000..2d83c5f --- /dev/null +++ b/k8s/seahub-avatars-persistentvolumeclaim.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: seahub-avatars + name: seahub-avatars +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} diff --git a/k8s/seahub-custom-persistentvolumeclaim.yaml b/k8s/seahub-custom-persistentvolumeclaim.yaml new file mode 100644 index 0000000..539db8d --- /dev/null +++ b/k8s/seahub-custom-persistentvolumeclaim.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: seahub-custom + name: seahub-custom +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} diff --git a/k8s/seahub-deployment.yaml b/k8s/seahub-deployment.yaml new file mode 100644 index 0000000..3803128 --- /dev/null +++ b/k8s/seahub-deployment.yaml @@ -0,0 +1,52 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: seahub + name: seahub +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: seahub + strategy: + type: Recreate + template: + metadata: + creationTimestamp: null + labels: + io.kompose.network/compose-seafile-net: "true" + io.kompose.service: seahub + spec: + containers: + - env: + - name: SEAFILE_ADMIN_EMAIL + value: me@example.com + - name: SEAFILE_ADMIN_PASSWORD + value: asecret + image: ggogel/seahub:11.0.2 + name: seahub + ports: + - containerPort: 8000 + protocol: TCP + resources: {} + volumeMounts: + - mountPath: /shared + name: seafile-data + - mountPath: /shared/seafile/seahub-data/avatars + name: seahub-avatars + - mountPath: /shared/seafile/seahub-data/custom + name: seahub-custom + restartPolicy: Always + volumes: + - name: seafile-data + persistentVolumeClaim: + claimName: seafile-data + - name: seahub-avatars + persistentVolumeClaim: + claimName: seahub-avatars + - name: seahub-custom + persistentVolumeClaim: + claimName: seahub-custom +status: {} diff --git a/k8s/seahub-media-deployment.yaml b/k8s/seahub-media-deployment.yaml new file mode 100644 index 0000000..4f6013b --- /dev/null +++ b/k8s/seahub-media-deployment.yaml @@ -0,0 +1,48 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.service.expose.storage-class-name: default + kompose.volume.size: 100Mi + creationTimestamp: null + labels: + io.kompose.service: seahub-media + name: seahub-media +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: seahub-media + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.service.expose.storage-class-name: default + kompose.volume.size: 100Mi + creationTimestamp: null + labels: + io.kompose.network/compose-seafile-net: "true" + io.kompose.service: seahub-media + spec: + containers: + - image: ggogel/seahub-media:11.0.2 + name: seahub-media + ports: + - containerPort: 80 + protocol: TCP + resources: {} + volumeMounts: + - mountPath: /usr/share/caddy/media/avatars + name: seahub-avatars + - mountPath: /usr/share/caddy/media/custom + name: seahub-custom + restartPolicy: Always + volumes: + - name: seahub-avatars + persistentVolumeClaim: + claimName: seahub-avatars + - name: seahub-custom + persistentVolumeClaim: + claimName: seahub-custom +status: {} diff --git a/k8s/seahub-media-service.yaml b/k8s/seahub-media-service.yaml new file mode 100644 index 0000000..1af7d5a --- /dev/null +++ b/k8s/seahub-media-service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.service.expose.storage-class-name: default + kompose.volume.size: 100Mi + creationTimestamp: null + labels: + io.kompose.service: seahub-media + name: seahub-media +spec: + ports: + - name: "80" + port: 80 + targetPort: 80 + selector: + io.kompose.service: seahub-media +status: + loadBalancer: {} diff --git a/k8s/seahub-service.yaml b/k8s/seahub-service.yaml new file mode 100644 index 0000000..77a496e --- /dev/null +++ b/k8s/seahub-service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: seahub + name: seahub +spec: + ports: + - name: "8000" + port: 8000 + targetPort: 8000 + selector: + io.kompose.service: seahub +status: + loadBalancer: {}