[modem-stats] migrate to common (#823)

* [modem-stats] migrate to common

Signed-off-by: Nicholas Wilde <ncwilde43@gmail.com>

* Added influxdb dependency

Signed-off-by: Nicholas Wilde <ncwilde43@gmail.com>

* Removed influxdb dependency

Signed-off-by: Nicholas Wilde <ncwilde43@gmail.com>

Co-authored-by: ᗪєνιη ᗷυнʟ <onedr0p@users.noreply.github.com>
This commit is contained in:
nιcнolaѕ wιlde 2021-04-25 08:00:43 -07:00 committed by GitHub
parent 2a88f60800
commit c2a547db04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 129 additions and 173 deletions

View File

@ -1,16 +1,20 @@
apiVersion: v2 apiVersion: v2
name: modem-stats name: modem-stats
version: 3.0.3 version: 4.0.0
appVersion: 1.0.0 appVersion: 1.0.0
description: periodic cable modem data collection and save the results to InfluxDB description: periodic cable modem data collection and save the results to InfluxDB
keywords: keywords:
- sb6183 - sb6183
- influxdb - influxdb
home: https://github.com/k8s-at-home/charts/tree/master/charts/stable/modem-stats home: https://github.com/k8s-at-home/charts/tree/master/charts/stable/modem-stats
icon: https://i.imgur.com/NprLyFf.png icon: https://i.imgur.com/NprLyFf.png
sources: sources:
- https://github.com/k8s-at-home/SB6183-stats-for-influxdb - https://github.com/k8s-at-home/SB6183-stats-for-influxdb
- https://github.com/k8s-at-home/charts - https://github.com/k8s-at-home/charts
maintainers: maintainers:
- name: billimek - name: billimek
email: jeff@billimek.com email: jeff@billimek.com
dependencies:
- name: common
repository: https://library-charts.k8s-at-home.com
version: 2.3.1

View File

@ -1,6 +1,6 @@
# modem-stats # modem-stats
![Version: 3.0.3](https://img.shields.io/badge/Version-3.0.3-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square) ![Version: 4.0.0](https://img.shields.io/badge/Version-4.0.0-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square)
periodic cable modem data collection and save the results to InfluxDB periodic cable modem data collection and save the results to InfluxDB
@ -17,6 +17,7 @@ periodic cable modem data collection and save the results to InfluxDB
| Repository | Name | Version | | Repository | Name | Version |
|------------|------|---------| |------------|------|---------|
| https://library-charts.k8s-at-home.com | common | 2.3.1 |
## TL;DR ## TL;DR
@ -75,20 +76,16 @@ The configuration is set as a block of text through a configmap and mouted as a
| Key | Type | Default | Description | | Key | Type | Default | Description |
|-----|------|---------|-------------| |-----|------|---------|-------------|
| config.delay | int | `3600` | how many seconds to wait between checks | | config | string | string | modem-stats' config.ini configuration |
| config.influxdb.database | string | `"cable_modem_stats"` | InfluxDB database | | env | object | `{}` | |
| config.influxdb.host | string | `"influxdb-influxdb"` | InfluxDB hostname | | image.pullPolicy | string | `"IfNotPresent"` | |
| config.influxdb.port | int | `8086` | InfluxDB port | | image.repository | string | `"billimek/sb6183-for-influxdb"` | |
| config.influxdb.ssl | bool | `false` | InfluxDB connection using SSL | | image.tag | string | `"latest"` | |
| config.modem.url | string | `"http://192.168.100.1/RgConnect.asp"` | sb6183 stats URL page | | probes.liveness.enabled | bool | `false` | |
| debug | bool | `false` | Display debugging output | | probes.readiness.enabled | bool | `false` | |
| image.pullPolicy | string | `"IfNotPresent"` | modem-stats image pull policy | | probes.startup.enabled | bool | `false` | |
| image.repository | string | `"billimek/sb6183-for-influxdb"` | modem-stats image | | service.enabled | bool | `false` | |
| image.tag | string | `"latest"` | modem-stats image tag | | strategy.type | string | `"Recreate"` | |
| nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | Key-value pairs to add as pod annotations |
| replicaCount | int | `1` | |
| resources | object | `{}` | |
## Changelog ## Changelog
@ -96,6 +93,20 @@ 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).
### [4.0.0]
#### Added
- N/A
#### Changed
- **BREAKING** Migrate to the common library, a lot of configuration has changed.
#### Removed
- N/A
### [3.0.1] ### [3.0.1]
#### Added #### Added
@ -110,6 +121,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- N/A - N/A
[4.0.0]: #4.0.0
[3.0.1]: #3.0.1 [3.0.1]: #3.0.1
## Support ## Support
@ -120,4 +132,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Join our [Discord](https://discord.gg/sTMX7Vh) community - Join our [Discord](https://discord.gg/sTMX7Vh) community
---------------------------------------------- ----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0) Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)

View File

@ -9,6 +9,20 @@ 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).
### [4.0.0]
#### Added
- N/A
#### Changed
- **BREAKING** Migrate to the common library, a lot of configuration has changed.
#### Removed
- N/A
### [3.0.1] ### [3.0.1]
#### Added #### Added
@ -23,5 +37,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- N/A - N/A
[4.0.0]: #4.0.0
[3.0.1]: #3.0.1 [3.0.1]: #3.0.1
{{- end -}} {{- end -}}

