[network-ups-tools] New chart (#431)

This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2020-12-24 12:51:18 +01:00 committed by GitHub
parent 7358653626
commit 1d0cce4146
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 216 additions and 0 deletions

View File

@ -0,0 +1,24 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode
# OWNERS file for Kubernetes
OWNERS

View File

@ -0,0 +1,20 @@
apiVersion: v2
appVersion: v2.7.4-2061-g46c7da76
description: Network UPS Tools is a collection of programs which provide a common interface for monitoring and administering UPS, PDU and SCD hardware.
name: network-ups-tools
version: 1.0.0
keywords:
- nut
- network-ups-tools
- ups
home: https://github.com/k8s-at-home/charts/tree/master/charts/network-ups-tools
icon: https://avatars0.githubusercontent.com/u/3526263?s=400&v=4
sources:
- https://github.com/networkupstools/nut
maintainers:
- name: billimek
email: jeff@billimek.com
dependencies:
- name: common
repository: https://k8s-at-home.com/charts/
version: 2.1.1

View File

@ -0,0 +1,8 @@
approvers:
- billimek
- onedr0p
- bjw-s
reviewers:
- billimek
- onedr0p
- bjw-s

View File

@ -0,0 +1,67 @@
# network-ups-tools
This is a helm chart for [network-ups-tools](https://github.com/networkupstools/nut).
**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)**
## TL;DR;
```shell
$ helm repo add k8s-at-home https://k8s-at-home.com/charts/
$ helm install k8s-at-home/network-ups-tools
```
## Installing the Chart
To install the chart with the release name `my-release`:
```console
helm install --name my-release k8s-at-home/network-ups-tools
```
## Uninstalling the Chart
To uninstall/delete the `my-release` deployment:
```console
helm delete my-release --purge
```
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/network-ups-tools/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 network-ups-tools \
--set env.TZ="America/New_York" \
k8s-at-home/network-ups-tools
```
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the
chart. For example,
```console
helm install network-ups-tools k8s-at-home/network-ups-tools --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.

View File

@ -0,0 +1,4 @@
config:
files:
dummy-ups.dev: |
ups.status: OL

View File

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

View File

@ -0,0 +1,36 @@
{{/* Make sure all variables are set properly */}}
{{- include "common.values.setup" . }}
{{/* Append the configMap to the additionalVolumes */}}
{{- define "network-ups-tools.configmap.volume" -}}
name: nut-config
configMap:
name: {{ template "common.names.fullname" . }}-config
defaultMode: 256
optional: true
{{- end -}}
{{- if eq .Values.config.mode "values" -}}
{{- $volume := include "network-ups-tools.configmap.volume" . | fromYaml -}}
{{- if $volume -}}
{{- $additionalVolumes := append .Values.additionalVolumes $volume }}
{{- $_ := set .Values "additionalVolumes" (deepCopy $additionalVolumes) -}}
{{- end -}}
{{- end -}}
{{/* Append the configMap volume to the additionalVolumeMounts */}}
{{- define "network-ups-tools.configmap.volumeMount" -}}
name: nut-config
mountPath: /etc/nut
{{- end -}}
{{- if eq .Values.config.mode "values" -}}
{{- $volumeMount := include "network-ups-tools.configmap.volumeMount" . | fromYaml -}}
{{- if $volumeMount -}}
{{- $additionalVolumeMounts := append .Values.additionalVolumeMounts $volumeMount }}
{{- $_ := set .Values "additionalVolumeMounts" (deepCopy $additionalVolumeMounts) -}}
{{- end -}}
{{- end -}}
{{/* Render the templates */}}
{{ include "common.all" . }}

View File

@ -0,0 +1,19 @@
{{- if eq .Values.config.mode "values" -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "common.names.fullname" . }}-config
labels:
{{- include "common.labels" . | nindent 4 }}
data:
{{- range $file, $content := .Values.config.files }}
{{ $file }}: |-
{{- $content | nindent 4}}
{{- end }}
{{- /* upsd.users is a required file, but can be empty */}}
{{- if not (hasKey .Values.config.files "upsd.users") }}
upsd.users: |-
# Required file, empty by default
{{- end }}
{{- end }}

View File

@ -0,0 +1,37 @@
# Default values for network-ups-tools.
image:
repository: k8sathome/network-ups-tools
tag: v2.7.4-2061-g46c7da76
pullPolicy: IfNotPresent
strategy:
type: Recreate
service:
port:
name: server
port: 3493
env: {}
# TZ: UTC
# The main configuration files for network-ups-tools
config:
# If set to 'values', the configuration will be read from these values.
# Otherwise you have to mount a volume to /etc/nut containing the configuration files.
mode: values
# See https://github.com/networkupstools/nut/tree/master/conf for config sample files
files:
nut.conf: |
MODE=netserver
upsd.conf: |
LISTEN 0.0.0.0
ups.conf: |
[dummy]
driver = dummy-ups
port = dummy-ups.dev
desc = "dummy-ups in dummy mode"