diff --git a/charts/homer/Chart.yaml b/charts/homer/Chart.yaml index 1f3e75ae..2ecac8b8 100644 --- a/charts/homer/Chart.yaml +++ b/charts/homer/Chart.yaml @@ -4,7 +4,7 @@ description: A dead simple static HOMepage for your servER to keep your services icon: https://raw.githubusercontent.com/bastienwirtz/homer/main/public/logo.png home: https://github.com/bastienwirtz/homer name: homer -version: 3.1.0 +version: 3.2.0 kubeVersion: ">=1.16.0-0" sources: - https://github.com/bastienwirtz/homer diff --git a/charts/homer/README.md b/charts/homer/README.md index af4892cd..d7422576 100644 --- a/charts/homer/README.md +++ b/charts/homer/README.md @@ -1,6 +1,6 @@ # homer -![Version: 3.0.1](https://img.shields.io/badge/Version-3.0.1-informational?style=flat-square) ![AppVersion: 20.09.1](https://img.shields.io/badge/AppVersion-20.09.1-informational?style=flat-square) +![Version: 3.2.0](https://img.shields.io/badge/Version-3.2.0-informational?style=flat-square) ![AppVersion: 20.09.1](https://img.shields.io/badge/AppVersion-20.09.1-informational?style=flat-square) A dead simple static HOMepage for your servER to keep your services on hand, from a simple yaml configuration file. @@ -18,7 +18,7 @@ Kubernetes: `>=1.16.0-0` | Repository | Name | Version | |------------|------|---------| -| https://k8s-at-home.com/charts/ | common | 3.0.1 | +| https://k8s-at-home.com/charts/ | common | 3.1.0 | ## TL;DR @@ -75,6 +75,8 @@ N/A | Key | Type | Default | Description | |-----|------|---------|-------------| +| configmap.config | string | `"externalConfig: https://raw.githubusercontent.com/bastienwirtz/homer/main/public/assets/config.yml.dist\n"` | Homer configuration https://github.com/bastienwirtz/homer/blob/main/docs/configuration.md | +| configmap.enabled | bool | `false` | Store homer configuration as a ConfigMap | | env | object | `{}` | | | image.pullPolicy | string | `"IfNotPresent"` | | | image.repository | string | `"b4bz/homer"` | | @@ -92,19 +94,19 @@ All notable changes to this application Helm chart will be documented in this fi 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] +### [3.2.0] #### Added -- N/A +- Added changelog. +- Updated README to reflect common chart dependency version in use. +- Enable homer configuration through values.yaml. -#### Changed +[3.2.0]: https://github.com/k8s-at-home/charts/tree/homer-3.1.0/charts -- N/A +### [1.0.0] -#### Removed - -- N/A +No changelog prior to 3.2.0 [1.0.0]: #1.0.0 diff --git a/charts/homer/README_CHANGELOG.md.gotmpl b/charts/homer/README_CHANGELOG.md.gotmpl index e6167dad..5c808d96 100644 --- a/charts/homer/README_CHANGELOG.md.gotmpl +++ b/charts/homer/README_CHANGELOG.md.gotmpl @@ -9,19 +9,19 @@ All notable changes to this application Helm chart will be documented in this fi 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] +### [3.2.0] #### Added -- N/A +- Added changelog. +- Updated README to reflect common chart dependency version in use. +- Enable homer configuration through values.yaml. -#### Changed +[3.2.0]: https://github.com/k8s-at-home/charts/tree/homer-3.1.0/charts -- N/A +### [1.0.0] -#### Removed - -- N/A +No changelog prior to 3.2.0 [1.0.0]: #1.0.0 {{- end -}} diff --git a/charts/homer/templates/_helpers.tpl b/charts/homer/templates/_helpers.tpl new file mode 100644 index 00000000..26402ed8 --- /dev/null +++ b/charts/homer/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "homer.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "homer.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "homer.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/charts/homer/templates/common.yaml b/charts/homer/templates/common.yaml index a6613c2c..fbdf833c 100644 --- a/charts/homer/templates/common.yaml +++ b/charts/homer/templates/common.yaml @@ -1 +1,42 @@ +{{/* Make sure all variables are set properly */}} +{{- include "common.values.setup" . }} + +{{/* merge homer specific annotations with podAnnotations*/}} +{{- define "homer.podAnnotations" -}} +configmap/checksum: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} +{{- end -}} + +{{- if .Values.configmap.enabled -}} +{{- $homerPodAnnotations := include "homer.podAnnotations" . | fromYaml -}} +{{- $podAnnotations := merge .Values.podAnnotations $homerPodAnnotations -}} +{{- $_ := set .Values "podAnnotations" (deepCopy $podAnnotations) -}} +{{- end -}} + +{{/* Append the configMap to the additionalVolumes */}} +{{- define "homer.configmap.volume" -}} +name: config +configMap: + name: {{ template "common.names.fullname" . }}-config +{{- end -}} + +{{- if .Values.configmap.enabled -}} +{{- $volume := include "homer.configmap.volume" . | fromYaml -}} +{{- $additionalVolumes := append .Values.additionalVolumes $volume }} +{{- $_ := set .Values "additionalVolumes" (deepCopy $additionalVolumes) -}} +{{- end -}} + +{{/* Append the configMap volume to the additionalVolumeMounts */}} +{{- define "homer.configmap.volumeMount" -}} +name: config +mountPath: /www/assets/config.yml +subPath: config.yml +{{- end -}} + +{{- if .Values.configmap.enabled -}} +{{- $volumeMount := include "homer.configmap.volumeMount" . | fromYaml -}} +{{- $additionalVolumeMounts := append .Values.additionalVolumeMounts $volumeMount }} +{{- $_ := set .Values "additionalVolumeMounts" (deepCopy $additionalVolumeMounts) -}} +{{- end -}} + +{{/* Render the templates */}} {{ include "common.all" . }} diff --git a/charts/homer/templates/configmap.yaml b/charts/homer/templates/configmap.yaml new file mode 100644 index 00000000..0f804e1b --- /dev/null +++ b/charts/homer/templates/configmap.yaml @@ -0,0 +1,15 @@ +{{- if .Values.configmap.enabled -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "homer.fullname" . }}-config + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: {{ include "homer.name" . }} + helm.sh/chart: {{ include "homer.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +data: + config.yml: | +{{ .Values.configmap.config | indent 4 }} +{{- end -}} diff --git a/charts/homer/values.yaml b/charts/homer/values.yaml index 6ec7cba5..9ceb3005 100644 --- a/charts/homer/values.yaml +++ b/charts/homer/values.yaml @@ -29,3 +29,12 @@ persistence: enabled: false emptyDir: false mountPath: /www/assets + + +configmap: + # -- Store homer configuration as a ConfigMap + enabled: false + # -- Homer configuration + # https://github.com/bastienwirtz/homer/blob/main/docs/configuration.md + config: | + externalConfig: https://raw.githubusercontent.com/bastienwirtz/homer/main/public/assets/config.yml.dist