Skip to content

Commit

Permalink
last pre-clean commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tpboudreau committed Dec 17, 2019
1 parent 4598592 commit e7b3fb0
Show file tree
Hide file tree
Showing 26 changed files with 276 additions and 46 deletions.
2 changes: 1 addition & 1 deletion build.d/console.d/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM alpine:latest

RUN apk update && \
apk upgrade && \
apk add --no-cache bind-tools curl libmemcached mariadb-client net-snmp-tools redis rrdtool wget
apk add --no-cache bash bind-tools curl libmemcached mariadb-client net-snmp-tools redis rrdtool wget

COPY commands /
COPY environment.sh /.profile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ RUN apk update && \
COPY snmpd.conf.template .

#RUN COMMUNITY=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16) envsubst < snmpd.conf.template > /tmp/snmpd.conf && \

RUN COMMUNITY=librenmsdevice envsubst < snmpd.conf.template > /tmp/snmpd.conf && \
RUN COMMUNITY=librenmsDevice envsubst < snmpd.conf.template > /tmp/snmpd.conf && \
curl -o /tmp/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro

#===============================================================================
Expand Down
2 changes: 0 additions & 2 deletions build.d/device.d/build.sh → build.d/device.d/v2c/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/bash

#docker build -t tpboudreau/librenms-device .

docker build -t tpboudreau/librenms-device-v2c:0.1 .

File renamed without changes.
6 changes: 3 additions & 3 deletions build.d/device.d/v3/snmpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ agentAddress udp:161
# Then restart the agent

# createUser authOnlyUser MD5 "remember to change this password"
createUser librenmsAP SHA "authpassword" DES "privpassword"
createUser librenmsAnP SHA "authpassword"
createUser librenmsAP SHA "authPassword" DES "privPassword"
createUser librenmsAnP SHA "authPassword"
createUser librenmsnAnP
createUser internalUser MD5 "internalpassword"
createUser internalUser MD5 "internalPassword"

# If you also change the usernames (which might be sensible),
# then remember to update the other occurances in this example config file to match.
Expand Down
89 changes: 89 additions & 0 deletions release.d/install.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@

For temporary databases:

kubectl create namespace librenms-temporary

helm install \
--generate-name \
--values values.yaml \
--namespace librenms-temporary \
--set librenmsServices.mysql.storage.type=temporary \
--set librenmsServices.rrdcached.storage.type=temporary \
--set librenmsServices.redis.storage.type=temporary \
librenms

helm list --namespace librenms-temporary

...

helm uninstall librenms-$RELEASE_ID --namespace librenms-temporary

kubectl delete namespace librenms-temporary

----------------------------------------------------------------------------------------------------------------

For databases backed by pre-configured persistent volume claims (the default):

kubectl create namespace librenms

helm install \
--generate-name \
--values values.yaml \
--namespace librenms \
--set librenmsServices.mysql.storage.claimName=$MYSQL_PVC_NAME \
--set librenmsServices.rrdcached.storage.claimName=$RRDCACHED_PVC_NAME \
--set librenmsServices.redis.storage.claimName=$REDIS_PVC_NAME \
librenms

helm list --namespace librenms

...

helm uninstall $GENERATED_NAME --namespace librenms

kubectl delete namespace librenms

----------------------------------------------------------------------------------------------------------------

For databases running outside the Kubernetes cluster ...

kubectl create namespace librenms

helm install \
--generate-name \
--values values.yaml \
--namespace librenms \
--set librenmsServices.mysql.external.enabled=true,librenmsServices.mysql.external.address=$MYSQL_IP_ADDRESS,librenmsServices.mysql.external.port=$MYSQL_PORT \
--set librenmsServices.rrdcached.external.enabled=true,librenmsServices.rrdcached.external.address=$RRDCACHED_IP_ADDRESS,librenmsServices.rrdcached.external.port=$RRDCACHED_PORT \
--dry-run \
librenms

helm list --namespace librenms

...

