From ef903e418fd08a451fb873cf15829a6e91400eb3 Mon Sep 17 00:00:00 2001 From: James Wynn Date: Mon, 12 Aug 2024 10:39:28 -0500 Subject: [PATCH] Addressing several lingering issues (#29) * service account name should be blank by default * resource naming is now consistent * Update all references to the old homepage repo and artifact * Added support for extra rules in ClusterRole * Added example envFrom to values.yaml * More environment variable examples --- charts/homepage/Chart.yaml | 12 +++--- charts/homepage/readme.md | 6 +-- .../{configmap.yaml => _configmap.yaml} | 9 +++- .../templates/{rbac.yaml => _rbac.yaml} | 17 +++----- charts/homepage/templates/common.yaml | 4 +- charts/homepage/values.yaml | 43 +++++++++++++++++-- 6 files changed, 65 insertions(+), 26 deletions(-) rename charts/homepage/templates/{configmap.yaml => _configmap.yaml} (75%) rename charts/homepage/templates/{rbac.yaml => _rbac.yaml} (82%) diff --git a/charts/homepage/Chart.yaml b/charts/homepage/Chart.yaml index 27ae1fb..6d2fa29 100644 --- a/charts/homepage/Chart.yaml +++ b/charts/homepage/Chart.yaml @@ -1,13 +1,13 @@ --- apiVersion: v2 -description: Chart for benphelps homepage -icon: https://github.com/benphelps/homepage/blob/de584eae8f12a0d257e554e9511ef19bd2a1232c/public/mstile-150x150.png +description: Chart for Homepage +icon: https://github.com/gethomepage/homepage/blob/main/public/mstile-150x150.png name: homepage -version: 1.2.3 -appVersion: v0.6.10 +version: 2.0.0 +appVersion: v0.9.6 sources: - https://github.com/jameswynn/helm-charts/charts/homepage - - https://github.com/benphelps/homepage/ + - https://github.com/gethomepage/homepage/ maintainers: - name: jameswynn dependencies: @@ -17,4 +17,4 @@ dependencies: annotations: artifacthub.io/changes: |- - kind: added - description: Bumped dependency versions and app versions + description: Bumped app versions, fixed default service account, resource names are more consistent diff --git a/charts/homepage/readme.md b/charts/homepage/readme.md index 8cdbeee..b9d69b0 100644 --- a/charts/homepage/readme.md +++ b/charts/homepage/readme.md @@ -1,8 +1,8 @@ -# Homepage (benphelps) +# Homepage A modern (fully static, fast), secure (fully proxied), highly customizable application dashboard with integrations for more than 25 services and translations for over 15 languages. Easily configured via YAML files (or discovery via docker labels). -[Homepage](https://github.com/benphelps/homepage) +[Homepage](https://github.com/gethomepage/homepage) ## TL;DR @@ -13,7 +13,7 @@ helm install my-release jameswynn/homepage ## Introduction -This chart bootstraps a [Homepage](https://github.com/benphelps/homepage) deployment on a [Kubernetes](https://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. +This chart bootstraps a [Homepage](https://github.com/gethomepage/homepage) deployment on a [Kubernetes](https://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. ## Prerequisites diff --git a/charts/homepage/templates/configmap.yaml b/charts/homepage/templates/_configmap.yaml similarity index 75% rename from charts/homepage/templates/configmap.yaml rename to charts/homepage/templates/_configmap.yaml index 83d0051..ba9ec39 100644 --- a/charts/homepage/templates/configmap.yaml +++ b/charts/homepage/templates/_configmap.yaml @@ -1,9 +1,15 @@ +{{- define "homepage.configmap" -}} {{ if not .Values.config.useExistingConfigMap }} --- +{{ $values := .Values -}} +{{- $configName := include "bjw-s.common.lib.chart.names.fullname" . -}} +{{- if and (hasKey $values "nameOverride") $values.nameOverride -}} + {{- $configName = printf "%v-%v" $configName $values.nameOverride -}} +{{ end -}} apiVersion: v1 kind: ConfigMap metadata: - name: {{ template "bjw-s.common.lib.chart.names.fullname" . }} + name: {{ $configName }} labels: {{- include "bjw-s.common.lib.metadata.allLabels" . | nindent 4 }} data: @@ -32,3 +38,4 @@ data: {{- else }} "" {{- end }} {{ end }} +{{- end }} diff --git a/charts/homepage/templates/rbac.yaml b/charts/homepage/templates/_rbac.yaml similarity index 82% rename from charts/homepage/templates/rbac.yaml rename to charts/homepage/templates/_rbac.yaml index 23c0d33..7286fdb 100644 --- a/charts/homepage/templates/rbac.yaml +++ b/charts/homepage/templates/_rbac.yaml @@ -1,18 +1,7 @@ -{{- include "bjw-s.common.loader.init" . }} +{{- define "homepage.rbac" -}} {{ if .Values.enableRbac }} {{- $serviceAccountName := include "bjw-s.common.lib.chart.names.serviceAccountName" . -}} --- -apiVersion: v1 -kind: Secret -type: kubernetes.io/service-account-token -metadata: - name: {{ $serviceAccountName }} - {{- with (merge (.Values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }} - labels: {{- toYaml . | nindent 4 }} - {{- end }} - annotations: - kubernetes.io/service-account.name: {{ $serviceAccountName }} ---- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: @@ -63,6 +52,9 @@ rules: - customresourcedefinitions/status verbs: - get +{{- if .Values.extraClusterRoles -}} + {{- .Values.extraClusterRoles | toYaml | nindent 2 }} +{{- end }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding @@ -83,3 +75,4 @@ subjects: name: {{ $serviceAccountName }} namespace: {{ .Release.Namespace }} {{ end }} +{{- end }} diff --git a/charts/homepage/templates/common.yaml b/charts/homepage/templates/common.yaml index c60c663..929d167 100644 --- a/charts/homepage/templates/common.yaml +++ b/charts/homepage/templates/common.yaml @@ -1,4 +1,3 @@ ---- {{- include "bjw-s.common.loader.init" . }} {{- define "app-template.hardcodedValues" -}} @@ -39,5 +38,8 @@ subPath: {{- $_ := set .Values.serviceAccount "create" "true" -}} {{ end }} +{{ include "homepage.configmap" . }} +{{ include "homepage.rbac" . }} + {{/* Render the templates */}} {{ include "bjw-s.common.loader.generate" . }} diff --git a/charts/homepage/values.yaml b/charts/homepage/values.yaml index a0c2063..0b15e81 100644 --- a/charts/homepage/values.yaml +++ b/charts/homepage/values.yaml @@ -1,13 +1,22 @@ image: - repository: ghcr.io/benphelps/homepage + repository: ghcr.io/gethomepage/homepage # tag: v0.6.0 # Enable RBAC. RBAC is necessary to use Kubernetes integration enableRbac: false +extraClusterRoles: + # - apiGroups: + # - some-group + # resources: + # - some-resource + # verbs: + # - get + serviceAccount: - # Specify a different service account name - name: homepage + # Specify a different service account name. When blank it will default to the release + # name if *create* is enabled, otherwise it will refer to the default service account. + name: "" # Create service account. Needed when RBAC is enabled. create: false @@ -99,6 +108,34 @@ config: docker: settings: +# -- Main environment variables. Template enabled. +# Syntax options: +# A) TZ: UTC +# B) PASSWD: '{{ .Release.Name }}' +# C) PASSWD: +# configMapKeyRef: +# name: config-map-name +# key: key-name +# D) PASSWD: +# valueFrom: +# secretKeyRef: +# name: secret-name +# key: key-name +# ... +# E) - name: TZ +# value: UTC +# F) - name: TZ +# value: '{{ .Release.Name }}' +env: + +# To include environment variables from other configs or other secrets for use in +# Homepage's variable substitutions. Refer to them here. +# envFrom: +# - secretRef: +# name: my-secret +# - configMapRef: +# name: my-configmap + persistence: logs: enabled: true