diff --git a/comcast/templates/deployment.yaml b/comcast/templates/deployment.yaml index 04a8c041..491496cf 100644 --- a/comcast/templates/deployment.yaml +++ b/comcast/templates/deployment.yaml @@ -1,5 +1,4 @@ apiVersion: extensions/v1beta1 -#apiVersion: apps/v1beta2 kind: Deployment metadata: name: {{ template "comcast.fullname" . }} diff --git a/modem-stats/.helmignore b/modem-stats/.helmignore new file mode 100644 index 00000000..a9fe7278 --- /dev/null +++ b/modem-stats/.helmignore @@ -0,0 +1,23 @@ +# 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 +# OWNERS file for Kubernetes +OWNERS \ No newline at end of file diff --git a/modem-stats/Chart.yaml b/modem-stats/Chart.yaml new file mode 100644 index 00000000..eb1684bb --- /dev/null +++ b/modem-stats/Chart.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +name: modem-stats +version: 1.0.0 +appVersion: 1.0.0 +description: periodic cable modem data collection and save the results to InfluxDB +keywords: +- sb6183 +- influxdb +home: https://github.com/billimek/SB6183-stats-for-influxdb +sources: +- https://github.com/billimek/SB6183-stats-for-influxdb +- https://github.com/billimek/billimek-charts +maintainers: +- name: billimek + email: jeff@billimek.com \ No newline at end of file diff --git a/modem-stats/OWNERS b/modem-stats/OWNERS new file mode 100644 index 00000000..51f88652 --- /dev/null +++ b/modem-stats/OWNERS @@ -0,0 +1,4 @@ +approvers: +- billimek +reviewers: +- billimek \ No newline at end of file diff --git a/modem-stats/README.md b/modem-stats/README.md new file mode 100644 index 00000000..47b1a9e1 --- /dev/null +++ b/modem-stats/README.md @@ -0,0 +1,68 @@ +# cable modem (sb6183) signal and stats collection agent for influxdb + +![Screenshot](https://camo.githubusercontent.com/939e044c0491abf790d91bd1d7f909b187e4098c/68747470733a2f2f692e696d6775722e636f6d2f70705a6a6e6b502e706e67) + +This tool allows you to run periodic scanning of the sb6183 cable modem and save the results to Influxdb + +## TL;DR; + +```console +$ helm repo add billimek https://raw.githubusercontent.com/billimek/helm-repo/master +$ helm install billimek/modem-stats +``` + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```console +$ helm install --name my-release billimek/modem-stats +``` +## 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 + +The configuration is set as a block of text through a configmap and mouted as a file in /src/config.ini Any value in this text block should match the defined sb6183 configuration. There are several values here that will have to match our kubernetes configuration. + +## Configuration + +The following tables lists the configurable parameters of the Sentry chart and their default values. + +| Parameter | Description | Default | +| ------------------------------- | ------------------------------- | ---------------------------------------------------------- | +| `image.repository` | modem-stats image | `billimek/sb6183-for-influxdb` | +| `image.tag` | modem-stats image tag | `latest` | +| `image.pullPolicy` | modem-stats image pull policy | `IfNotPresent` | +| `debug` | Display debugging output | `false` | +| `config.delay` | how many seconds to wait between checks | `3600` | +| `config.influxdb.host` | InfluxDB hostname | `influxdb-influxdb` | +| `config.influxdb.port` | InfluxDB port | `8086` | +| `config.influxdb.database` | InfluxDB database | `sb6183` | +| `config.influxdb.username` | InfluxDB username | `` | +| `config.influxdb.password` | InfluxDB password | `` | +| `config.influxdb.ssl` | InfluxDB connection using SSL | `false` | +| `config.modem.url` | sb6183 stats URL page | `http://192.168.100.1/RgConnect.asp` | + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +$ helm install --name my-release \ + --set onfig.influxdb.host=some-influx-host \ + billimek/modem-stats +``` + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, + +```console +$ helm install --name my-release -f values.yaml billimek/modem-stats +``` + +Read through the [values.yaml](values.yaml) file. It has several commented out suggested values. diff --git a/modem-stats/templates/NOTES.txt b/modem-stats/templates/NOTES.txt new file mode 100644 index 00000000..1c97324f --- /dev/null +++ b/modem-stats/templates/NOTES.txt @@ -0,0 +1,7 @@ +You can connect to the container running modem-stats. To open a shell session in the pod run the following: + +- 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 }') \ No newline at end of file diff --git a/modem-stats/templates/_helpers.tpl b/modem-stats/templates/_helpers.tpl new file mode 100644 index 00000000..88ca0c51 --- /dev/null +++ b/modem-stats/templates/_helpers.tpl @@ -0,0 +1,27 @@ +{{/* 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 -}} \ No newline at end of file diff --git a/modem-stats/templates/configmap.yaml b/modem-stats/templates/configmap.yaml new file mode 100644 index 00000000..4f3ddedc --- /dev/null +++ b/modem-stats/templates/configmap.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "modem-stats.fullname" . }} + labels: + app: {{ template "modem-stats.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +data: + config.ini: | + [GENERAL] + 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 }} \ No newline at end of file diff --git a/modem-stats/templates/deployment.yaml b/modem-stats/templates/deployment.yaml new file mode 100644 index 00000000..11ef04d7 --- /dev/null +++ b/modem-stats/templates/deployment.yaml @@ -0,0 +1,42 @@ +apiVersion: extensions/v1beta1 +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 }} + template: + metadata: + labels: + app: {{ template "modem-stats.name" . }} + release: {{ .Release.Name }} + 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 \ No newline at end of file diff --git a/modem-stats/values.yaml b/modem-stats/values.yaml new file mode 100644 index 00000000..29e2bc75 --- /dev/null +++ b/modem-stats/values.yaml @@ -0,0 +1,34 @@ +# Default values for modem-stats. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +replicaCount: 1 +image: + repository: billimek/sb6183-for-influxdb + tag: latest + 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: {} +debug: false +config: + # how many seconds to wait between checks + delay: 3600 + influxdb: + # host/port/database are mandatory - change as needed + host: influxdb-influxdb + port: 8086 + database: cable_modem_stats + # username: + # password: + ssl: false + modem: + url: http://192.168.100.1/RgConnect.asp diff --git a/speedtest/templates/deployment.yaml b/speedtest/templates/deployment.yaml index aa8d7c8c..54d8cad1 100644 --- a/speedtest/templates/deployment.yaml +++ b/speedtest/templates/deployment.yaml @@ -1,5 +1,4 @@ apiVersion: extensions/v1beta1 -#apiVersion: apps/v1beta2 kind: Deployment metadata: name: {{ template "speedtest.fullname" . }}