diff --git a/syncthing/deployment.yaml b/syncthing/deployment.yaml new file mode 100644 index 0000000..b62ab0d --- /dev/null +++ b/syncthing/deployment.yaml @@ -0,0 +1,172 @@ +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.cmd: kompose convert -o deployment.yaml -n syncthing + kompose.service.expose: syncthing.wayl.one + kompose.version: 1.31.2 (a92241f79) + creationTimestamp: null + labels: + io.kompose.service: syncthing + name: syncthing + namespace: syncthing +spec: + ports: + - name: "8384" + port: 8384 + targetPort: 8384 + - name: "22000" + port: 22000 + targetPort: 22000 + - name: 22000-udp + port: 22000 + protocol: UDP + targetPort: 22000 + - name: "21027" + port: 21027 + protocol: UDP + targetPort: 21027 + selector: + io.kompose.service: syncthing +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: Namespace +metadata: + creationTimestamp: null + name: syncthing + namespace: syncthing +spec: {} +status: {} + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.cmd: kompose convert -o deployment.yaml -n syncthing + kompose.service.expose: syncthing.wayl.one + kompose.version: 1.31.2 (a92241f79) + creationTimestamp: null + labels: + io.kompose.service: syncthing + name: syncthing + namespace: syncthing +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: syncthing + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.cmd: kompose convert -o deployment.yaml -n syncthing + kompose.service.expose: syncthing.wayl.one + kompose.version: 1.31.2 (a92241f79) + creationTimestamp: null + labels: + io.kompose.network/proxy: "true" + io.kompose.service: syncthing + spec: + containers: + - env: + - name: PGID + value: "1000" + - name: PUID + value: "1000" + - name: TZ + value: America/Chicago + image: ghcr.io/linuxserver/syncthing + name: syncthing + ports: + - containerPort: 8384 + protocol: TCP + - containerPort: 22000 + protocol: TCP + - containerPort: 22000 + protocol: UDP + - containerPort: 21027 + protocol: UDP + resources: {} + volumeMounts: + - mountPath: /config + name: syncthing-config + - mountPath: /data + name: syncthing + restartPolicy: Always + volumes: + - name: syncthing-config + persistentVolumeClaim: + claimName: syncthing-config + - name: syncthing + persistentVolumeClaim: + claimName: syncthing +status: {} + +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + kompose.cmd: kompose convert -o deployment.yaml -n syncthing + kompose.service.expose: syncthing.wayl.one + kompose.version: 1.31.2 (a92241f79) + creationTimestamp: null + labels: + io.kompose.service: syncthing + name: syncthing + namespace: syncthing +spec: + rules: + - host: syncthing.wayl.one + http: + paths: + - backend: + service: + name: syncthing + port: + number: 8384 + path: / + pathType: Prefix +status: + loadBalancer: {} + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: syncthing-config + name: syncthing-config + namespace: syncthing +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: syncthing + name: syncthing + namespace: syncthing +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} + diff --git a/syncthing/docker-compose.yml b/syncthing/docker-compose.yml index 3dfeab8..a463730 100644 --- a/syncthing/docker-compose.yml +++ b/syncthing/docker-compose.yml @@ -4,7 +4,6 @@ services: syncthing: image: ghcr.io/linuxserver/syncthing container_name: syncthing - restart: unless-stopped security_opt: - no-new-privileges:true networks: @@ -14,26 +13,21 @@ services: - PGID=1000 - TZ=America/Chicago volumes: - - /etc/localtime:/etc/localtime:ro - - /tank/syncthing/config:/config - - /tank/syncthing:/data - # ports: - # - 8384:8384 - # - 22000:22000 - # - 21027:21027/udp + - syncthing-config:/config + - syncthing:/data + ports: + - 8384 + - 22000/tcp + - 22000/udp + - 21027/udp labels: - - "traefik.enable=true" - - "traefik.http.routers.syncthing.entrypoints=http" - - "traefik.http.routers.syncthing.rule=Host(`syncthing.${URL}`)" - - "traefik.http.middlewares.syncthing-https-redirect.redirectscheme.scheme=https" - - "traefik.http.routers.syncthing.middlewares=syncthing-https-redirect" - - "traefik.http.routers.syncthing-secure.entrypoints=https" - - "traefik.http.routers.syncthing-secure.rule=Host(`syncthing.${URL}`)" - - "traefik.http.routers.syncthing-secure.tls=true" - - "traefik.http.routers.syncthing-secure.service=syncthing" - - "traefik.http.services.syncthing.loadbalancer.server.port=8384" - - "traefik.docker.network=proxy" + kompose.service.expose: syncthing.wayl.one + # kompose.image-pull-secret: regcred networks: proxy: external: true + +volumes: + syncthing: {} + syncthing-config: {} diff --git a/syncthing/justfile b/syncthing/justfile new file mode 100644 index 0000000..6cf6e38 --- /dev/null +++ b/syncthing/justfile @@ -0,0 +1,31 @@ +default: cred convert deploy viz +update: convert patch + +create-ns: + kubectl create ns syncthing +cred: + kubectl get secret -n default regcred --output=yaml -o yaml | sed 's/namespace: default/namespace: syncthing/' | kubectl apply -n syncthing -f - && echo deployed secret || echo secret exists +convert: + kompose convert -o deployment.yaml -n syncthing +deploy: + kubectl apply -f deployment.yaml +delete: + kubectl delete all --all -n syncthing --timeout=0s +viz: + k8sviz -n syncthing --kubeconfig $KUBECONFIG -t png -o syncthing-k8s.png +restart: + kubectl rollout restart -n syncthing deployment/syncthing + +patch: + kubectl patch -f deployment.yaml +describe: + kubectl get deployment -n syncthing + kubectl get rs -n syncthing + kubectl get pod -n syncthing + kubectl get svc -n syncthing + kubectl get ing -n syncthing + +describe-pod: + kubectl describe pod -n syncthing +logs: + kubectl logs --all-containers -l io.kompose.service=syncthing-wayl-one -n syncthing -f diff --git a/syncthing/syncthing-k8s.png b/syncthing/syncthing-k8s.png new file mode 100644 index 0000000..c1b53b4 Binary files /dev/null and b/syncthing/syncthing-k8s.png differ