From 46f2c6197fa601d869f9e0a109af1a0050dd34ff Mon Sep 17 00:00:00 2001 From: TapTap Date: Tue, 20 Oct 2026 15:50:34 +0200 Subject: [PATCH] add idrive --- idrive/.helmignore | 23 +++++++++++ idrive/Chart.yaml | 24 +++++++++++ idrive/Dockerfile | 71 ++++++++++++++++++++++++++++++++ idrive/start.sh | 14 +++++++ idrive/templates/deployment.yaml | 40 ++++++++++++++++++ idrive/templates/namespace.yaml | 5 +++ idrive/values.yaml | 15 +++++++ 7 files changed, 192 insertions(+) create mode 100644 idrive/.helmignore create mode 100644 idrive/Chart.yaml create mode 100644 idrive/Dockerfile create mode 100644 idrive/start.sh create mode 100644 idrive/templates/deployment.yaml create mode 100644 idrive/templates/namespace.yaml create mode 100644 idrive/values.yaml diff --git a/idrive/.helmignore b/idrive/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/idrive/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/idrive/Chart.yaml b/idrive/Chart.yaml new file mode 100644 index 0000000..cc2f68a --- /dev/null +++ b/idrive/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: idrive +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/idrive/Dockerfile b/idrive/Dockerfile new file mode 100644 index 0000000..b114114 --- /dev/null +++ b/idrive/Dockerfile @@ -0,0 +1,71 @@ +FROM debian:bookworm-slim + +# Install dependencies (including python3 and procps) +RUN apt-get update && apt-get install -y --no-install-recommends \ + perl \ + curl \ + wget \ + ca-certificates \ + sqlite3 \ + psmisc \ + procps \ + cron \ + unzip \ + python3 \ + vim \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /tmp + +# Download and install with exported LD_LIBRARY_PATH & TERM during build step +RUN wget https://www.idrivedownloads.com/downloads/linux/download-for-linux/linux-bin/idriveforlinux.bin && \ + chmod +x idriveforlinux.bin && \ + bash -c 'export TERM=xterm; export LD_LIBRARY_PATH="/opt/IDriveForLinux/bin/Idrivelib/dependencies/python/lib"; echo -ne "A\n" | ./idriveforlinux.bin --install' && \ + rm idriveforlinux.bin + +# Create seed template for Kubernetes PVC mounts +RUN cp -a /opt/IDriveForLinux/idriveIt /opt/IDriveForLinux/idriveIt.orig + +# Set container environment variables +ENV LD_LIBRARY_PATH="/opt/IDriveForLinux/bin/Idrivelib/dependencies/python/lib" +ENV PATH="/opt/IDriveForLinux/bin:${PATH}" +ENV LC_ALL=C.UTF-8 + +# Add startup entrypoint script +COPY start.sh /start.sh +RUN chmod +x /start.sh + +WORKDIR /opt/IDriveForLinux/bin + +CMD ["/start.sh"] +# +# FROM debian:bookworm-slim +# +# # Install dependencies +# RUN apt-get update && apt-get install -y --no-install-recommends \ +# perl \ +# curl \ +# wget \ +# ca-certificates \ +# sqlite3 \ +# psmisc \ +# cron \ +# && rm -rf /var/lib/apt/lists/* +# +# WORKDIR /tmp +# +# ENV LD_LIBRARY_PATH="/opt/IDriveForLinux/bin/Idrivelib/dependencies/python/lib" +# ENV PATH="/opt/IDriveForLinux/bin:${PATH}" +# +# RUN wget https://www.idrivedownloads.com/downloads/linux/download-for-linux/linux-bin/idriveforlinux.bin \ +# && chmod +x idriveforlinux.bin \ +# && yes A | ./idriveforlinux.bin --install | tee /root/log.txt \ +# && rm idriveforlinux.bin +# +# RUN echo 'export LD_LIBRARY_PATH="/opt/IDriveForLinux/bin/Idrivelib/dependencies/python/lib:$LD_LIBRARY_PATH"' >> /root/.bashrc \ +# && echo 'export PATH="/opt/IDriveForLinux/bin:$PATH"' >> /root/.bashrc \ +# && echo 'LD_LIBRARY_PATH="/opt/IDriveForLinux/bin/Idrivelib/dependencies/python/lib"' >> /etc/environment +# +# WORKDIR /root +# +# CMD ["tail", "-f", "/dev/null"] diff --git a/idrive/start.sh b/idrive/start.sh new file mode 100644 index 0000000..c5838dc --- /dev/null +++ b/idrive/start.sh @@ -0,0 +1,14 @@ +#!/bin/bash +export LD_LIBRARY_PATH="/opt/IDriveForLinux/bin/Idrivelib/dependencies/python/lib:$LD_LIBRARY_PATH" + +# Seed empty Kubernetes PVC volume on first startup +if [ ! -f /opt/IDriveForLinux/idriveIt/idrivecrontab.json ]; then + echo "Initializing persistent volume in /opt/IDriveForLinux/idriveIt..." + cp -a /opt/IDriveForLinux/idriveIt.orig/* /opt/IDriveForLinux/idriveIt/ +fi + +# Start background cron service for scheduled backups +cron + +# Keep container running in background +tail -f /dev/null diff --git a/idrive/templates/deployment.yaml b/idrive/templates/deployment.yaml new file mode 100644 index 0000000..4b2af50 --- /dev/null +++ b/idrive/templates/deployment.yaml @@ -0,0 +1,40 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Namespace }}-deployment + labels: + app: {{ .Release.Namespace }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ .Release.Namespace }} + template: + metadata: + labels: + app: {{ .Release.Namespace }} + spec: + containers: + - name: {{ .Release.Namespace }} + image: taptap1/idrive:{{ .Values.image.tag }} + # env: + # - name: TZ + # value: .Values.env.timezone | quote }} + volumeMounts: + - name: {{ .Values.configMount.name }} + mountPath: /opt/IDriveForLinux/idriveIt/user_profile + {{- range .Values.mounts}} + - name: {{ .name }} + mountPath: /source/{{ .name }} + readOnly: true + {{- end }} + volumes: + - name: {{ .Values.configMount.name }} + hostPath: + path: {{ .Values.configMount.path }} + {{- range .Values.mounts }} + - name: {{ .name }} + hostPath: + path: {{ .path }} + {{- end }} + diff --git a/idrive/templates/namespace.yaml b/idrive/templates/namespace.yaml new file mode 100644 index 0000000..4f95855 --- /dev/null +++ b/idrive/templates/namespace.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: {{ .Release.Namespace }} + diff --git a/idrive/values.yaml b/idrive/values.yaml new file mode 100644 index 0000000..c2d5659 --- /dev/null +++ b/idrive/values.yaml @@ -0,0 +1,15 @@ +replicaCount: 1 + +image: + tag: "latest" + +# env: +# timezone: "Europe/Berlin" + +configMount: + name: idrive-config + path: /root/kubernetes/idrive/data/config + +mounts: + - name: test + path: /root/kubernetes/idrive