[onedrive] Add Chart (#1174)

* [onedrive] Scaffold out helm chart

Signed-off-by: Winston R. Milling <Winston@Milli.ng>

* [onedrive] Add configmap for onedrive/conf/config

* [onedrive] Add file auth templating

* [onedrive] Moving to stable on recommendation

* [onedrive] Update README.md

* [onedrive] Update README.md

* Update values.yaml

* [onedrive] Missing accessMode on persistence

* [onedrive] Adding more defaults for data storage

* [onedrive] Add custom config to README.md

Add ci config to help it pass

* [onedrive] Updating README.md on feedback from rwaltr

* [onedrive] did not run pre-commit, fixed issues

* [onedrive] Don't require secret for CI run

* [onedrive] Add UID/GID

Co-authored-by: ᗪєνιη ᗷυнʟ <onedr0p@users.noreply.github.com>
This commit is contained in:
Winston R. Milling 2021-09-12 15:41:06 -05:00 committed by GitHub
parent 86b05e1d9f
commit abc787fd38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 492 additions and 0 deletions

View File

@ -0,0 +1,20 @@
apiVersion: v2
appVersion: v2.4.12
description: A free Microsoft OneDrive Client which supports OneDrive Personal, OneDrive for Business, OneDrive for Office365, and SharePoint
name: onedrive
version: 1.0.0
kubeVersion: ">=1.16.0-0"
keywords:
- onedrive
- filesync
home: https://github.com/k8s-at-home/charts/tree/master/charts/incubator/onedrive
icon: https://github.com/abraunegg/abraunegg.github.io/raw/master/images/linux_onedrive_logo.jpg
sources:
- https://github.com/abraunegg/onedrive
maintainers:
- name: wrmilling
email: winston@milli.ng
dependencies:
- name: common
repository: https://library-charts.k8s-at-home.com
version: 4.0.0

View File

@ -0,0 +1,127 @@
# onedrive
![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![AppVersion: v2.4.12](https://img.shields.io/badge/AppVersion-v2.4.12-informational?style=flat-square)
A free Microsoft OneDrive Client which supports OneDrive Personal, OneDrive for Business, OneDrive for Office365, and SharePoint
**This chart is not maintained by the upstream project and any issues with the chart should be raised [here](https://github.com/k8s-at-home/charts/issues/new/choose)**
## Source Code
* <https://github.com/abraunegg/onedrive>
## Requirements
Kubernetes: `>=1.16.0-0`
## Dependencies
| Repository | Name | Version |
|------------|------|---------|
| https://library-charts.k8s-at-home.com | common | 4.0.0 |
## TL;DR
```console
helm repo add k8s-at-home https://k8s-at-home.com/charts/
helm repo update
helm install onedrive k8s-at-home/onedrive
```
## Installing the Chart
To install the chart with the release name `onedrive`
```console
helm install onedrive k8s-at-home/onedrive
```
## Uninstalling the Chart
To uninstall the `onedrive` deployment
```console
helm uninstall onedrive
```
The command removes all the Kubernetes components associated with the chart **including persistent volumes** and deletes the release.
## Configuration
Read through the [values.yaml](./values.yaml) file. It has several commented out suggested values.
Other values may be used from the [values.yaml](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common/values.yaml) from the [common library](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common).
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
```console
helm install onedrive \
--set env.TZ="America/New York" \
k8s-at-home/onedrive
```
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart.
```console
helm install onedrive k8s-at-home/onedrive -f values.yaml
```
## Custom configuration
To use this chart, you will need to set an application_id in the `config` section as well as a secret (called `auth-response` by default) with a field called `auth-response` that has the value derrived from the process below.
In order to generate an auth-response value you must do the following:
1. Generate an `application_id` and set it in the `config` varaible of values.yaml (see [values.yaml](values.yaml) for a default config).
* You can use a tool like [UUID Generator](https://www.uuidgenerator.net/) for this step.
2. Visit the following URL, replacing `<APPLICATION_ID>` with the one you generated above: `https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=<APPLICATION_ID>&scope=Files.ReadWrite%20Files.ReadWrite.all%20Sites.ReadWrite.All%20offline_access&response_type=code&redirect_uri=https://login.microsoftonline.com/common/oauth2/nativeclient`
3. Authenticate with your OneDrive account.
4. Copy the URL when you arrive at the blank page (should look like this: `https://login.microsoftonline.com/common/oauth2/nativeclient?code=<redacted>`) and use that as the `auth-reponse` value in the previously mentioned secret `auth-response`.
## Values
**Important**: When deploying an application Helm chart you can add more values from our common library chart [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common)
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| auth | object | See values.yaml | Configure auth secret for onedrive to initialize with |
| config | string | `"# Configuration for OneDrive Linux Client\n# This file contains the list of supported configuration fields\n# with their default values.\n# All values need to be enclosed in quotes\n# When changing a config option below, remove the '#' from the start of the line\n# For explanations of all config options below see docs/USAGE.md or the man page.\n#\n# sync_dir = \"/onedrive/data\"\n# skip_file = \"~*|.~*|*.tmp\"\n# monitor_interval = \"300\"\n# skip_dir = \"\"\n# log_dir = \"/var/log/onedrive/\"\n# drive_id = \"\"\n# upload_only = \"false\"\n# check_nomount = \"false\"\n# check_nosync = \"false\"\n# download_only = \"false\"\n# disable_notifications = \"false\"\n# disable_upload_validation = \"false\"\n# enable_logging = \"false\"\n# force_http_2 = \"false\"\n# local_first = \"false\"\n# no_remote_delete = \"false\"\n# skip_symlinks = \"false\"\n# debug_https = \"false\"\n# skip_dotfiles = \"false\"\n# dry_run = \"false\"\n# min_notify_changes = \"5\"\n# monitor_log_frequency = \"5\"\n# monitor_fullscan_frequency = \"10\"\n# sync_root_files = \"false\"\n# classify_as_big_delete = \"1000\"\n# user_agent = \"\"\n# remove_source_files = \"false\"\n# skip_dir_strict_match = \"false\"\napplication_id = \"\"\n# resync = \"false\"\n# bypass_data_preservation = \"false\"\n# azure_ad_endpoint = \"\"\n# azure_tenant_id = \"common\"\n# sync_business_shared_folders = \"false\"\n# sync_dir_permissions = \"700\"\n# sync_file_permissions = \"600\"\n# rate_limit = \"131072\"\n"` | |
| env | object | See below and commented variables in values.yaml | environment variables. |
| env.ONEDRIVE_AUTHFILES | string | `"/onedrive/auth-request:/onedrive/auth-response"` | Set the auth request and response file locations for OneDrive |
| env.ONEDRIVE_DATA_DIR | string | `"/onedrive/conf"` | Set the data directory for OneDrive |
| env.ONEDRIVE_GID | int | `1000` | Set the One Drive Group ID |
| env.ONEDRIVE_UID | int | `1000` | Set the OneDrive User ID |
| env.TZ | string | `"UTC"` | Set the container timezone |
| image.pullPolicy | string | `"IfNotPresent"` | image pull policy |
| image.repository | string | `"ghcr.io/wrmilling/onedrive-docker"` | image repository |
| image.tag | string | `"latest"` | image tag |
| persistence | object | See values.yaml for full listing | Configure persistence settings for the chart under this key. |
| persistence.config | object | `{"accessMode":"ReadWriteOnce","enabled":true,"mountPath":"/onedrive/conf"}` | OneDrive config storage |
| persistence.config.enabled | bool | `true` | If config storage should be enabled |
| persistence.config.mountPath | string | `"/onedrive/conf"` | Mount location for config |
| persistence.data | object | `{"accessMode":"ReadWriteOnce","enabled":true,"mountPath":"/onedrive/data","readOnly":false,"retain":false,"size":"5Gi","type":"pvc"}` | OneDrive data storage |
| persistence.data.enabled | bool | `true` | If data storage should be enabled |
| persistence.data.mountPath | string | `"/onedrive/data"` | Mount location for onedrive data |
## Changelog
All notable changes to this application Helm chart will be documented in this file but does not include changes from our common library. To read those click [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common#changelog).
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### [1.0.0]
#### Added
- Ability to run a abraunegg/onedrive instance
[1.0.0]: #1.0.0
## Support
- See the [Docs](https://docs.k8s-at-home.com/our-helm-charts/getting-started/)
- Open an [issue](https://github.com/k8s-at-home/charts/issues/new/choose)
- Ask a [question](https://github.com/k8s-at-home/organization/discussions)
- Join our [Discord](https://discord.gg/sTMX7Vh) community
----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)

View File

@ -0,0 +1,146 @@
{{- define "custom.repository.organization" -}}
k8s-at-home
{{- end -}}
{{- define "custom.repository.url" -}}
https://github.com/k8s-at-home/charts
{{- end -}}
{{- define "custom.helm.url" -}}
https://k8s-at-home.com/charts/
{{- end -}}
{{- define "custom.helm.path" -}}
{{ template "custom.repository.organization" . }}/{{ template "chart.name" . }}
{{- end -}}
{{- define "custom.notes" -}}
**This chart is not maintained by the upstream project and any issues with the chart should be raised [here](https://github.com/k8s-at-home/charts/issues/new/choose)**
{{- end -}}
{{- define "custom.requirements" -}}
## Requirements
{{ template "chart.kubeVersionLine" . }}
{{- end -}}
{{- define "custom.dependencies" -}}
## Dependencies
{{ template "chart.requirementsTable" . }}
{{- end -}}
{{- define "custom.install.tldr" -}}
## TL;DR
```console
helm repo add {{ template "custom.repository.organization" . }} {{ template "custom.helm.url" . }}
helm repo update
helm install {{ template "chart.name" . }} {{ template "custom.helm.path" . }}
```
{{- end -}}
{{- define "custom.install" -}}
## Installing the Chart
To install the chart with the release name `{{ template "chart.name" . }}`
```console
helm install {{ template "chart.name" . }} {{ template "custom.helm.path" . }}
```
{{- end -}}
{{- define "custom.uninstall" -}}
## Uninstalling the Chart
To uninstall the `{{ template "chart.name" . }}` deployment
```console
helm uninstall {{ template "chart.name" . }}
```
The command removes all the Kubernetes components associated with the chart **including persistent volumes** and deletes the release.
{{- end -}}
{{- define "custom.configuration.header" -}}
## Configuration
{{- end -}}
{{- define "custom.configuration.readValues" -}}
Read through the [values.yaml](./values.yaml) file. It has several commented out suggested values.
Other values may be used from the [values.yaml](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common/values.yaml) from the [common library](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common).
{{- end -}}
{{- define "custom.configuration.example.set" -}}
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
```console
helm install {{ template "chart.name" . }} \
--set env.TZ="America/New York" \
{{ template "custom.helm.path" . }}
```
{{- end -}}
{{- define "custom.configuration.example.file" -}}
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart.
```console
helm install {{ template "chart.name" . }} {{ template "custom.helm.path" . }} -f values.yaml
```
{{- end -}}
{{- define "custom.valuesSection" -}}
## Values
**Important**: When deploying an application Helm chart you can add more values from our common library chart [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common)
{{ template "chart.valuesTable" . }}
{{- end -}}
{{- define "custom.support" -}}
## Support
- See the [Docs](https://docs.k8s-at-home.com/our-helm-charts/getting-started/)
- Open an [issue](https://github.com/k8s-at-home/charts/issues/new/choose)
- Ask a [question](https://github.com/k8s-at-home/organization/discussions)
- Join our [Discord](https://discord.gg/sTMX7Vh) community
{{- end -}}
{{ template "chart.header" . }}
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}
{{ template "chart.description" . }}
{{ template "custom.notes" . }}
{{ template "chart.sourcesSection" . }}
{{ template "custom.requirements" . }}
{{ template "custom.dependencies" . }}
{{ template "custom.install.tldr" . }}
{{ template "custom.install" . }}
{{ template "custom.uninstall" . }}
{{ template "custom.configuration.header" . }}
{{ template "custom.configuration.readValues" . }}
{{ template "custom.configuration.example.set" . }}
{{ template "custom.configuration.example.file" . }}
{{ template "custom.custom.configuration" . }}
{{ template "custom.valuesSection" . }}
{{ template "custom.changelog" . }}
{{ template "custom.support" . }}
{{ template "helm-docs.versionFooter" . }}
{{ "" }}

View File

@ -0,0 +1,19 @@
{{- define "custom.changelog.header" -}}
## Changelog
{{- end -}}
{{- define "custom.changelog" -}}
{{ template "custom.changelog.header" . }}
All notable changes to this application Helm chart will be documented in this file but does not include changes from our common library. To read those click [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common#changelog).
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### [1.0.0]
#### Added
- Ability to run a abraunegg/onedrive instance
[1.0.0]: #1.0.0
{{- end -}}

View File

@ -0,0 +1,18 @@
{{- define "custom.custom.configuration.header" -}}
## Custom configuration
{{- end -}}
{{- define "custom.custom.configuration" -}}
{{ template "custom.custom.configuration.header" . }}
To use this chart, you will need to set an application_id in the `config` section as well as a secret (called `auth-response` by default) with a field called `auth-response` that has the value derrived from the process below.
In order to generate an auth-response value you must do the following:
1. Generate an `application_id` and set it in the `config` varaible of values.yaml (see [values.yaml](values.yaml) for a default config).
* You can use a tool like [UUID Generator](https://www.uuidgenerator.net/) for this step.
2. Visit the following URL, replacing `<APPLICATION_ID>` with the one you generated above: `https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=<APPLICATION_ID>&scope=Files.ReadWrite%20Files.ReadWrite.all%20Sites.ReadWrite.All%20offline_access&response_type=code&redirect_uri=https://login.microsoftonline.com/common/oauth2/nativeclient`
3. Authenticate with your OneDrive account.
4. Copy the URL when you arrive at the blank page (should look like this: `https://login.microsoftonline.com/common/oauth2/nativeclient?code=<redacted>`) and use that as the `auth-reponse` value in the previously mentioned secret `auth-response`.
{{- end -}}

View File

@ -0,0 +1,2 @@
auth:
existingSecret: ""

View File

@ -0,0 +1 @@
{{- include "common.notes.defaultNotes" . -}}

View File

@ -0,0 +1,41 @@
{{/* Make sure all variables are set properly */}}
{{- include "common.values.setup" . }}
{{/* Append the hardcoded settings */}}
{{- define "onedrive.hardcodedValues" -}}
service:
main:
enabled: false
probes:
liveness:
enabled: false
readiness:
enabled: false
startup:
enabled: false
persistence:
{{- if .Values.auth.existingSecret }}
onedrive-auth:
enabled: "true"
mountPath: "/onedrive/auth-response"
subPath: "auth-response"
type: "custom"
volumeSpec:
secret:
secretName: {{ .Values.auth.existingSecret }}
{{- end }}
onedrive-settings:
enabled: "true"
mountPath: "/onedrive/conf/config"
subPath: "config"
type: "custom"
volumeSpec:
configMap:
name: {{ printf "%v-config" (include "common.names.fullname" .) }}
{{- end -}}
{{- $_ := mergeOverwrite .Values (include "onedrive.hardcodedValues" . | fromYaml) -}}
{{ include "common.all" . }}

View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "common.names.fullname" . }}-config
labels:
{{- include "common.labels" . | nindent 4 }}
data:
config: |
{{ .Values.config | indent 4 }}

View File

@ -0,0 +1,109 @@
#
# IMPORTANT NOTE
#
# This chart inherits from our common library chart. You can check the default values/options here:
# https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common/values.yaml
#
image:
# -- image repository
repository: ghcr.io/wrmilling/onedrive-docker
# -- image tag
tag: latest
# -- image pull policy
pullPolicy: IfNotPresent
# -- environment variables.
# @default -- See below and commented variables in values.yaml
env:
# -- Set the container timezone
TZ: UTC
# -- Set the data directory for OneDrive
ONEDRIVE_DATA_DIR: /onedrive/conf
# -- Set the auth request and response file locations for OneDrive
ONEDRIVE_AUTHFILES: "/onedrive/auth-request:/onedrive/auth-response"
# -- Set the OneDrive User ID
ONEDRIVE_UID: 1000
# -- Set the One Drive Group ID
ONEDRIVE_GID: 1000
# ONEDRIVE_VERBOSE: 0
# ONEDRIVE_DEBUG: 0
# ONEDRIVE_DEBUG_HTTPS: 0
# ONEDRIVE_RESYNC: 0
# ONEDRIVE_DOWNLOADONLY: 0
# ONEDRIVE_LOGOUT: 0
# -- Configure auth secret for onedrive to initialize with
# @default -- See values.yaml
auth:
existingSecret: "onedrive-auth"
# -- Configure persistence settings for the chart under this key.
# @default -- See values.yaml for full listing
persistence:
# -- OneDrive config storage
config:
# -- If config storage should be enabled
enabled: true
# -- Mount location for config
mountPath: /onedrive/conf
accessMode: ReadWriteOnce
# -- OneDrive data storage
data:
# -- If data storage should be enabled
enabled: true
# -- Mount location for onedrive data
mountPath: /onedrive/data
type: pvc
size: 5Gi
accessMode: ReadWriteOnce
readOnly: false
retain: false
# @default -- Default config with application_id set. If you update, please be sure to set the application_id
config: |
# Configuration for OneDrive Linux Client
# This file contains the list of supported configuration fields
# with their default values.
# All values need to be enclosed in quotes
# When changing a config option below, remove the '#' from the start of the line
# For explanations of all config options below see docs/USAGE.md or the man page.
#
# sync_dir = "/onedrive/data"
# skip_file = "~*|.~*|*.tmp"
# monitor_interval = "300"
# skip_dir = ""
# log_dir = "/var/log/onedrive/"
# drive_id = ""
# upload_only = "false"
# check_nomount = "false"
# check_nosync = "false"
# download_only = "false"
# disable_notifications = "false"
# disable_upload_validation = "false"
# enable_logging = "false"
# force_http_2 = "false"
# local_first = "false"
# no_remote_delete = "false"
# skip_symlinks = "false"
# debug_https = "false"
# skip_dotfiles = "false"
# dry_run = "false"
# min_notify_changes = "5"
# monitor_log_frequency = "5"
# monitor_fullscan_frequency = "10"
# sync_root_files = "false"
# classify_as_big_delete = "1000"
# user_agent = ""
# remove_source_files = "false"
# skip_dir_strict_match = "false"
application_id = ""
# resync = "false"
# bypass_data_preservation = "false"
# azure_ad_endpoint = ""
# azure_tenant_id = "common"
# sync_business_shared_folders = "false"
# sync_dir_permissions = "700"
# sync_file_permissions = "600"
# rate_limit = "131072"