From 9f0f1d94b9f7e803999343eb8d950990a409dcd3 Mon Sep 17 00:00:00 2001 From: Alex Sukhov Date: Wed, 4 May 2022 18:25:10 +0300 Subject: [PATCH 1/5] Port oficial hajimari chart --- charts/hajimari/.helmignore | 26 +++++ charts/hajimari/Chart.yaml | 19 +++ charts/hajimari/README.md | 141 +++++++++++++++++++++++ charts/hajimari/templates/configmap.yaml | 12 ++ charts/hajimari/templates/ingress.yaml | 39 +++++++ charts/hajimari/templates/rbac.yaml | 33 ++++++ charts/hajimari/templates/service.yaml | 28 +++++ charts/hajimari/values.yaml | 78 +++++++++++++ 8 files changed, 376 insertions(+) create mode 100644 charts/hajimari/.helmignore create mode 100644 charts/hajimari/Chart.yaml create mode 100644 charts/hajimari/README.md create mode 100644 charts/hajimari/templates/configmap.yaml create mode 100644 charts/hajimari/templates/ingress.yaml create mode 100644 charts/hajimari/templates/rbac.yaml create mode 100644 charts/hajimari/templates/service.yaml create mode 100644 charts/hajimari/values.yaml diff --git a/charts/hajimari/.helmignore b/charts/hajimari/.helmignore new file mode 100644 index 0000000..2a482c1 --- /dev/null +++ b/charts/hajimari/.helmignore @@ -0,0 +1,26 @@ +# 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 +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ +# OWNERS file for Kubernetes +OWNERS +# helm-docs templates +*.gotmpl \ No newline at end of file diff --git a/charts/hajimari/Chart.yaml b/charts/hajimari/Chart.yaml new file mode 100644 index 0000000..545ca60 --- /dev/null +++ b/charts/hajimari/Chart.yaml @@ -0,0 +1,19 @@ +apiVersion: v2 +appVersion: v0.2.0 +description: | + Hajimari is a beautiful & customizable browser startpage/dashboard with + Kubernetes application discovery +name: hajimari +version: 0.1.0 +kubeVersion: ">=1.16.0-0" +keywords: +- hajimari +- startpage +- dashboard +home: https://github.com/librepod/charts/tree/master/charts/hajimari +icon: https://raw.githubusercontent.com/toboshii/hajimari/main/docs/static/img/logo.png +sources: +- https://github.com/toboshii/hajimari +maintainers: +- name: toboshii + email: toboshii@users.noreply.github.com diff --git a/charts/hajimari/README.md b/charts/hajimari/README.md new file mode 100644 index 0000000..b23ece6 --- /dev/null +++ b/charts/hajimari/README.md @@ -0,0 +1,141 @@ +# hajimari + +![Version: 1.2.0](https://img.shields.io/badge/Version-1.2.0-informational?style=flat-square) ![AppVersion: v0.2.0](https://img.shields.io/badge/AppVersion-v0.2.0-informational?style=flat-square) + +Hajimari is a beautiful & customizable browser startpage/dashboard with +Kubernetes application discovery + +**Homepage:** + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| toboshii | toboshii@users.noreply.github.com | | + +## Example values to get started: + +```yaml +hajimari: + namespaceSelector: + matchNames: + - downloads + - media + customApps: + - name: Test + url: https://example.com + icon: test-tube + groups: + - name: Communicate + links: + - name: Discord + url: 'https://discord.com' + - name: Gmail + url: 'http://gmail.com' + - name: Slack + url: 'https://slack.com/signin' + - name: Cloud + links: + - name: Box + url: 'https://box.com' + - name: Dropbox + url: 'https://dropbox.com' + - name: Drive + url: 'https://drive.google.com' + - name: Design + links: + - name: Awwwards + url: 'https://awwwards.com' + - name: Dribbble + url: 'https://dribbble.com' + - name: Muz.li + url: 'https://medium.muz.li/' + - name: Dev + links: + - name: Codepen + url: 'https://codepen.io/' + - name: Devdocs + url: 'https://devdocs.io' + - name: Devhints + url: 'https://devhints.io' + - name: Lifestyle + links: + - name: Design Milk + url: 'https://design-milk.com/category/interior-design/' + - name: Dwell + url: 'https://www.dwell.com/' + - name: Freshome + url: 'https://www.mymove.com/freshome/' + - name: Media + links: + - name: Spotify + url: 'http://browse.spotify.com' + - name: Trakt + url: 'http://trakt.tv' + - name: YouTube + url: 'https://youtube.com/feed/subscriptions' + - name: Reading + links: + - name: Instapaper + url: 'https://www.instapaper.com/u' + - name: Medium + url: 'http://medium.com' + - name: Reddit + url: 'http://reddit.com' + - name: Tech + links: + - name: TheNextWeb + url: 'https://thenextweb.com/' + - name: The Verge + url: 'https://theverge.com/' + - name: MIT Technology Review + url: 'https://www.technologyreview.com/' +ingress: + main: + enabled: true + hosts: + - host: hajimari.domain.tld + paths: + - path: / + pathType: Prefix +persistence: + data: + enabled: true + accessMode: ReadWriteOnce + size: 1Gi +``` + +## Source Code + +* + +## Requirements + +Kubernetes: `>=1.16.0-0` + +| Repository | Name | Version | +|------------|------|---------| +| https://library-charts.k8s-at-home.com | common | 4.0.0 | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| env | object | See below | environment variables. | +| env.TZ | string | `"UTC"` | Set the container timezone | +| hajimari | object | See below | Configures Hajimari settings for this instance. | +| hajimari.customApps | list | `[]` | Add custom applications to the discovered application list | +| hajimari.defaultEnable | bool | `false` | Set to true to show all discovered applications by default. | +| hajimari.groups | list | `[]` | Set default bookmarks | +| hajimari.instanceName | string | `nil` | The name of this instance, this allows running multiple instances of Hajimari on the same cluster | +| hajimari.name | string | `"You"` | Default name for welcome message | +| hajimari.namespaceSelector | object | `{"matchNames":["media"]}` | Namespace selector to use for discovering applications | +| hajimari.title | string | `nil` | Override the title of the Hajimari pages | +| image.pullPolicy | string | `"IfNotPresent"` | image pull policy | +| image.repository | string | `"ghcr.io/toboshii/hajimari"` | image repository | +| image.tag | string | `"v0.1.0"` | image tag | +| ingress.main | object | See values.yaml | Enable and configure ingress settings for the chart under this key. | +| persistence | object | See values.yaml | Configure persistence settings for the chart under this key. | +| service | object | See values.yaml | Configures service settings for the chart. | +| serviceAccount | object | See below | Configures service account needed for reading k8s ingress objects | +| serviceAccount.create | bool | `true` | Create service account | diff --git a/charts/hajimari/templates/configmap.yaml b/charts/hajimari/templates/configmap.yaml new file mode 100644 index 0000000..7361097 --- /dev/null +++ b/charts/hajimari/templates/configmap.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "hajimari.fullname" . }}-settings + labels: + app: {{ template "hajimari.name" . }} + chart: {{ template "hajimari.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +data: + config.yaml: |- +{{ toYaml .Values.hajimari | indent 4 }} diff --git a/charts/hajimari/templates/ingress.yaml b/charts/hajimari/templates/ingress.yaml new file mode 100644 index 0000000..83899bb --- /dev/null +++ b/charts/hajimari/templates/ingress.yaml @@ -0,0 +1,39 @@ +{{- if .Values.ingress.enabled -}} +{{- $serviceName := printf "%s-%s" (include "hajimari.fullname" .) "web" -}} +{{- $ingressPath := .Values.ingress.path -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ template "hajimari.fullname" . }} + labels: + app: {{ template "hajimari.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: +{{- if .Values.ingress.ingressClassName }} + ingressClassName: {{ .Values.ingress.ingressClassName }} +{{- end }} +{{- if .Values.ingress.tls }} + tls: +{{ toYaml .Values.ingress.tls | indent 4 }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . | quote }} + http: + paths: + - path: {{ $ingressPath }} + pathType: ImplementationSpecific + backend: + service: + name: {{ $serviceName }} + port: + name: http + {{- end }} +{{- end }} + diff --git a/charts/hajimari/templates/rbac.yaml b/charts/hajimari/templates/rbac.yaml new file mode 100644 index 0000000..0cb50e9 --- /dev/null +++ b/charts/hajimari/templates/rbac.yaml @@ -0,0 +1,33 @@ +{{- if .Values.serviceAccount.create }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ template "hajimari.fullname" . }} + labels: + app: {{ template "hajimari.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +rules: +- apiGroups: ["", "extensions", "networking.k8s.io"] + resources: ["ingresses", "namespaces"] + verbs: ["get", "list"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ template "hajimari.fullname" . }} + labels: + app: {{ template "hajimari.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ include "common.names.fullname" . }} +subjects: +- kind: ServiceAccount + name: {{ include "common.names.fullname" . }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/charts/hajimari/templates/service.yaml b/charts/hajimari/templates/service.yaml new file mode 100644 index 0000000..13a7077 --- /dev/null +++ b/charts/hajimari/templates/service.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "hajimari.fullname" . }}-service + labels: + {{- include "hajimari.labels" . | nindent 4 }} + annotations: + {{- range $key, $value := .Values.service.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + type: {{ .Values.service.type }} +{{- if .Values.service.clusterIP }} + clusterIP: {{ .Values.service.clusterIP }} +{{- end }} +{{- if .Values.service.loadBalancerIP }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} +{{- end }} +{{- if .Values.service.externalTrafficPolicy }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }} +{{- end }} + ports: + - port: {{ .Values.service.port }} + targetPort: 3000 + protocol: TCP + name: http + selector: + {{- include "hajimari.selectorLabels" . | nindent 4 }} diff --git a/charts/hajimari/values.yaml b/charts/hajimari/values.yaml new file mode 100644 index 0000000..23546b0 --- /dev/null +++ b/charts/hajimari/values.yaml @@ -0,0 +1,78 @@ +# +# IMPORTANT NOTE +# +# This chart inherits from the k8s@home 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/toboshii/hajimari + # -- image pull policy + pullPolicy: IfNotPresent + # -- image tag + tag: v0.2.0 + +# -- environment variables. +# @default -- See below +env: + # -- Set the container timezone + TZ: UTC + +# -- Configures Hajimari settings for this instance. +# @default -- See below +hajimari: + # -- The name of this instance, this allows running multiple + # instances of Hajimari on the same cluster + instanceName: null + # -- Set to true to show all discovered applications by default. + defaultEnable: false + # -- Namespace selector to use for discovering applications + namespaceSelector: + matchNames: + - media + # -- Override the title of the Hajimari pages + title: null + # -- Default name for welcome message + name: "You" + # -- Add custom applications to the discovered application list + customApps: [] + # - name: Test + # url: https://example.com + # icon: test-tube + + # -- Set default bookmarks + groups: [] + # - name: Communicate + # links: + # - name: Discord + # url: 'https://discord.com' + # - name: Gmail + # url: 'http://gmail.com' + # - name: Slack + # url: 'https://slack.com/signin' + + +# -- Configures service settings for the chart. +# @default -- See values.yaml +service: + type: ClusterIP + ports: + http: + port: 3000 + +# -- Configures service account needed for reading k8s ingress objects +# @default -- See below +serviceAccount: + # -- Create service account + create: false + +ingress: + # -- Enable and configure ingress settings for the chart under this key. + # @default -- See values.yaml + enabled: false + +# -- Configure persistence settings for the chart under this key. +# @default -- See values.yaml +persistence: + enabled: false From 32800c91e52160221d3702a9b1f472fa3f023570 Mon Sep 17 00:00:00 2001 From: Alex Sukhov Date: Wed, 4 May 2022 18:33:38 +0300 Subject: [PATCH 2/5] Remove ct config params --- .github/workflows/lint-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml index bf0a255..33a8692 100644 --- a/.github/workflows/lint-test.yml +++ b/.github/workflows/lint-test.yml @@ -16,7 +16,7 @@ jobs: uses: helm/chart-testing-action@v2.1.0 - name: Run chart-testing (lint) - run: ct lint --config .github/ct-lint.yaml + run: ct lint test: runs-on: ubuntu-latest @@ -34,4 +34,4 @@ jobs: uses: helm/kind-action@v1.2.0 - name: Run chart-testing (install) - run: ct install --config .github/ct-install.yaml + run: ct install From 6481a4879fddfbff4d6398ae82abb9d636ab504c Mon Sep 17 00:00:00 2001 From: Alex Sukhov Date: Wed, 4 May 2022 18:35:53 +0300 Subject: [PATCH 3/5] Remove trailing spaces --- charts/hajimari/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/hajimari/Chart.yaml b/charts/hajimari/Chart.yaml index 545ca60..c393dec 100644 --- a/charts/hajimari/Chart.yaml +++ b/charts/hajimari/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 appVersion: v0.2.0 description: | - Hajimari is a beautiful & customizable browser startpage/dashboard with + Hajimari is a beautiful & customizable browser startpage/dashboard with Kubernetes application discovery name: hajimari version: 0.1.0 From feac220581be5b1b9e3dd5386c65b3e0e0fc0f5e Mon Sep 17 00:00:00 2001 From: Alex Sukhov Date: Wed, 4 May 2022 18:37:55 +0300 Subject: [PATCH 4/5] Add _helpers.tpl --- charts/hajimari/templates/_helpers.tpl | 62 ++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 charts/hajimari/templates/_helpers.tpl diff --git a/charts/hajimari/templates/_helpers.tpl b/charts/hajimari/templates/_helpers.tpl new file mode 100644 index 0000000..a7345d2 --- /dev/null +++ b/charts/hajimari/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "hajimari.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 "hajimari.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 "hajimari.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "hajimari.labels" -}} +helm.sh/chart: {{ include "hajimari.chart" . }} +{{ include "hajimari.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "hajimari.selectorLabels" -}} +app.kubernetes.io/name: {{ include "hajimari.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "hajimari.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "hajimari.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} From beef062528cbbca62c4f4e30ac5e9c4fa5f76ee7 Mon Sep 17 00:00:00 2001 From: Alex Sukhov Date: Wed, 4 May 2022 23:40:59 +0300 Subject: [PATCH 5/5] Fix service --- charts/hajimari/templates/ingress.yaml | 2 +- charts/hajimari/templates/service.yaml | 17 ++--------------- charts/hajimari/values.yaml | 4 +--- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/charts/hajimari/templates/ingress.yaml b/charts/hajimari/templates/ingress.yaml index 83899bb..fc72d34 100644 --- a/charts/hajimari/templates/ingress.yaml +++ b/charts/hajimari/templates/ingress.yaml @@ -32,7 +32,7 @@ spec: backend: service: name: {{ $serviceName }} - port: + port: name: http {{- end }} {{- end }} diff --git a/charts/hajimari/templates/service.yaml b/charts/hajimari/templates/service.yaml index 13a7077..ca68462 100644 --- a/charts/hajimari/templates/service.yaml +++ b/charts/hajimari/templates/service.yaml @@ -1,27 +1,14 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "hajimari.fullname" . }}-service + name: {{ include "hajimari.fullname" . }} labels: {{- include "hajimari.labels" . | nindent 4 }} - annotations: - {{- range $key, $value := .Values.service.annotations }} - {{ $key }}: {{ $value | quote }} - {{- end }} spec: type: {{ .Values.service.type }} -{{- if .Values.service.clusterIP }} - clusterIP: {{ .Values.service.clusterIP }} -{{- end }} -{{- if .Values.service.loadBalancerIP }} - loadBalancerIP: {{ .Values.service.loadBalancerIP }} -{{- end }} -{{- if .Values.service.externalTrafficPolicy }} - externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }} -{{- end }} ports: - port: {{ .Values.service.port }} - targetPort: 3000 + targetPort: http protocol: TCP name: http selector: diff --git a/charts/hajimari/values.yaml b/charts/hajimari/values.yaml index 23546b0..1b91aed 100644 --- a/charts/hajimari/values.yaml +++ b/charts/hajimari/values.yaml @@ -57,9 +57,7 @@ hajimari: # @default -- See values.yaml service: type: ClusterIP - ports: - http: - port: 3000 + port: 3000 # -- Configures service account needed for reading k8s ingress objects # @default -- See below