Skip to content

Commit

Permalink
Merge pull request #10 from JacekZubielik/lms
Browse files Browse the repository at this point in the history
chore(init): init
  • Loading branch information
JacekZubielik authored May 22, 2024
2 parents 98e1228 + 90cefcc commit 76807fc
Show file tree
Hide file tree
Showing 9 changed files with 655 additions and 0 deletions.
16 changes: 16 additions & 0 deletions charts/lms/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
apiVersion: v2
appVersion: 9.0.0
description: Logitech Media Server
name: lms
version: 0.0.1
keywords:
- lms
- logitechmediaserver
type: application
home: https://github.com/JacekZubielik/helm-charts/tree/master/charts/lms
icon: https://truecharts.org/img/hotlink-ok/chart-icons/logitech-media-server.png
sources:
- https://hub.docker.com/r/lmscommunity/logitechmediaserver
maintainers:
- name: jacekzubielik
57 changes: 57 additions & 0 deletions charts/lms/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{{/* Expand the name of the chart. */}}

{{- define "lms.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 "lms.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 "lms.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end -}}

{{/* Common labels */}}

{{- define "lms.labels" -}}
helm.sh/chart: {{ include "lms.chart" . }}

{{ include "lms.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/* Selector labels */}}

{{- define "lms.selectorLabels" -}}
app.kubernetes.io/name: {{ include "lms.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/* Create the name of the service account to use */}}

{{- define "lms.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "lms.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
64 changes: 64 additions & 0 deletions charts/lms/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "lms.fullname" . -}}
{{- $servicePort := .Values.service.http -}}
{{- $ingressPath := .Values.ingress.path -}}
{{- $new := false }}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" -}}
apiVersion: networking.k8s.io/v1
{{- $new = true }}
{{- else }}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "lms.labels" . | nindent 4 }}
annotations:
{{- if not $new }}
kubernetes.io/ingress.class: {{ required "If ingress.enabled is set to true, ingress.class is required" .Values.ingress.class }}
{{- end }}
{{- if .Values.ingress.annotations }}
{{- toYaml .Values.ingress.annotations | nindent 4 }}
{{- end }}
spec:
{{- if $new }}
ingressClassName: {{ required "If ingress.enabled is set to true, ingress.class is required" .Values.ingress.class }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- if $new }}
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
pathType: Prefix
backend:
service:
name: {{ $fullName }}
port:
number: {{ $servicePort }}
{{- end }}
{{- else }}
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $fullName }}
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
{{- end }}

21 changes: 21 additions & 0 deletions charts/lms/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if and .Values.persistence.pvc.enabled (not .Values.persistence.configstorage.hostPath) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "lms.fullname" . }}
labels:
{{- include "lms.labels" . | nindent 4 }}
spec:
accessModes:
- {{ .Values.persistence.pvc.accessMode }}
resources:
requests:
storage: {{ .Values.persistence.pvc.size }}
{{- if .Values.persistence.pvc.storageClass }}
{{- if (eq "-" .Values.persistence.pvc.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.pvc.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
53 changes: 53 additions & 0 deletions charts/lms/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
apiVersion: v1
kind: Service
metadata:
{{- if .Values.service.annotations }}
annotations:
{{- toYaml .Values.service.annotations | nindent 4 }}
{{- end }}
name: {{ template "lms.fullname" . }}
labels:
{{- include "lms.labels" . | nindent 4 }}
{{- if .Values.service.labels }}
{{ toYaml .Values.service.labels | indent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
{{- if .Values.service.externalIPs }}
externalIPs:
{{- toYaml .Values.service.externalIPs | nindent 4 }}
{{- end }}
{{- if .Values.service.externalTrafficPolicy }}
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
{{- end }}
{{- if .Values.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
{{- if .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{- toYaml .Values.service.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
publishNotReadyAddresses: {{ .Values.service.publishNotReadyAddresses }}
ports:
- name: http
port: {{ .Values.service.httpPort }}
protocol: TCP
targetPort: http
- name: cli
port: {{ .Values.service.cliPort }}
protocol: TCP
targetPort: cli
- name: control
port: {{ .Values.service.controlPort }}
protocol: TCP
targetPort: control
- name: discovery
port: {{ .Values.service.discoveryPort }}
protocol: UDP
targetPort: discovery
- name: metrics
port: {{ .Values.service.metricsPort }}
protocol: TCP
targetPort: metrics
selector:
{{- include "lms.selectorLabels" . | nindent 4 }}
16 changes: 16 additions & 0 deletions charts/lms/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
{{- if .Values.serviceAccount.annotations }}
annotations:
{{- toYaml .Values.serviceAccount.annotations | nindent 4 }}
{{- end }}
name: {{ template "lms.fullname" . }}
labels:
{{- include "lms.labels" . | nindent 4 }}
{{- if .Values.serviceAccount.labels }}
{{ toYaml .Values.serviceAccount.labels | indent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
{{- end }}
67 changes: 67 additions & 0 deletions charts/lms/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{{- if and ( .Values.monitoring.serviceMonitor.enabled ) ( .Values.monitoring.enabled ) }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "lms.fullname" . }}-prometheus-exporter
labels:
{{- include "lms.labels" . | nindent 4 }}
{{- with .Values.monitoring.serviceMonitor.selector }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.monitoring.serviceMonitor.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.monitoring.serviceMonitor.namespace }}
namespace: {{ .Values.monitoring.serviceMonitor.namespace }}
{{- end }}
spec:
selector:
matchLabels:
{{- include "lms.selectorLabels" . | nindent 6 }}
{{- if .Values.podLabels }}
{{- toYaml .Values.podLabels | nindent 6 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
endpoints:
- targetPort: {{ .Values.service.metricsPort }}
path: /metrics
{{- with .Values.monitoring.serviceMonitor.honorLabels }}
honorLabels: {{ . }}
{{- end }}
{{- if .Values.monitoring.serviceMonitor.interval }}
interval: {{ .Values.monitoring.serviceMonitor.interval }}
{{- end }}
{{- if .Values.monitoring.serviceMonitor.scrapeTimeout}}
scrapeTimeout: {{ .Values.monitoring.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- with .Values.monitoring.serviceMonitor.scheme }}
scheme: {{ . }}
{{- end }}
{{- with .Values.monitoring.serviceMonitor.tlsConfig }}
tlsConfig:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.monitoring.serviceMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.monitoring.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- if .Values.monitoring.serviceMonitor.bearerTokenFile }}
bearerTokenFile: {{ .Values.monitoring.serviceMonitor.bearerTokenFile }}
{{- end }}
{{- if .Values.monitoring.serviceMonitor.bearerTokenSecret }}
bearerTokenSecret:
name: {{ .Values.monitoring.serviceMonitor.bearerTokenSecret.name }}
key: {{ .Values.monitoring.serviceMonitor.bearerTokenSecret.key }}
{{- if .Values.monitoring.serviceMonitor.bearerTokenSecret.optional }}
optional: {{ .Values.monitoring.serviceMonitor.bearerTokenSecret.optional }}
{{- end }}
{{- end }}
jobLabel: {{ template "lms.fullname" . }}-prometheus-exporter
{{- end }}
Loading

0 comments on commit 76807fc

Please sign in to comment.