[librespeed] migrate to common library (#772)

* fix: use common library

* fix: use common library
This commit is contained in:
ᗪєνιη ᗷυнʟ 2021-04-08 07:26:36 -04:00 committed by GitHub
parent 05a59bd54d
commit a3ac7d6c76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 85 additions and 428 deletions

View File

@ -19,5 +19,8 @@
.project .project
.idea/ .idea/
*.tmproj *.tmproj
.vscode/
# OWNERS file for Kubernetes # OWNERS file for Kubernetes
OWNERS OWNERS
# helm-docs templates
*.gotmpl

View File

@ -1,16 +1,22 @@
apiVersion: v2 apiVersion: v2
appVersion: 1.0.6-12 appVersion: 5.2.4
description: Librespeed is a HTML5 webpage to test upload and download speeds description: Librespeed is a HTML5 webpage to test upload and download speeds
name: librespeed name: librespeed
version: 2.0.3 version: 3.0.0
kubeVersion: ">=1.16.0-0"
keywords: keywords:
- librespeed - librespeed
- speedtest
home: https://github.com/k8s-at-home/charts/tree/master/charts/stable/librespeed home: https://github.com/k8s-at-home/charts/tree/master/charts/stable/librespeed
icon: https://github.com/librespeed/speedtest/blob/master/.logo/logo3.png?raw=true icon: https://github.com/librespeed/speedtest/blob/master/.logo/logo3.png?raw=true
sources: sources:
- https://github.com/librespeed/speedtest - https://github.com/librespeed/speedtest
- https://hub.docker.com/r/linuxserver/librespeed - https://hub.docker.com/r/linuxserver/librespeed
- https://github.com/k8s-at-home/charts/tree/master/charts/librespeed - https://github.com/k8s-at-home/charts/tree/master/charts/librespeed
maintainers: maintainers:
- name: billimek - name: mcmarkj
email: jeff@billimek.com email: mark@markmcw.uk
dependencies:
- name: common
repository: https://library-charts.k8s-at-home.com
version: 2.2.0

View File

@ -1,6 +1,6 @@
# librespeed # librespeed
![Version: 2.0.3](https://img.shields.io/badge/Version-2.0.3-informational?style=flat-square) ![AppVersion: 1.0.6-12](https://img.shields.io/badge/AppVersion-1.0.6--12-informational?style=flat-square) ![Version: 3.0.0](https://img.shields.io/badge/Version-3.0.0-informational?style=flat-square) ![AppVersion: 5.2.4](https://img.shields.io/badge/AppVersion-5.2.4-informational?style=flat-square)
Librespeed is a HTML5 webpage to test upload and download speeds Librespeed is a HTML5 webpage to test upload and download speeds
@ -14,10 +14,13 @@ Librespeed is a HTML5 webpage to test upload and download speeds
## Requirements ## Requirements
Kubernetes: `>=1.16.0-0`
## Dependencies ## Dependencies
| Repository | Name | Version | | Repository | Name | Version |
|------------|------|---------| |------------|------|---------|
| https://library-charts.k8s-at-home.com | common | 2.2.0 |
## TL;DR ## TL;DR
@ -74,50 +77,15 @@ N/A
| Key | Type | Default | Description | | Key | Type | Default | Description |
|-----|------|---------|-------------| |-----|------|---------|-------------|
| affinity | object | `{}` | Affinity settings for pod assignment or the homebridge GUI | | env | object | `{}` | |
| deploymentAnnotations | object | `{}` | Key-value pairs to add as deployment annotations | | image.pullPolicy | string | `"IfNotPresent"` | |
| distance | string | `"km"` | how the distance from the server is measured. Options `km`, `mi`, or `` | | image.repository | string | `"linuxserver/librespeed"` | |
| email | string | `nil` | Email address for GDPR requests. Must be specified when telemetry=true | | image.tag | string | `"version-5.2.4"` | |
| fullnameOverride | string | `""` | | | ingress.enabled | bool | `false` | |
| idObfuscation | bool | `false` | Test IDs are obfuscated, avoids exposing database internal sequential IDs | | persistence.config.emptyDir.enabled | bool | `false` | |
| image.pullPolicy | string | `"IfNotPresent"` | Librespeed image pull policy | | persistence.config.enabled | bool | `false` | |
| image.repository | string | `"adolfintel/speedtest"` | Librespeed image | | service.port.port | int | `80` | |
| image.tag | string | `"latest"` | Librespeed image tag | | strategy.type | string | `"Recreate"` | |
| ingress.annotations | object | `{}` | Ingress annotations |
| ingress.enabled | bool | `false` | Enables Ingress |
| ingress.hosts | list | `["chart-example.local"]` | Ingress accepted hostnames |
| ingress.path | string | `"/"` | Ingress path |
| ingress.tls | list | `[]` | Ingress TLS configuration |
| livenessProbePath | string | `"/"` | Default livenessProbe path |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | Node labels for pod assignment or the homebridge GUI |
| password | string | `"ChangeMe"` | password for stats page |
| persistence.accessMode | string | `"ReadWriteOnce"` | Persistence access modes |
| persistence.enabled | bool | `false` | Use persistent volume to store data |
| persistence.existingClaim | string | `nil` | Use an existing PVC to persist data |
| persistence.size | string | `"1Gi"` | Size of persistent volume claim |
| persistence.skipuninstall | bool | `false` | Do not delete the pvc upon helm uninstall |
| persistence.storageClass | string | `nil` | Type of persistent volume claim |
| persistence.subPath | string | `nil` | When mounting the data volume you may specify a subPath |
| pgid | string | `"1000"` | Default GID |
| podAnnotations | object | `{}` | Key-value pairs to add as pod annotations |
| puid | string | `"1000"` | Default UID |
| readinessProbePath | string | `"/"` | Default readinessProbe path |
| redactIPAddresses | bool | `false` | IP addresses/hostnames are redacted from the collected telemetry |
| resources | object | `{}` | CPU/Memory resource requests/limits or the homebridge GUI |
| service.annotations | object | `{}` | Service annotations for the GUI |
| service.externalTrafficPolicy | string | `nil` | Set the externalTrafficPolicy in the Service to either Cluster or Local |
| service.labels | object | `{}` | Custom labels |
| service.loadBalancerIP | string | `nil` | Loadbalance IP for the GUI |
| service.loadBalancerSourceRanges | list | `nil` | List of IP CIDRs allowed access to load balancer (if supported) |
| service.nodePort | int | `nil` | Kubernetes nodePort where the GUI is exposed |
| service.port | int | `80` | Kubernetes port where the GUI is exposed |
| service.type | string | `"ClusterIP"` | Kubernetes service type for the GUI |
| strategyType | string | `"Recreate"` | Specifies the strategy used to replace old Pods by new ones |
| telemetry | bool | `false` | Enable/Disable history |
| timezone | string | `"UTC"` | Default timezone |
| title | string | `"LibreSpeed"` | Title of your speedtest |
| tolerations | list | `[]` | Toleration labels for pod assignment or the homebridge GUI |
## Changelog ## Changelog
@ -125,7 +93,13 @@ 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). 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).
### [2.0.1] ### [3.0.0]
#### Changed
- Migrated chart to use our common library
### [1.0.0]
#### Added #### Added
@ -133,13 +107,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
#### Changed #### Changed
- Use helm-docs - N/A
#### Removed #### Removed
- N/A - N/A
[2.0.1]: #2.0.1 [3.0.0]: #3.0.0
[1.0.0]: #1.0.0
## Support ## Support

