fix templating and values

This commit is contained in:
ducoterra
2020-11-27 15:41:15 -05:00
parent 6541f3aebb
commit d0c0b9d983
8 changed files with 9 additions and 26 deletions

23
helm/.helmignore Normal file
View File

@@ -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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

23
helm/Chart.yaml Normal file
View File

@@ -0,0 +1,23 @@
apiVersion: v2
name: helm
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.16.0

View File

@@ -0,0 +1,93 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ .Release.Name }}
spec:
containers:
{{ if .Values.glances }}
- name: glances
image: hub.ducoterra.net/ducoterra/glances:latest
ports:
- containerPort: 61208
resources:
requests:
memory: 128Mi
cpu: 250m
limits:
memory: 512Mi
cpu: 500m
{{ end }}
{{ if .Values.iperf }}
- name: iperf
image: hub.ducoterra.net/ducoterra/iperf:latest
tty: true
stdin: true
ports:
- containerPort: 5201
resources:
requests:
memory: 128Mi
cpu: 250m
limits:
memory: 512Mi
cpu: 500m
{{ end }}
{{ if .Values.disk }}
- name: disk
image: debian:latest
command: ["sleep", "infinity"]
resources:
requests:
memory: 128Mi
cpu: 250m
limits:
memory: 512Mi
cpu: 500m
volumeMounts:
- mountPath: /tmp/hdd
name: hdd
- mountPath: /tmp/nvme
name: nvme
{{ end }}
{{ if .Values.stress }}
- name: stress
image: hub.ducoterra.net/ducoterra/stress:latest
resources:
requests:
memory: 128Mi
cpu: 250m
limits:
memory: 512Mi
cpu: {{ .Values.stress_cpu | quote }}
{{ end }}
{{ if .Values.exporter }}
- name: exporter
image: hub.ducoterra.net/ducoterra/glances:latest
command: ["glances", "--export", "statsd"]
tty: true
resources:
requests:
memory: 1Mi
cpu: 1m
limits:
memory: 512Mi
cpu: 250m
{{ end }}
{{ if .Values.disk }}
volumes:
- name: hdd
persistentVolumeClaim:
claimName: hdd-{{ .Release.Name }}
- name: nvme
persistentVolumeClaim:
claimName: nvme-{{ .Release.Name }}
{{ end }}

View File

@@ -0,0 +1,41 @@
{{ if .Values.glances }}
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: {{ .Release.Name }}-internal-tls
annotations:
kubernetes.io/ingress.class: traefik-internal
spec:
entryPoints:
- websecure
tls:
certResolver: myresolver
domains:
- main: "*.ducoterra.net"
routes:
- match: Host(`{{ .Release.Name }}.ducoterra.net`)
kind: Rule
services:
- name: {{ .Release.Name }}-glances
port: 61208
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: {{ .Release.Name }}-internal-web
annotations:
kubernetes.io/ingress.class: traefik-internal
spec:
entryPoints:
- web
routes:
- match: Host(`{{ .Release.Name }}.ducoterra.net`)
kind: Rule
services:
- name: {{ .Release.Name }}-glances
port: 61208
middlewares:
- name: httpsredirect
{{ end }}

25
helm/templates/pvc.yaml Normal file
View File

@@ -0,0 +1,25 @@
{{ if .Values.disk }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: hdd-{{ .Release.Name }}
spec:
storageClassName: freenas-nfs-hdd
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 16Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nvme-{{ .Release.Name }}
spec:
storageClassName: freenas-nfs-nvme
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 16Gi
{{ end }}

View File

@@ -0,0 +1,28 @@
{{ if .Values.glances }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-glances
spec:
selector:
app: {{ .Release.Name }}
ports:
- port: 61208
targetPort: 61208
{{ end }}
---
{{ if .Values.iperf }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-iperf
spec:
selector:
app: {{ .Release.Name }}
ports:
- port: 5201
targetPort: 5201
externalIPs:
- 6.0.22.1
type: LoadBalancer
{{ end }}

7
helm/values.yaml Normal file
View File

@@ -0,0 +1,7 @@
image: hub.ducoterra.net/ducoterra/temp:0.0.10
glances: true
iperf: true
disk: true
stress: true
stress_cpu: "48"
exporter: true