[dashmachine] convert dashmachine to common library and bump to 2.0.0 (#213)

Signed-off-by: Ryan Holt <ryan@ryanholt.net>
This commit is contained in:
Ryan Holt 2020-11-24 13:48:07 -05:00 committed by GitHub
parent 1d5b7ff5bf
commit 4ef7b2b312
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 89 additions and 315 deletions

View File

@ -4,9 +4,13 @@ description: DashMachine is another web application bookmark dashboard, with fun
icon: https://github.com/rmountjoy92/DashMachine/raw/master/dashmachine/static/images/logo/logo.png icon: https://github.com/rmountjoy92/DashMachine/raw/master/dashmachine/static/images/logo/logo.png
home: https://github.com/rmountjoy92/DashMachine home: https://github.com/rmountjoy92/DashMachine
name: dashmachine name: dashmachine
version: 1.0.0 version: 2.0.0
sources: sources:
- https://github.com/rmountjoy92/DashMachine - https://github.com/rmountjoy92/DashMachine
maintainers: maintainers:
- name: carpenike - name: carpenike
email: ryan@ryanholt.net email: ryan@ryanholt.net
dependencies:
- name: common
version: 1.6.1
repository: https://k8s-at-home.com/charts/

View File

@ -0,0 +1,4 @@
approvers:
- carpenike
reviewers:
- carpenike

View File

@ -1,31 +1,69 @@
dashmachine # Dashmachine
===========
DashMachine is another web application bookmark dashboard, with fun features.
## Chart Values This is a helm chart for [DashMachine](https://github.com/rmountjoy92/DashMachine).
| Key | Type | Default | Description | **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)**
|-----|------|---------|-------------|
| affinity | object | `{}` | | ## TL;DR;
| deploymentAnnotations | object | `{}` | |
| fullnameOverride | string | `""` | | ```shell
| image.pullPolicy | string | `"IfNotPresent"` | | $ helm repo add k8s-at-home https://k8s-at-home.com/charts/
| image.repository | string | `"rmountjoy/dashmachine"` | | $ helm install k8s-at-home/dashmachine
| image.tag | string | `"latest"` | | ```
| ingress.annotations | object | `{}` | |
| ingress.enabled | bool | `false` | | ## Installing the Chart
| ingress.hosts[0] | string | `"chart-example.local"` | |
| ingress.paths[0] | string | `"/"` | | To install the chart with the release name `my-release`:
| ingress.tls | list | `[]` | |
| nameOverride | string | `""` | | ```console
| nodeSelector | object | `{}` | | helm install --name my-release k8s-at-home/dashmachine
| persistence.accessModes[0] | string | `"ReadWriteOnce"` | | ```
| persistence.enabled | bool | `false` | |
| persistence.size | string | `"1Gi"` | | ## Uninstalling the Chart
| persistence.storageClassName | string | `""` | |
| podAnnotations | object | `{}` | | To uninstall/delete the `my-release` deployment:
| replicaCount | int | `1` | |
| resources | object | `{}` | | ```console
| service.port | int | `5000` | | helm delete my-release --purge
| service.type | string | `"ClusterIP"` | | ```
| tolerations | list | `[]` | |
The command removes all the Kubernetes components associated with the chart and deletes the release.
## Configuration
Read through the charts [values.yaml](https://github.com/k8s-at-home/charts/blob/master/charts/dashmachine/values.yaml)
file. It has several commented out suggested values.
Additionally you can take a look at the common library [values.yaml](https://github.com/k8s-at-home/charts/blob/master/charts/common/values.yaml) for more (advanced) configuration options.
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
```console
helm install dashmachine \
--set env.TZ="America/New_York" \
k8s-at-home/dashmachine
```
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the
chart. For example,
```console
helm install dashmachine k8s-at-home/dashmachine --values values.yaml
```
```yaml
image:
tag: ...
```
---
**NOTE**
If you get
```console
Error: rendered manifests contain a resource that already exists. Unable to continue with install: existing resource conflict: ...`
```
it may be because you uninstalled the chart with `skipuninstall` enabled, you need to manually delete the pvc or use `existingClaim`.
---
## Upgrading an existing Release to a new major version
A major chart version change (like 4.0.1 -> 5.0.0) indicates that there is an incompatible breaking change potentially needing manual actions.
Refer to the library values.yaml for more configuration options.

View File

@ -0,0 +1,2 @@
ingress:
enabled: true

View File

@ -1,21 +0,0 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range $.Values.ingress.paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host }}{{ . }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "dashmachine.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ include "dashmachine.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "dashmachine.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "dashmachine.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:80
{{- end }}

View File

@ -1,32 +0,0 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "dashmachine.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 "dashmachine.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 "dashmachine.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

View File

@ -0,0 +1 @@
{{ include "common.all" . }}

View File

@ -1,78 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "dashmachine.fullname" . }}
{{- if .Values.deploymentAnnotations }}
annotations:
{{- range $key, $value := .Values.deploymentAnnotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
labels:
app.kubernetes.io/name: {{ include "dashmachine.name" . }}
helm.sh/chart: {{ include "dashmachine.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "dashmachine.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "dashmachine.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.podAnnotations }}
annotations:
{{- range $key, $value := .Values.podAnnotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
{{- if .Values.dnsConfig }}
dnsConfig:
{{- toYaml .Values.dnsConfig | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 5000
protocol: TCP
# livenessProbe:
# httpGet:
# path: /notifications
# port: http
# readinessProbe:
# httpGet:
# path: /notifications
# port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: config
mountPath: /dashmachine/dashmachine/user_data
volumes:
- name: config
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "dashmachine.fullname" . }}
{{- else }}
emptyDir: {}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View File

@ -1,40 +0,0 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "dashmachine.fullname" . -}}
{{- $ingressPaths := .Values.ingress.paths -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
app.kubernetes.io/name: {{ include "dashmachine.name" . }}
helm.sh/chart: {{ include "dashmachine.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . | quote }}
http:
paths:
{{- range $ingressPaths }}
- path: {{ . }}
backend:
serviceName: {{ $fullName }}
servicePort: http
{{- end }}
{{- end }}
{{- end }}

View File

@ -1,24 +0,0 @@
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ template "dashmachine.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "dashmachine.name" . }}
helm.sh/chart: {{ include "dashmachine.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.persistence.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
accessModes:
{{- range .Values.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
storageClassName: {{ .Values.persistence.storageClass }}
{{- end -}}

View File

@ -1,19 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "dashmachine.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "dashmachine.name" . }}
helm.sh/chart: {{ include "dashmachine.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/name: {{ include "dashmachine.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}

View File

@ -1,18 +0,0 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "dashmachine.fullname" . }}-test-connection"
labels:
app.kubernetes.io/name: {{ include "dashmachine.name" . }}
helm.sh/chart: {{ include "dashmachine.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
annotations:
"helm.sh/hook": test-success
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "dashmachine.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never

View File

@ -1,65 +1,22 @@
# Default values for dashmachine. # Default values for dashmachine.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image: image:
repository: rmountjoy/dashmachine repository: rmountjoy/dashmachine
tag: v0.5-4 tag: v0.5-4
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
nameOverride: "" strategy:
fullnameOverride: "" type: Recreate
service: service:
type: ClusterIP port:
port: 5000 port: 5000
ingress: env: {}
enabled: false # TZ: UTC
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
paths: ["/"]
hosts:
- chart-example.local
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
persistence: persistence:
config:
enabled: false enabled: false
## If defined, storageClassName: <storageClass> emptyDir: false
## If set to "-", storageClassName: "", which disables dynamic provisioning mountPath: /dashmachine/dashmachine/user_data
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
##
storageClass: ""
accessModes:
- ReadWriteOnce
size: 1Gi
podAnnotations: {}
deploymentAnnotations: {}