View File

@ -9,7 +9,13 @@ 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). 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).
### [2.0.1] ### [3.0.0]
#### Changed
- Migrated chart to use our common library
### [1.0.0]
#### Added #### Added
@ -17,11 +23,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
#### Changed #### Changed
- Use helm-docs - N/A
#### Removed #### Removed
- N/A - N/A
[2.0.1]: #2.0.1 [3.0.0]: #3.0.0
[1.0.0]: #1.0.0
{{- end -}} {{- end -}}

View File

@ -0,0 +1,2 @@
env:
PASSWORD: "ChangeMe"

View File

@ -1,19 +1 @@
1. Get the application URL by running these commands: {{- include "common.notes.defaultNotes" . -}}
{{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "librespeed.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 "librespeed.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "librespeed.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 "librespeed.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 "librespeed.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 "librespeed.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 "librespeed.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

View File

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

View File

@ -1,102 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "librespeed.fullname" . }}
{{- if .Values.deploymentAnnotations }}
annotations:
{{- range $key, $value := .Values.deploymentAnnotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
labels:
app.kubernetes.io/name: {{ include "librespeed.name" . }}
helm.sh/chart: {{ include "librespeed.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: 1
strategy:
type: {{ .Values.strategyType }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "librespeed.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "librespeed.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.podAnnotations }}
annotations:
{{- range $key, $value := .Values.podAnnotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: {{ .Values.livenessProbePath }}
port: http
readinessProbe:
httpGet:
path: {{ .Values.readinessProbePath }}
port: http
env:
- name: TZ
value: "{{ .Values.timezone }}"
- name: PUID
value: "{{ .Values.puid }}"
- name: GUID
value: "{{ .Values.pgid }}"
{{ if .Values.telemetry }}
- name: TELEMETRY
value: "{{ .Values.telemetry }}"
- name: PASSWORD
value: "{{ .Values.password }}"
- name: ENABLE_ID_OBFUSCATION
value: "{{ .Values.idObfuscation }}"
- name: REDACT_IP_ADDRESSES
value: "{{ .Values.redactIPAddresses }}"
- name: EMAIL
value: "{{ .Values.email }}"
{{ end }}
- name: TITLE
value: "{{ .Values.title }}"
- name: DISTANCE
value: "{{ .Values.distance }}"
volumeMounts:
- name: config
mountPath: /config
{{- if .Values.persistence.subPath }}
subPath: {{ .Values.persistence.subPath }}
{{- end }}
resources:
{{ toYaml .Values.resources | indent 12 }}
volumes:
- name: config
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "librespeed.fullname" . }}{{- end }}
{{- else }}
emptyDir: {}
{{ end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}

View File

@ -1,38 +0,0 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "librespeed.fullname" . -}}
{{- $ingressPath := .Values.ingress.path -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
app.kubernetes.io/name: {{ include "librespeed.name" . }}
helm.sh/chart: {{ include "librespeed.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 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:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $fullName }}
servicePort: http
{{- end }}
{{- end }}

View File

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

View File

@ -1,42 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "librespeed.fullname" . }}
{{- if .Values.service.annotations }}
annotations:
{{- toYaml .Values.service.annotations | nindent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ include "librespeed.name" . }}
helm.sh/chart: {{ include "librespeed.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
{{- if (or (eq .Values.service.type "ClusterIP") (empty .Values.service.type)) }}
type: ClusterIP
{{- else if eq .Values.service.type "LoadBalancer" }}
type: {{ .Values.service.type }}
{{- if .Values.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
{{- if .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml .Values.service.loadBalancerSourceRanges | indent 4 }}
{{- end -}}
{{- else }}
type: {{ .Values.service.type }}
{{- end }}
{{- if .Values.service.externalTrafficPolicy }}
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
{{- end }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
{{ if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }}
nodePort: {{.Values.service.nodePort}}
{{ end }}
selector:
app.kubernetes.io/name: {{ include "librespeed.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}

View File

@ -1,123 +1,42 @@
# Default values for librespeed #
# This is a YAML-formatted file. # IMPORTANT NOTE
# Declare variables to be passed into your templates. #
# This chart inherits from our common library chart. You can check the default values/options here:
# -- Specifies the strategy used to replace old Pods by new ones # https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common/values.yaml
strategyType: Recreate #
image: image:
# -- Librespeed image repository: linuxserver/librespeed
repository: adolfintel/speedtest
# -- Librespeed image tag
tag: latest
# -- Librespeed image pull policy
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
tag: version-5.2.4
nameOverride: "" strategy:
fullnameOverride: "" type: Recreate
# -- Default livenessProbe path
livenessProbePath: /
# -- Default readinessProbe path
readinessProbePath: /
# -- Default timezone
timezone: "UTC"
# -- Default UID
puid: "1000"
# -- Default GID
pgid: "1000"
# -- Enable/Disable history
telemetry: false
# -- password for stats page
password: "ChangeMe"
# -- (string) Email address for GDPR requests. Must be specified when telemetry=true
email:
# -- Title of your speedtest
title: LibreSpeed
# -- Test IDs are obfuscated, avoids exposing database internal sequential IDs
idObfuscation: false
# -- IP addresses/hostnames are redacted from the collected telemetry
redactIPAddresses: false
# -- how the distance from the server is measured. Options `km`, `mi`, or ``
distance: "km"
# See more environment variables in the librespeed documentation
# https://hub.docker.com/r/linuxserver/librespeed
env: {}
# TZ:
# PUID:
# PGID:
# PASSWORD:
# CUSTOM_RESULTS:
# DB_TYPE:
# DB_NAME:
# DB_HOSTNAME:
# DB_USERNAME:
# DB_PASSWORD:
# DB_PORT:
service: service:
# -- Kubernetes service type for the GUI port:
type: ClusterIP
# -- Kubernetes port where the GUI is exposed
port: 80 port: 80
# -- (int) Kubernetes nodePort where the GUI is exposed
nodePort:
# -- Service annotations for the GUI
annotations: {}
# -- Custom labels
labels: {}
# -- (string) Loadbalance IP for the GUI
loadBalancerIP:
# -- (list) List of IP CIDRs allowed access to load balancer (if supported)
loadBalancerSourceRanges:
# -- Set the externalTrafficPolicy in the Service to either Cluster or Local
externalTrafficPolicy:
ingress: ingress:
# -- Enables Ingress
enabled: false enabled: false
# -- Ingress annotations
annotations: {}
# -- Ingress path
path: /
# -- Ingress accepted hostnames
hosts:
- chart-example.local
# -- Ingress TLS configuration
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
persistence: persistence:
# -- Use persistent volume to store data config:
enabled: false
emptyDir:
enabled: false enabled: false
# -- (string) Type of persistent volume claim
storageClass:
# -- (string) Use an existing PVC to persist data
existingClaim:
# -- Persistence access modes
accessMode: ReadWriteOnce
# -- Size of persistent volume claim
size: 1Gi
# -- Do not delete the pvc upon helm uninstall
skipuninstall: false
# -- (string) When mounting the data volume you may specify a subPath
subPath:
# -- CPU/Memory resource requests/limits or the homebridge GUI
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
# -- Node labels for pod assignment or the homebridge GUI
nodeSelector: {}
# -- Toleration labels for pod assignment or the homebridge GUI
tolerations: []
# -- Affinity settings for pod assignment or the homebridge GUI
affinity: {}
# -- Key-value pairs to add as pod annotations
podAnnotations: {}
# -- Key-value pairs to add as deployment annotations
deploymentAnnotations: {}