diff --git a/.github/workflows/chart-testing.yml b/.github/workflows/chart-testing.yml new file mode 100644 index 0000000..626b5b0 --- /dev/null +++ b/.github/workflows/chart-testing.yml @@ -0,0 +1,59 @@ +name: Lint and Test Charts + +on: pull_request + +jobs: + lint-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@v4.2.0 + with: + version: v3.14.4 + + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + check-latest: true + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.6.1 + + - name: Add repositories + run: | + for dir in $(ls -d charts/*/); do + helm dependency list $dir 2> /dev/null | tail +2 | head -n -1 | awk '{ print "helm repo add " $1 " " $3 }' | while read cmd; do $cmd; done + done + + - name: Run chart-testing (list-changed) + id: list-changed + run: | + changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) + if [[ -n "$changed" ]]; then + echo "changed=true" >> "$GITHUB_OUTPUT" + fi + + - name: Run chart-testing (lint) + if: steps.list-changed.outputs.changed == 'true' && github.ref != 'refs/heads/develop' + run: ct lint --target-branch ${{ github.event.repository.default_branch }} --check-version-increment=false + + - name: Run chart-testing (lint & version) + if: github.event.pull_request.base.ref == 'main' + run: ct lint --target-branch main + + - name: Create kind cluster + if: steps.list-changed.outputs.changed == 'true' || github.event.pull_request.base.ref == 'main' + uses: helm/kind-action@v1.10.0 + + - name: Run chart-testing (install) + if: steps.list-changed.outputs.changed == 'true' && github.ref != 'refs/heads/develop' + run: ct install --target-branch ${{ github.event.repository.default_branch }} --skip-clean-up + + - name: Run chart-testing (install & upgrades) + if: github.event.pull_request.base.ref == 'main' + run: ct install --target-branch main --upgrade \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e4a04c6..714391c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - name: Install Helm - uses: azure/setup-helm@v3 + uses: azure/setup-helm@v4 - name: Add repositories run: | diff --git a/.github/workflows/set-appVersion.yml b/.github/workflows/set-appVersion.yml new file mode 100644 index 0000000..2b10ec1 --- /dev/null +++ b/.github/workflows/set-appVersion.yml @@ -0,0 +1,34 @@ +name: Updste LibreNMS appVersion +on: + push: + branches: + - renovate/* + +jobs: + set-appverions: + runs-on: ubuntu-24.04 + + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the + # added or changed files to the repository. + contents: write + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + + - name: Find image version + run: | + wget https://github.com/mikefarah/yq/releases/download/v4.44.2/yq_linux_amd64.tar.gz -O /tmp/yq.tgz + tar -xvf /tmp/yq.tgz --directory /tmp + chmod +x /tmp/yq_linux_amd64 + + export VERSION=$(/tmp/yq_linux_amd64 '.librenms.image.tag' charts/librenms/values.yaml) + echo "DETECTED VERSION $VERSION" + /tmp/yq_linux_amd64 -e -i '.appVersion = env(VERSION)' charts/librenms/Chart.yaml + + + # Commit all changed files back to the repository + - uses: stefanzweifel/git-auto-commit-action@v5 \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ddd37fb --- /dev/null +++ b/Makefile @@ -0,0 +1,40 @@ +DOCS_IMAGE_VERSION="v1.14.2" + +LINT_IMAGE_VERSION="v3.8.0" + +# Charts's path relative to the current directory. +CHARTS := $(wildcard ./charts/*) + +CHARTS_NAMES := $(notdir $(CHARTS)) + +.PHONY: lint +lint: helm-deps-update $(addprefix lint-, $(CHARTS_NAMES)) + +lint-%: + @docker run \ + -it \ + -e HOME=/home/ct \ + --mount type=tmpfs,destination=/home/ct \ + --workdir=/data \ + --volume $$(pwd):/data \ + -u $$(id -u) \ + quay.io/helmpack/chart-testing:$(LINT_IMAGE_VERSION) \ + ct lint --config ./ct.yaml --charts ./charts/$* + +.PHONY: docs +docs: $(addprefix docs-, $(CHARTS_NAMES)) + +docs-%: + @docker run \ + --rm \ + --workdir=/helm-docs \ + --volume "$$(pwd):/helm-docs" \ + -u $$(id -u) \ + jnorwood/helm-docs:$(DOCS_IMAGE_VERSION) \ + helm-docs -c ./charts/$* -t ./README.gotmpl -o ./README.md + +.PHONY: helm-deps-update +helm-deps-update: $(addprefix helm-deps-update-, $(CHARTS_NAMES)) + +helm-deps-update-%: + helm dependency update ./charts/$* \ No newline at end of file diff --git a/README.md b/README.md index e69de29..a28ed9e 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,31 @@ +# LibreNMS Helm Charts + +Welcome to the repository for the Helm charts of the LibreNMS community. This repository holds all the Helm charts you need to deploy LibreNMS and related components using Kubernetes. + +## Main Chart + +The primary chart in this repository is located at `charts/librenms`. This chart allows you to deploy LibreNMS, an open-source network monitoring system, on your Kubernetes cluster. + +## Documentation + +Each chart within this repository comes with its own set of documentation. To get started with a specific chart, please refer to the README.md file located in the respective chart's directory. + +## Getting Started + +To install a chart from this repository, you can use the following Helm commands: + +```sh +helm repo add librenms https://www.librenms.org/helm-charts +helm repo update +helm install my-release librenms/ +``` + +Replace `` with the name of the chart you wish to install (e.g., `librenms`). + +## Contributing + +We welcome contributions from the community. If you have improvements or fixes, please submit a pull request. Make sure to follow our contribution guidelines. + +--- + +Thank you for using LibreNMS Helm charts! For any issues or questions, please refer to the documentation of the respective chart or open an issue in this repository. \ No newline at end of file diff --git a/charts/librenms/Chart.lock b/charts/librenms/Chart.lock index d665d61..54c9664 100644 --- a/charts/librenms/Chart.lock +++ b/charts/librenms/Chart.lock @@ -1,9 +1,9 @@ dependencies: - name: redis repository: https://charts.bitnami.com/bitnami - version: 19.5.5 + version: 19.6.1 - name: mysql repository: https://charts.bitnami.com/bitnami - version: 10.3.0 -digest: sha256:e3cdff9ae055655aacaa8e64187b42cc1834bd5ddbbc6f9dbb01fa214586cf68 -generated: "2024-06-20T07:46:30.599412737Z" + version: 11.1.8 +digest: sha256:4b82fafdf2c4c72a003d1dc6df9343a089eb5d2f686927d134821854f9633c83 +generated: "2024-07-09T10:22:10.255911997Z" diff --git a/charts/librenms/Chart.yaml b/charts/librenms/Chart.yaml index aafa1bc..15d2741 100644 --- a/charts/librenms/Chart.yaml +++ b/charts/librenms/Chart.yaml @@ -1,18 +1,18 @@ apiVersion: v2 name: librenms description: LibreNMS is an autodiscovering PHP/MySQL-based network monitoring system. - type: application - -version: 3.8.0 +version: 3.11.1 appVersion: "24.5.0" - +maintainers: + - name: TheChef23 + url: https://github.com/TheChef23 dependencies: -- name: redis - version: "~19.5.0" - repository: "https://charts.bitnami.com/bitnami" - when: redis.enabled == true -- name: mysql - version: "~10.3.0" - repository: "https://charts.bitnami.com/bitnami" - when: mysql.enabled == true + - name: redis + version: "~19.6.0" + repository: "https://charts.bitnami.com/bitnami" + condition: redis.enabled + - name: mysql + version: "~11.1.0" + repository: "https://charts.bitnami.com/bitnami" + condition: mysql.enabled diff --git a/charts/librenms/README.gotmpl b/charts/librenms/README.gotmpl new file mode 100644 index 0000000..204b959 --- /dev/null +++ b/charts/librenms/README.gotmpl @@ -0,0 +1,66 @@ +# LibreNMS +{{ template "chart.badgesSection" . }} + +## TL;DR + +```shell +$ helm repo add librenms https://www.librenms.org/helm-charts +$ helm install my-release librenms/librenms --set appkey= +``` + +## Prerequisites + +- This chart has only been tested on Kubernetes 1.18+, but should work on 1.14+ +- Recent versions of Helm 3 are supported + +## Installing the Chart + +To install the chart with the release name `my-release` and default configuration: + +```shell +$ helm repo add librenms https://www.librenms.org/helm-charts +$ helm install my-release librenms/librenms --set appkey= +``` + +## Values +Check the [values.yaml](./values.yaml) file for the available settings for this chart and its +dependencies. + +### Required values: +``` +librenms: + appkey: +``` + +This should be filled with a laravel appkey, this can be generated using the laravel artisan command: +``` +php artisan key:generate +``` +The value should look like: +``` +librenms: + appkey: base64:RTMmh+i10E2RMcDxookMu47BTzJQy87hOU+k/zcuPnA= +``` +### Recommendations + +* `librenms.poller.replicas`: Depending on the scale of your installation, the amount of poller pods needs to b scaled up. Use the poller page in the LibreNMS interface to check for scaling issues. + +### Available values + +The following table lists the main configurable parameters of the {{ template "chart.name" . }} chart v{{ template "chart.version" . }} and their default values. Please, refer to [values.yaml](./values.yaml) for the full list of configurable parameters. + +{{ template "chart.valuesSection" . }} + +## Uninstalling the Chart + +To delete the chart: + +```shell +$ helm delete my-release +``` + +{{ template "chart.requirementsSection" . }} + +{{ template "chart.maintainersSection" . }} + +{{ template "helm-docs.versionFooter" . }} diff --git a/charts/librenms/README.md b/charts/librenms/README.md index 3cb9ff8..46050b8 100644 --- a/charts/librenms/README.md +++ b/charts/librenms/README.md @@ -1,13 +1,11 @@ # LibreNMS - -[LibreNMS](https://docs.librenms.org/) is an IP address management (IPAM) and -data center infrastructure management (DCIM) tool. +![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) ## TL;DR ```shell -$ helm repo add thechef23 https://thechef23.github.io/helm-librenms -$ helm install my-release thechef23-librenms/librenms --set appkey= +$ helm repo add librenms https://www.librenms.org/helm-charts +$ helm install my-release librenms/librenms --set appkey= ``` ## Prerequisites @@ -20,20 +18,74 @@ $ helm install my-release thechef23-librenms/librenms --set appkey= +$ helm repo add librenms https://www.librenms.org/helm-charts +$ helm install my-release librenms/librenms --set appkey= ``` ## Values -Check the [values.yaml](/TheChef23/helm-librenms/blob/main/values.yaml) file for the available settings for this chart and its +Check the [values.yaml](./values.yaml) file for the available settings for this chart and its dependencies. ### Required values: ``` librenms: - appkey: + appkey: ``` +This should be filled with a laravel appkey, this can be generated using the laravel artisan command: +``` +php artisan key:generate +``` +The value should look like: +``` +librenms: + appkey: base64:RTMmh+i10E2RMcDxookMu47BTzJQy87hOU+k/zcuPnA= +``` +### Recommendations + +* `librenms.poller.replicas`: Depending on the scale of your installation, the amount of poller pods needs to b scaled up. Use the poller page in the LibreNMS interface to check for scaling issues. + +### 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. + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| 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 | +| librenms.frontend.readinessProbe.httpGet.path | string | `"/login"` | Check endpoint path | +| librenms.frontend.readinessProbe.httpGet.port | int | `8000` | Check endpoint port | +| librenms.frontend.readinessProbe.initialDelaySeconds | int | `30` | | +| librenms.frontend.readinessProbe.periodSeconds | int | `60` | | +| librenms.frontend.readinessProbe.timeoutSeconds | int | `10` | | +| librenms.frontend.replicas | int | `1` | Frontend replicas | +| librenms.frontend.resources | object | `{}` | resources defines the computing resources (CPU and memory) that are allocated to the containers running within the Pod. | +| librenms.image.repository | string | `"librenms/librenms"` | repository is the image repository to pull from. | +| librenms.image.tag | string | `"24.5.0"` | tag is image tag to pull. | +| librenms.poller.replicas | int | `2` | Poller replicas | +| librenms.poller.resources | object | `{}` | resources defines the computing resources (CPU and memory) that are allocated to the containers running within the Pod. | +| librenms.rrdcached | object | `{"envs":[{"name":"TZ","value":"Europe/Amsterdam"},{"name":"WRITE_JITTER","value":"1800"},{"name":"WRITE_TIMEOUT","value":"1800"}],"extraEnvs":{},"image":{"repository":"crazymax/rrdcached","tag":"1.8.0"},"livenessProbe":{"initialDelaySeconds":15,"periodSeconds":20,"tcpSocket":{"port":42217}},"persistence":{"enabled":true,"journal":{"size":"1Gi"},"rrdcached":{"size":"10Gi"}},"resources":{}}` | RRD cached is the tool that allows for distributed polling and is mandatory in this LibreNMS helm chart. See the rrdcached documentation for more information: https://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html | +| librenms.rrdcached.envs[0] | object | `{"name":"TZ","value":"Europe/Amsterdam"}` | env variables RRD Cached | +| librenms.rrdcached.extraEnvs | object | `{}` | Extra environment variable for RRDCACHED container | +| librenms.rrdcached.image.repository | string | `"crazymax/rrdcached"` | repository is the image repository to pull from. | +| librenms.rrdcached.image.tag | string | `"1.8.0"` | tag is image tag to pull. | +| librenms.rrdcached.livenessProbe.tcpSocket | object | `{"port":42217}` | RRD cached liveness probe | +| librenms.rrdcached.persistence.enabled | bool | `true` | RRDCached persistent volume enabled | +| librenms.rrdcached.persistence.journal.size | string | `"1Gi"` | RRDCached journal PV size | +| librenms.rrdcached.persistence.rrdcached.size | string | `"10Gi"` | RRDCached RRD storage PV size | +| librenms.rrdcached.resources | object | `{}` | resources defines the computing resources (CPU and memory) that are allocated to the containers running within the Pod. | +| librenms.snmp_scanner | object | `{"cron":"15 * * * *","enabled":false,"extraEnvs":{},"resources":{}}` | SNMP network discovery scanner cron job. This job is optional and only use when having snmp network discovery enabled. For this to work either set the 'nets' confifuration in the custom config on in the admin interface See the following link for more information: https://docs.librenms.org/Extensions/Auto-Discovery/ | +| librenms.snmp_scanner.cron | string | `"15 * * * *"` | SNMP scanner cornjob syntac interval | +| librenms.snmp_scanner.enabled | bool | `false` | SNMP scanner enabled | +| librenms.snmp_scanner.extraEnvs | object | `{}` | SNMP scanner extra envs | +| librenms.snmp_scanner.resources | object | `{}` | resources defines the computing resources (CPU and memory) that are allocated to the containers running within the Pod. | +| librenms.timezone | string | `"UTC"` | Timezone used by librenms for communication with RRD cached | +| mysql | object | `{"auth":{"database":"librenms","username":"librenms"},"enabled":true}` | Configuration for MySQL dependency chart by Bitnami. See their chart for more information: https://github.com/bitnami/charts/tree/master/bitnami/mysql | +| redis | object | `{"architecture":"standalone","auth":{"enabled":false,"sentinel":false},"enabled":true,"master":{"disableCommands":[]},"sentinel":{"enabled":false}}` | Configuration for redis dependency chart by Bitnami. See their chart for more information: https://github.com/bitnami/charts/tree/master/bitnami/redis | + ## Uninstalling the Chart To delete the chart: @@ -42,21 +94,18 @@ To delete the chart: $ helm delete my-release ``` -## License +## Requirements -> The following notice applies to all files contained within this Helm Chart and -> the Git repository which contains it: -> -> Copyright 2022 Jochem Bruijns -> -> Licensed under the Apache License, Version 2.0 (the "License"); -> you may not use this file except in compliance with the License. -> You may obtain a copy of the License at -> -> http://www.apache.org/licenses/LICENSE-2.0 -> -> Unless required by applicable law or agreed to in writing, software -> distributed under the License is distributed on an "AS IS" BASIS, -> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -> See the License for the specific language governing permissions and -> limitations under the License. +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | mysql | ~11.1.0 | +| https://charts.bitnami.com/bitnami | redis | ~19.6.0 | + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| TheChef23 | | | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) diff --git a/charts/librenms/ci/test-values.yaml b/charts/librenms/ci/test-values.yaml new file mode 100644 index 0000000..da1f3e9 --- /dev/null +++ b/charts/librenms/ci/test-values.yaml @@ -0,0 +1,2 @@ +librenms: + appkey: base64:RTMmh+i10E2RMcDxookMu47BTzJQy87hOU+k/zcuPnA= diff --git a/charts/librenms/values.yaml b/charts/librenms/values.yaml index fad7e12..883957a 100644 --- a/charts/librenms/values.yaml +++ b/charts/librenms/values.yaml @@ -3,90 +3,116 @@ # Declare variables to be passed into your templates. librenms: image: + # -- repository is the image repository to pull from. repository: librenms/librenms + # -- tag is image tag to pull. tag: 24.5.0 - # Laravel appkey used by LibreNMS, a default is set for useability it is - # recommended to replace this with your own key - # THIS A REQUIRED SETTINGS - appkey: + # -- Laravel appkey used by LibreNMS, this should be generated by you and is a + # required setting. See the README for more information + appkey: - # Timezone used by librenms for communication with RRD cached + # -- Timezone used by librenms for communication with RRD cached timezone: UTC - # Custom configuration options for LibreNMS. Fore more infomation on options + # -- Custom configuration options for LibreNMS. Fore more infomation on options # in this file check the following link: # https://docs.librenms.org/Support/Configuration/ - configuration: |- + configuration: | $config['distributed_poller_group'] = '0'; $config['distributed_poller'] = true; - - # Frontend container configurations options frontend: + # -- Frontend replicas replicas: 1 readinessProbe: httpGet: + # -- Check endpoint path path: /login + # -- Check endpoint port port: 8000 initialDelaySeconds: 30 periodSeconds: 60 timeoutSeconds: 10 + # -- resources defines the computing resources (CPU and memory) + # that are allocated to the containers running within the Pod. 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:'. # requests: # cpu: 50m # memory: 150M # Distributed poller container configurations options poller: + # -- Poller replicas replicas: 2 + # -- resources defines the computing resources (CPU and memory) + # that are allocated to the containers running within the Pod. resources: {} # requests: # cpu: 500m # memory: 200M - # SNMP network discovery scanner cron job. This job is optional and only use - # when having snmp network discovery enabled. For this to work either set the + # -- SNMP network discovery scanner cron job. This job is optional and only use + # when having snmp network discovery enabled. For this to work either set the # 'nets' confifuration in the custom config on in the admin interface - # See the following link for more information: + # See the following link for more information: # https://docs.librenms.org/Extensions/Auto-Discovery/ snmp_scanner: + # -- SNMP scanner enabled enabled: false + # -- SNMP scanner cornjob syntac interval cron: 15 * * * * + # -- resources defines the computing resources (CPU and memory) + # that are allocated to the containers running within the Pod. resources: {} # requests: # cpu: 500m # memory: 200M # Extra environment variable for LibreNMS SNMP scanner container + # -- SNMP scanner extra envs extraEnvs: {} # Extra environment variable for LibreNMS container + # -- LibreNMS frontend extra envs extraEnvs: {} - # RRD cached is the tool that allows for distributed polling and is mandatory - # in this LibreNMS helm chart. See the rrdcached documentation for more + # -- RRD cached is the tool that allows for distributed polling and is mandatory + # in this LibreNMS helm chart. See the rrdcached documentation for more # information: https://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html rrdcached: image: + # -- repository is the image repository to pull from. repository: crazymax/rrdcached + # -- tag is image tag to pull. tag: 1.8.0 persistence: + # -- RRDCached persistent volume enabled enabled: true journal: + # -- RRDCached journal PV size size: 1Gi rrdcached: + # -- RRDCached RRD storage PV size size: 10Gi + # -- resources defines the computing resources (CPU and memory) + # that are allocated to the containers running within the Pod. resources: {} # requests: # cpu: 100m # memory: 500M livenessProbe: + # -- RRD cached liveness probe tcpSocket: port: 42217 initialDelaySeconds: 15 periodSeconds: 20 envs: + # -- env variables RRD Cached - name: TZ value: "Europe/Amsterdam" - name: WRITE_JITTER @@ -94,10 +120,10 @@ librenms: - name: WRITE_TIMEOUT value: '1800' - # Extra environment variable for RRDCACHED container + # -- Extra environment variable for RRDCACHED container extraEnvs: {} -# Configuration for MySQL dependency chart by Bitnami. See their chart for +# -- Configuration for MySQL dependency chart by Bitnami. See their chart for # more information: https://github.com/bitnami/charts/tree/master/bitnami/mysql mysql: enabled: true @@ -105,7 +131,7 @@ mysql: username: librenms database: librenms -# Configuration for redis dependency chart by Bitnami. See their chart for +# -- Configuration for redis dependency chart by Bitnami. See their chart for # more information: https://github.com/bitnami/charts/tree/master/bitnami/redis redis: enabled: true @@ -119,4 +145,4 @@ redis: master: disableCommands: [] - architecture: standalone \ No newline at end of file + architecture: standalone diff --git a/ct.yaml b/ct.yaml new file mode 100644 index 0000000..5a92a21 --- /dev/null +++ b/ct.yaml @@ -0,0 +1,9 @@ +remote: origin +validate-maintainers: false +target-branch: main +chart-repos: + - librenms=https://www.librenms.org/helm-charts/ + - bitnami=https://charts.bitnami.com/bitnami/ +helm-extra-args: --timeout 800s +chart-dirs: + - charts \ No newline at end of file diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..5db72dd --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended" + ] +}