diff --git a/charts/stable/gollum/Chart.yaml b/charts/stable/gollum/Chart.yaml new file mode 100644 index 00000000..c5a9bdc7 --- /dev/null +++ b/charts/stable/gollum/Chart.yaml @@ -0,0 +1,21 @@ +apiVersion: v2 +appVersion: latest +description: Gollum is a simple wiki system built on top of Git +name: gollum +version: 1.0.0 +kubeVersion: ">=1.16.0-0" +keywords: +- gollum +- wiki +home: https://github.com/k8s-at-home/charts/tree/master/charts/stable/gollum +icon: https://gollum.org/icon +sources: +- https://github.com/gollum/gollum +- https://github.com/gollum/docker +maintainers: +- name: chris-sanders + email: sanders.chris@gmail.com +dependencies: +- name: common + repository: https://library-charts.k8s-at-home.com + version: 2.5.0 diff --git a/charts/stable/gollum/README.md b/charts/stable/gollum/README.md new file mode 100644 index 00000000..6e239425 --- /dev/null +++ b/charts/stable/gollum/README.md @@ -0,0 +1,50 @@ +# gollum + +![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) + +gollum helm package + +**Homepage:** + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| Chris Sanders | sanders.chris@gmail.com | | + +## Source Code + +* +* + +## Requirements + +Kubernetes: `>=1.16.0-0` + +| Repository | Name | Version | +|------------|------|---------| +| https://library-charts.k8s-at-home.com | common | 2.5.0 | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| controllerType | string | `"statefulset"` | | +| gollum.additionalArgs | string | `"--h1-title"` | Additional arguments for starting gollum | +| gollum.config | string | `"# Push and pull on commit\nGollum::Hook.register(:post_commit, :hook_id) do |committer, sha1|\n committer.wiki.repo.git.pull('origin', committer.wiki.ref)\n committer.wiki.repo.git.push('origin', committer.wiki.ref)\nend\n"` | Gollum config.rb customizations reference https://github.com/gollum/gollum#config-file | +| gollum.gitBranch | string | `"master"` | Branch to pull | +| gollum.gitUrl | string | `"https://github.com/k8s-at-home/charts.git"` | Repository URL to pull (accepts access tokens) Ex: https://user:access-token@git.example.com/user/repo.git | +| gollum.syncCommand | string | `"git pull && git push"` | Command run during the sync cron | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"gollumorg/gollum"` | gollum upstream image | +| image.tag | string | `"latest"` | | +| ingress.enabled | bool | `false` | | +| persistence.wiki.accessMode | string | `"ReadWriteOnce"` | | +| persistence.wiki.enabled | bool | `false` | | +| persistence.wiki.mountPath | string | `"/wiki"` | | +| persistence.wiki.size | string | `"2Gi"` | | +| service.port.name | string | `"http"` | | +| service.port.port | int | `80` | | +| service.port.targetPort | int | `4567` | | +| service.type | string | `"ClusterIP"` | | +| strategy.type | string | `"RollingUpdate"` | | diff --git a/charts/stable/gollum/README.md.gotmpl b/charts/stable/gollum/README.md.gotmpl new file mode 100644 index 00000000..bc478a85 --- /dev/null +++ b/charts/stable/gollum/README.md.gotmpl @@ -0,0 +1,145 @@ +{{- 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/introduction/) +- 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" . }} diff --git a/charts/stable/gollum/README_CHANGELOG.md.gotmpl b/charts/stable/gollum/README_CHANGELOG.md.gotmpl new file mode 100644 index 00000000..99c5085f --- /dev/null +++ b/charts/stable/gollum/README_CHANGELOG.md.gotmpl @@ -0,0 +1,27 @@ +{{- 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 + +- Initial version + +#### Changed + +- N/A + +#### Removed + +- N/A + +[1.0.0]: #1.0.0 +{{- end -}} diff --git a/charts/stable/gollum/README_CONFIG.md.gotmpl b/charts/stable/gollum/README_CONFIG.md.gotmpl new file mode 100644 index 00000000..e93d80bf --- /dev/null +++ b/charts/stable/gollum/README_CONFIG.md.gotmpl @@ -0,0 +1,9 @@ +{{- define "custom.custom.configuration.header" -}} +## Custom configuration +{{- end -}} + +{{- define "custom.custom.configuration" -}} +{{ template "custom.custom.configuration.header" . }} + +N/A +{{- end -}} diff --git a/charts/stable/gollum/templates/NOTES.txt b/charts/stable/gollum/templates/NOTES.txt new file mode 100644 index 00000000..90f7b653 --- /dev/null +++ b/charts/stable/gollum/templates/NOTES.txt @@ -0,0 +1 @@ +{{- include "common.notes.defaultNotes" . -}} diff --git a/charts/stable/gollum/templates/_additionalVolumeMounts.tpl b/charts/stable/gollum/templates/_additionalVolumeMounts.tpl new file mode 100644 index 00000000..c71e044c --- /dev/null +++ b/charts/stable/gollum/templates/_additionalVolumeMounts.tpl @@ -0,0 +1,10 @@ +{{/* Gollum Additional Volume Mounts */}} +{{- define "gollum.volumeMounts.config" -}} +mountPath: /config +name: gollum-config +{{- end -}} + +{{- define "gollum.volumeMounts.wiki" -}} +mountPath: /wiki +name: wiki +{{- end -}} diff --git a/charts/stable/gollum/templates/_additionalVolumes.tpl b/charts/stable/gollum/templates/_additionalVolumes.tpl new file mode 100644 index 00000000..71e0dcbf --- /dev/null +++ b/charts/stable/gollum/templates/_additionalVolumes.tpl @@ -0,0 +1,25 @@ +{{/* Gollum Additional Volumes */}} +{{- define "gollum.volume.sync" -}} +name: git-sync +configMap: + name: {{ include "common.names.fullname" . }} + defaultMode: 0755 + items: + - key: git-sync + path: git-sync +{{- end -}} + +{{- define "gollum.volume.config" -}} +name: gollum-config +configMap: + name: {{ include "common.names.fullname" . }} + defaultMode: 0755 + items: + - key: config.rb + path: config.rb +{{- end -}} + +{{- define "gollum.volume.wiki" -}} +name: wiki +emptyDir: {} +{{- end -}} diff --git a/charts/stable/gollum/templates/_containers.tpl b/charts/stable/gollum/templates/_containers.tpl new file mode 100644 index 00000000..52df1ef4 --- /dev/null +++ b/charts/stable/gollum/templates/_containers.tpl @@ -0,0 +1,11 @@ +{{/* Gollum Additional Containers */}} +{{- define "gollum.container.cron" -}} +name: cron +image: alpine/git +command: ["crond", "-f", "-l", "8"] +volumeMounts: + - mountPath: /etc/periodic/15min/ + name: git-sync + - mountPath: /wiki + name: wiki +{{- end -}} diff --git a/charts/stable/gollum/templates/_initContainers.yaml b/charts/stable/gollum/templates/_initContainers.yaml new file mode 100644 index 00000000..798b8b39 --- /dev/null +++ b/charts/stable/gollum/templates/_initContainers.yaml @@ -0,0 +1,25 @@ +{{/* Gollum Init Containers */}} +{{- define "gollum.init.clone" -}} +name: git-init +image: alpine/git +args: + - clone + - -b + - {{ (required "gollum.gitBranch is required and not set" .Values.gollum.gitBranch) }} + - {{ (required "gollum.gitUrl is required and not set" .Values.gollum.gitUrl) }} + - /wiki +volumeMounts: + - mountPath: /wiki + name: wiki +{{- end -}} +{{- define "gollum.init.clear" -}} +name: clear-wiki +image: alpine +command: + - sh + - -c + - rm -fr /wiki/*; rm -fr /wiki/.*; ls -la /wiki/; +volumeMounts: + - mountPath: /wiki + name: wiki +{{- end -}} diff --git a/charts/stable/gollum/templates/common.yaml b/charts/stable/gollum/templates/common.yaml new file mode 100644 index 00000000..6d140124 --- /dev/null +++ b/charts/stable/gollum/templates/common.yaml @@ -0,0 +1,42 @@ +{{- include "common.values.setup" . }} + +{{/* Add initContainers */}} +{{- $initClear := include "gollum.init.clear" . | fromYaml -}} +{{- $initClone := include "gollum.init.clone" . | fromYaml -}} +{{- $initContainers := append .Values.initContainers $initClear -}} +{{- $initContainers = append $initContainers $initClone -}} +{{- $_ := set .Values "initContainers" $initContainers -}} + +{{/* Add conatiners */}} +{{- $contCron := include "gollum.container.cron" . | fromYaml -}} +{{- $containers := append .Values.additionalContainers $contCron -}} +{{- $_ := set .Values "additionalContainers" $containers -}} + +{{/* Add Volumes */}} +{{- $volSync := include "gollum.volume.sync" . | fromYaml -}} +{{- $volConfig := include "gollum.volume.config" . | fromYaml -}} +{{- $volWiki := include "gollum.volume.wiki" . | fromYaml -}} +{{- $volumes := append .Values.additionalVolumes $volSync -}} +{{- $volumes = append $volumes $volConfig -}} +{{- if (not .Values.persistence.wiki.enabled) -}} +{{- $volumes = append $volumes $volWiki -}} +{{- end -}} +{{- $_ := set .Values "additionalVolumes" $volumes -}} + +{{/* Add VolumeMounts */}} +{{- $mntConfig := include "gollum.volumeMounts.config" . | fromYaml -}} +{{- $mntWiki := include "gollum.volumeMounts.wiki" . | fromYaml -}} +{{- $mounts := append .Values.additionalVolumeMounts $mntConfig -}} +{{- if (not .Values.persistence.wiki.enabled) -}} +{{- $mounts = append $mounts $mntWiki -}} +{{- end -}} +{{- $_ := set .Values "additionalVolumeMounts" $mounts -}} + +{{/* Setup the start command */}} +{{- $command := list "gollum" "/wiki" "--config" "/config/config.rb" "--ref" (required "A branch is requred but unset" .Values.gollum.gitBranch) -}} +{{- if .Values.gollum.additionalArgs -}} +{{- $command = append $command .Values.gollum.additionalArgs -}} +{{- end -}} +{{- $_ := set .Values "command" $command -}} + +{{ include "common.all" . }} diff --git a/charts/stable/gollum/templates/configmap.yaml b/charts/stable/gollum/templates/configmap.yaml new file mode 100644 index 00000000..65bd8768 --- /dev/null +++ b/charts/stable/gollum/templates/configmap.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.names.fullname" . }} +data: + git-sync: | + #!/bin/bash + cd /wiki && {{ .Values.gollum.syncCommand }} + config.rb: | + {{- nindent 4 .Values.gollum.config }} diff --git a/charts/stable/gollum/values.yaml b/charts/stable/gollum/values.yaml new file mode 100644 index 00000000..32119bac --- /dev/null +++ b/charts/stable/gollum/values.yaml @@ -0,0 +1,52 @@ +# +# 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: + # -- gollum upstream image + repository: gollumorg/gollum + tag: latest + pullPolicy: IfNotPresent + +controllerType: statefulset +strategy: + type: RollingUpdate + +service: + type: ClusterIP + port: + port: 80 + name: http + targetPort: 4567 + +ingress: + enabled: false + +persistence: + wiki: + enabled: false + mountPath: /wiki + accessMode: ReadWriteOnce + size: 2Gi + +gollum: + # -- Branch to pull + gitBranch: master + # -- Repository URL to pull (accepts access tokens) + # Ex: https://user:access-token@git.example.com/user/repo.git + gitUrl: https://github.com/k8s-at-home/charts.git + # -- Additional arguments for starting gollum + additionalArgs: --h1-title + # -- Command run during the sync cron + syncCommand: git pull && git push + # -- Gollum config.rb customizations + # reference https://github.com/gollum/gollum#config-file + config: | + # Push and pull on commit + Gollum::Hook.register(:post_commit, :hook_id) do |committer, sha1| + committer.wiki.repo.git.pull('origin', committer.wiki.ref) + committer.wiki.repo.git.push('origin', committer.wiki.ref) + end