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 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..c393dec --- /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/_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 }} 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..fc72d34 --- /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..ca68462 --- /dev/null +++ b/charts/hajimari/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "hajimari.fullname" . }} + labels: + {{- include "hajimari.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + 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..1b91aed --- /dev/null +++ b/charts/hajimari/values.yaml @@ -0,0 +1,76 @@ +# +# 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 + 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