helm uninstall $GENERATED_NAME --namespace librenms

kubectl delete namespace librenms

----------------------------------------------------------------------------------------------------------------

For running the application in a Kubernetes cluster that forbids setuid / set-cap binaries ...

kubectl create namespace librenms

helm install \
--generate-name \
--values values.yaml \
--namespace librenms \
--set snmpPing.enabled=true \
librenms

helm list --namespace librenms

...

helm uninstall $GENERATED_NAME --namespace librenms

kubectl delete namespace librenms

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Pod
metadata:
namespace: {{ .Values.Namespace }}
namespace: {{ .Release.Namespace }}
name: test-console
labels:
application: librenms
Expand Down
2 changes: 0 additions & 2 deletions release.d/librenms-test-console/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

Namespace: "librenms"

image:
repository: "docker.io/tpboudreau/librenms-console"
tag: "0.1"
Expand Down
4 changes: 2 additions & 2 deletions release.d/librenms-test-device/templates/test-device.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: Service
metadata:
namespace: {{ $.Values.Namespace }}
namespace: {{ $.Release.Namespace }}
name: {{ .DeviceName }}
spec:
clusterIP: None
Expand All @@ -21,7 +21,7 @@ spec:
apiVersion: v1
kind: Pod
metadata:
namespace: {{ $.Values.Namespace }}
namespace: {{ $.Release.Namespace }}
name: {{ .DeviceName }}
labels:
application: librenms
Expand Down
18 changes: 8 additions & 10 deletions release.d/librenms-test-device/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

Namespace: "librenms"

