From 8750eca39b8144bf54ce9ea07700d6961d911b30 Mon Sep 17 00:00:00 2001 From: Jochem <33828672+TheChef23@users.noreply.github.com> Date: Thu, 11 Jul 2024 20:46:50 +0200 Subject: [PATCH 1/5] Add ingress object (#16) * Add ingress and testing values * Bump version --- charts/librenms/Chart.yaml | 2 +- charts/librenms/README.md | 9 +++- charts/librenms/ci/test-values.yaml | 2 + charts/librenms/templates/_helpers.tpl | 65 +++++++++++++++++++++++++- charts/librenms/templates/ingress.yml | 62 ++++++++++++++++++++++++ charts/librenms/values.yaml | 21 +++++++++ 6 files changed, 157 insertions(+), 4 deletions(-) create mode 100644 charts/librenms/templates/ingress.yml diff --git a/charts/librenms/Chart.yaml b/charts/librenms/Chart.yaml index 15d2741..6620109 100644 --- a/charts/librenms/Chart.yaml +++ b/charts/librenms/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: librenms description: LibreNMS is an autodiscovering PHP/MySQL-based network monitoring system. type: application -version: 3.11.1 +version: 3.12.0 appVersion: "24.5.0" maintainers: - name: TheChef23 diff --git a/charts/librenms/README.md b/charts/librenms/README.md index 46050b8..1a7d859 100644 --- a/charts/librenms/README.md +++ b/charts/librenms/README.md @@ -1,5 +1,5 @@ # LibreNMS -![Version: 3.11.0](https://img.shields.io/badge/Version-3.11.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 24.5.0](https://img.shields.io/badge/AppVersion-24.5.0-informational?style=flat-square) +![Version: 3.12.0](https://img.shields.io/badge/Version-3.12.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 24.5.0](https://img.shields.io/badge/AppVersion-24.5.0-informational?style=flat-square) ## TL;DR @@ -47,12 +47,17 @@ librenms: ### Available values -The following table lists the main configurable parameters of the librenms chart v3.11.0 and their default values. Please, refer to [values.yaml](./values.yaml) for the full list of configurable parameters. +The following table lists the main configurable parameters of the librenms chart v3.12.0 and their default values. Please, refer to [values.yaml](./values.yaml) for the full list of configurable parameters. ## Values | Key | Type | Default | Description | |-----|------|---------|-------------| +| ingress | object | `{"annotations":{},"className":"","enabled":false,"hosts":[{"host":"chart-example.local","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}],"tls":[]}` | LibreNMS ingress configuration | +| ingress.annotations | object | `{}` | Ingress annotations | +| ingress.className | string | `""` | Ingress class name | +| ingress.enabled | bool | `false` | Enable or disable ingress | +| ingress.hosts | list | `[{"host":"chart-example.local","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}]` | Ingress ingress rules | | librenms.appkey | string | `nil` | Laravel appkey used by LibreNMS, this should be generated by you and is a required setting. See the README for more information | | librenms.configuration | string | `"$config['distributed_poller_group'] = '0';\n$config['distributed_poller'] = true;\n"` | Custom configuration options for LibreNMS. Fore more infomation on options in this file check the following link: https://docs.librenms.org/Support/Configuration/ | | librenms.extraEnvs | object | `{}` | LibreNMS frontend extra envs | diff --git a/charts/librenms/ci/test-values.yaml b/charts/librenms/ci/test-values.yaml index da1f3e9..09b1f36 100644 --- a/charts/librenms/ci/test-values.yaml +++ b/charts/librenms/ci/test-values.yaml @@ -1,2 +1,4 @@ librenms: appkey: base64:RTMmh+i10E2RMcDxookMu47BTzJQy87hOU+k/zcuPnA= +ingress: + enabled: "true" diff --git a/charts/librenms/templates/_helpers.tpl b/charts/librenms/templates/_helpers.tpl index 6dd21f1..86a780f 100644 --- a/charts/librenms/templates/_helpers.tpl +++ b/charts/librenms/templates/_helpers.tpl @@ -1,3 +1,66 @@ {{- define "librenms.configChecksum" -}} {{- include (print $.Template.BasePath "/librenms-configmap.yml") . | sha256sum -}} -{{- end -}} \ No newline at end of file +{{- end -}} + +{{/* +Expand the name of the chart. +*/}} +{{- define "librenms.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 "librenms.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 "librenms.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "librenms.labels" -}} +helm.sh/chart: {{ include "librenms.chart" . }} +{{ include "librenms.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "librenms.selectorLabels" -}} +app.kubernetes.io/name: {{ include "librenms.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "librenms.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "librenms.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/librenms/templates/ingress.yml b/charts/librenms/templates/ingress.yml new file mode 100644 index 0000000..e3f6c83 --- /dev/null +++ b/charts/librenms/templates/ingress.yml @@ -0,0 +1,62 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := .Release.Name -}} +{{- $svcPort := 8000 -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ .Release.Name }} + labels: + app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/instance: frontend + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/librenms/values.yaml b/charts/librenms/values.yaml index 883957a..2796d2a 100644 --- a/charts/librenms/values.yaml +++ b/charts/librenms/values.yaml @@ -123,6 +123,27 @@ librenms: # -- Extra environment variable for RRDCACHED container extraEnvs: {} +# -- LibreNMS ingress configuration +ingress: + # -- Enable or disable ingress + enabled: false + # -- Ingress class name + className: "" + # -- Ingress annotations + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + # -- Ingress ingress rules + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + # -- Configuration for MySQL dependency chart by Bitnami. See their chart for # more information: https://github.com/bitnami/charts/tree/master/bitnami/mysql mysql: From bb54381e1d08ebddad7090800dc981f671add281 Mon Sep 17 00:00:00 2001 From: Jochem Date: Thu, 11 Jul 2024 22:31:11 +0200 Subject: [PATCH 2/5] Fix CI values --- charts/librenms/ci/test-values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/librenms/ci/test-values.yaml b/charts/librenms/ci/test-values.yaml index 09b1f36..099851a 100644 --- a/charts/librenms/ci/test-values.yaml +++ b/charts/librenms/ci/test-values.yaml @@ -1,4 +1,4 @@ librenms: appkey: base64:RTMmh+i10E2RMcDxookMu47BTzJQy87hOU+k/zcuPnA= ingress: - enabled: "true" + enabled: true From 6d597db8eefc6f244d2f5fc0864fdb4f18ed4251 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 31 Jul 2024 11:52:22 +0200 Subject: [PATCH 3/5] Update librenms/librenms Docker tag to v24.6.0 (#19) * Update librenms/librenms Docker tag to v24.6.0 * Apply automatic changes --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] --- charts/librenms/Chart.yaml | 2 +- charts/librenms/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/librenms/Chart.yaml b/charts/librenms/Chart.yaml index 6620109..6753b40 100644 --- a/charts/librenms/Chart.yaml +++ b/charts/librenms/Chart.yaml @@ -3,7 +3,7 @@ name: librenms description: LibreNMS is an autodiscovering PHP/MySQL-based network monitoring system. type: application version: 3.12.0 -appVersion: "24.5.0" +appVersion: "24.6.0" maintainers: - name: TheChef23 url: https://github.com/TheChef23 diff --git a/charts/librenms/values.yaml b/charts/librenms/values.yaml index 2796d2a..dae32cb 100644 --- a/charts/librenms/values.yaml +++ b/charts/librenms/values.yaml @@ -6,7 +6,7 @@ librenms: # -- repository is the image repository to pull from. repository: librenms/librenms # -- tag is image tag to pull. - tag: 24.5.0 + tag: 24.6.0 # -- Laravel appkey used by LibreNMS, this should be generated by you and is a # required setting. See the README for more information From c90f6e3189f3e5d2bd652418bbaf67dfcad7c58c Mon Sep 17 00:00:00 2001 From: Jochem Date: Wed, 31 Jul 2024 11:53:37 +0200 Subject: [PATCH 4/5] Bump version --- charts/librenms/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/librenms/Chart.yaml b/charts/librenms/Chart.yaml index 6753b40..1346d57 100644 --- a/charts/librenms/Chart.yaml +++ b/charts/librenms/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: librenms description: LibreNMS is an autodiscovering PHP/MySQL-based network monitoring system. type: application -version: 3.12.0 +version: 3.13.0 appVersion: "24.6.0" maintainers: - name: TheChef23 From 4f2053a1c59cbeb522ee2dca15441a3ac9aba369 Mon Sep 17 00:00:00 2001 From: Jochem Date: Wed, 31 Jul 2024 11:57:34 +0200 Subject: [PATCH 5/5] Fix maintainers --- charts/librenms/Chart.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/librenms/Chart.yaml b/charts/librenms/Chart.yaml index 1346d57..b0cdc9d 100644 --- a/charts/librenms/Chart.yaml +++ b/charts/librenms/Chart.yaml @@ -2,11 +2,11 @@ apiVersion: v2 name: librenms description: LibreNMS is an autodiscovering PHP/MySQL-based network monitoring system. type: application -version: 3.13.0 +version: 3.13.1 appVersion: "24.6.0" maintainers: - - name: TheChef23 - url: https://github.com/TheChef23 + - name: jochbru + url: https://github.com/jochbru dependencies: - name: redis version: "~19.6.0"