View File

@ -1,7 +1 @@
You can connect to the container running modem-stats. To open a shell session in the pod run the following: {{- include "common.notes.defaultNotes" . -}}
- kubectl exec -i -t --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "modem-stats.fullname" . }} -o jsonpath='{.items[0].metadata.name}') /bin/sh
To trail the logs for the modem-stats pod run the following:
- kubectl logs -f --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "modem-stats.fullname" . }} -o jsonpath='{ .items[0].metadata.name }')

View File

@ -1,27 +0,0 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "modem-stats.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 "modem-stats.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 -}}

View File

@ -0,0 +1,32 @@
---
{{/* Make sure all variables are set properly */}}
{{- include "common.values.setup" . }}
{{/* Append the configMap to the additionalVolumes */}}
{{- define "modem-stats.configmap.volume" -}}
name: modem-stats-settings
configMap:
name: {{ template "common.names.fullname" . }}-config
{{- end -}}
{{- $volume := include "modem-stats.configmap.volume" . | fromYaml -}}
{{- if $volume -}}
{{- $additionalVolumes := append .Values.additionalVolumes $volume }}
{{- $_ := set .Values "additionalVolumes" (deepCopy $additionalVolumes) -}}
{{- end -}}
{{/* Append the configMap volume to the additionalVolumeMounts */}}
{{- define "modem-stats.configmap.volumeMount" -}}
name: modem-stats-settings
mountPath: /src/config.ini
subPath: config.ini
{{- end -}}
{{- $volumeMount := include "modem-stats.configmap.volumeMount" . | fromYaml -}}
{{- if $volumeMount -}}
{{- $additionalVolumeMounts := append .Values.additionalVolumeMounts $volumeMount }}
{{- $_ := set .Values "additionalVolumeMounts" (deepCopy $additionalVolumeMounts) -}}
{{- end -}}
{{/* Render the templates */}}
{{ include "common.all" . }}

View File

@ -1,31 +1,10 @@
---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: {{ template "modem-stats.fullname" . }} name: {{ template "common.names.fullname" . }}-config
labels: labels:
app: {{ template "modem-stats.name" . }} {{- include "common.labels" . | nindent 4 }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
data: data:
config.ini: | config.ini: |
[GENERAL] {{- .Values.config | nindent 4 }}
Delay = {{ .Values.config.delay }}
{{- if .Values.debug }}
Output = True
{{- else }}
Output = False
{{- end }}
[INFLUXDB]
Address = {{ .Values.config.influxdb.host }}
Port = {{ .Values.config.influxdb.port }}
Database = {{ .Values.config.influxdb.database }}
Username = {{ .Values.config.influxdb.username }}
Password = {{ .Values.config.influxdb.password }}
{{- if .Values.config.influxdb.ssl }}
Verify_SSL = True
{{- else }}
Verify_SSL = False
{{- end }}
[MODEM]
URL = {{ .Values.config.modem.url }}

View File

@ -1,49 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "modem-stats.fullname" . }}
labels:
app: {{ template "modem-stats.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
selector:
matchLabels:
app: {{ template "modem-stats.name" . }}
release: {{ .Release.Name }}
replicas: {{ default 1 .Values.replicas }}
revisionHistoryLimit: 3
template:
metadata:
labels:
app: {{ template "modem-stats.name" . }}
release: {{ .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 }}
resources:
{{ toYaml .Values.resources | indent 12 }}
volumeMounts:
- name: {{ template "modem-stats.name" . }}
mountPath: /src/config.ini
subPath: config.ini
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
volumes:
- name: {{ template "modem-stats.name" . }}
configMap:
name: {{ template "modem-stats.fullname" . }}
items:
- key: config.ini
path: config.ini

View File

@ -1,48 +1,44 @@
# Default values for modem-stats. #
# This is a YAML-formatted file. # IMPORTANT NOTE
# Declare variables to be passed into your templates. #
replicaCount: 1 # This chart inherits from our common library chart. You can check the default values/options here:
# https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common/values.yaml
#
image: image:
# -- modem-stats image
repository: billimek/sb6183-for-influxdb repository: billimek/sb6183-for-influxdb
# -- modem-stats image tag
tag: latest tag: latest
# -- modem-stats image pull policy
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
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
nodeSelector: {}
# -- Display debugging output
debug: false
config:
# -- how many seconds to wait between checks
delay: 3600
influxdb:
# -- InfluxDB hostname
host: influxdb-influxdb
# -- InfluxDB port
port: 8086
# -- InfluxDB database
database: cable_modem_stats
# -- InfluxDB username
# username:
# -- InfluxDB password
# password:
# -- InfluxDB connection using SSL strategy:
ssl: false type: Recreate
modem:
# -- sb6183 stats URL page
url: http://192.168.100.1/RgConnect.asp
# -- Key-value pairs to add as pod annotations env: {}
podAnnotations: {}
# -- modem-stats' config.ini configuration
# @default -- string
config: |
[GENERAL]
Delay = 3600
Output = False
[INFLUXDB]
Address = influxdb-influxdb
Port = 8086
Database = cable_modem_stats
Username =
Password =
Verify_SSL = False
[MODEM]
URL = http://192.168.100.1/RgConnect.asp
service:
enabled: false
## Probes configuration
probes:
liveness:
enabled: false
readiness:
enabled: false
startup:
enabled: false