image:
repositoryRoot: "docker.io/tpboudreau/librenms-device"
tag: "0.1"
Expand All @@ -10,16 +8,16 @@ Devices:
SNMPVersion: "v2c"
- DeviceName: "test-device-one"
SNMPVersion: "v2c"
#- DeviceName: "test-device-two"
# SNMPVersion: "v2c"
#- DeviceName: "test-device-three"
# SNMPVersion: "v2c"
- DeviceName: "test-device-two"
SNMPVersion: "v2c"
- DeviceName: "test-device-three"
SNMPVersion: "v2c"
- DeviceName: "test-device-alpha"
SNMPVersion: "v3"
- DeviceName: "test-device-beta"
SNMPVersion: "v3"
#- DeviceName: "test-device-gamma"
# SNMPVersion: "v3"
#- DeviceName: "test-device-delta"
# SNMPVersion: "v3"
- DeviceName: "test-device-gamma"
SNMPVersion: "v3"
- DeviceName: "test-device-delta"
SNMPVersion: "v3"

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
name: librenms-services
name: librenmsServices
description: LibreNMS supporting services
type: application
version: 0.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "librenms-services.name" -}}
{{- define "librenmsServices.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

Expand All @@ -11,7 +11,7 @@ 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-services.fullname" -}}
{{- define "librenmsServices.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
Expand All @@ -27,16 +27,16 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "librenms-services.chart" -}}
{{- define "librenmsServices.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "librenms-services.labels" -}}
helm.sh/chart: {{ include "librenms-services.chart" . }}
{{ include "librenms-services.selectorLabels" . }}
{{- define "librenmsServices.labels" -}}
helm.sh/chart: {{ include "librenmsServices.chart" . }}
{{ include "librenmsServices.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -46,17 +46,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "librenms-services.selectorLabels" -}}
app.kubernetes.io/name: {{ include "librenms-services.name" . }}
{{- define "librenmsServices.selectorLabels" -}}
app.kubernetes.io/name: {{ include "librenmsServices.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "librenms-services.serviceAccountName" -}}
{{- define "librenmsServices.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "librenms-services.fullname" .) .Values.serviceAccount.name }}
{{ default (include "librenmsServices.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ metadata:
name: mysql
subsets:
- addresses:
- ip: {{ required "the external MySQL database address must be provided (mysql.external.address)" .Values.mysql.external.address }}
- ip: {{ required "the external MySQL database address must be provided (librenmsServices.mysql.external.address)" .Values.mysql.external.address }}
ports:
- name: mysql
port: {{ .Values.mysql.external.port }}
Expand Down Expand Up @@ -110,6 +110,11 @@ spec:
containerPort: {{ .Values.mysql.providerPort }}
protocol: TCP
volumes:
- name: mysql-volume
emptyDir: {}
- name: mysql-volume
{{- if eq .Values.mysql.storage.type "temporary" }}
emptyDir: {}
{{- else }}
persistentVolumeClaim:
claimName: {{ required "the name of the pre-configured MySQL persistent volume claim must be provided (librenmsServices.mysql.storage.claimName)" .Values.mysql.storage.claimName }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
containers:
- name: prepare-database
image: {{ .Values.mysql.prepareDatabaseImage.repository }}:{{ .Values.mysql.prepareDatabaseImage.tag }}
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
envFrom:
- configMapRef:
name: application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,9 @@ spec:
protocol: TCP
volumes:
- name: redis-volume
{{- if eq .Values.redis.storage.type "temporary" }}
emptyDir: {}
{{- else }}
persistentVolumeClaim:
claimName: {{ required "the name of the pre-configured Redis persistent volume claim must be provided (librenmsServices.redis.storage.claimName)" .Values.redis.storage.claimName }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ metadata:
name: rrdcached
subsets:
- addresses:
- ip: {{ required "the external rrdcached server address must be provided (rrdcached.external.address)" .Values.rrdcached.external.address }}
- ip: {{ required "the external RRDCached server address must be provided (librenmsServices.rrdcached.external.address)" .Values.rrdcached.external.address }}
ports:
- name: rrdcached
port: {{ .Values.rrdcached.external.port }}
Expand Down Expand Up @@ -76,5 +76,10 @@ spec:
protocol: TCP
volumes:
- name: rrdcached-volume
{{- if eq .Values.rrdcached.storage.type "temporary" }}
emptyDir: {}
{{- else }}
persistentVolumeClaim:
claimName: {{ required "the name of the pre-configured RRDCached persistent volume claim must be provided (librenmsServices.rrdcached.storage.claimName)" .Values.rrdcached.storage.claimName }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ mysql:
prepareDatabaseImage:
repository: "docker.io/tpboudreau/librenms-prepare-mysql"
tag: "0.1"
storage:
type: persistent
external:
enabled: false
#address: "12.34.56.78"
address:
port: 3306

rrdcached:
Expand All @@ -29,9 +31,11 @@ rrdcached:
image:
repository: "docker.io/tpboudreau/librenms-rrdcached"
tag: "0.1"
storage:
type: persistent
external:
enabled: false
#address: "12.34.56.78"
address:
port: 42217

memcached:
Expand All @@ -51,4 +55,6 @@ redis:
image:
repository: "docker.io/tpboudreau/librenms-redis"
tag: "0.1"
storage:
type: persistent

8 changes: 4 additions & 4 deletions release.d/librenms/templates/_checks.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- define "librenms.checks" }}
- name: check-mysql
image: {{ .Values.checkMySQL.image.repository }}:{{ .Values.checkMySQL.image.tag }}
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
envFrom:
- configMapRef:
name: application
Expand All @@ -18,19 +18,19 @@
key: librenms_mysql_password
- name: check-rrdcached
image: {{ .Values.checkRRDcached.image.repository }}:{{ .Values.checkRRDcached.image.tag }}
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
envFrom:
- configMapRef:
name: application
- name: check-memcached
image: {{ .Values.checkMemcached.image.repository }}:{{ .Values.checkMemcached.image.tag }}
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
envFrom:
- configMapRef:
name: application
- name: check-redis
image: {{ .Values.checkRedis.image.repository }}:{{ .Values.checkRedis.image.tag }}
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
envFrom:
- configMapRef:
name: application
Expand Down
Loading

0 comments on commit e7b3fb0

Please sign in to comment.