Add(Octoprint)

This commit is contained in:
nold 2022-07-27 13:55:46 +02:00
parent 9f0f2ccdad
commit 3b6fba85b2
9 changed files with 379 additions and 0 deletions

View file

@ -0,0 +1,26 @@
# 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
# helm-docs templates
*.gotmpl

View file

@ -0,0 +1,22 @@
apiVersion: v2
appVersion: 1.6.1
description: OctoPrint is the snappy web interface for your 3D printer
name: octoprint
version: 6.0.0
kubeVersion: ">=1.16.0-0"
keywords:
- octoprint
- 3d
- printer
home: https://github.com/k8s-at-home/charts/tree/master/charts/stable/octoprint
icon: https://avatars3.githubusercontent.com/u/5982294?s=400&v=4
sources:
- https://github.com/OctoPrint/OctoPrint
- https://hub.docker.com/r/octoprint/octoprint
maintainers:
- name: billimek
email: jeff@billimek.com
dependencies:
- name: common
repository: https://library-charts.k8s-at-home.com
version: 4.0.0

View file

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

View file

@ -0,0 +1,34 @@
{{/* Make sure all variables are set properly */}}
{{- include "common.values.setup" . }}
{{/* Append the configMap volume to the volumes */}}
{{- define "octoprint.init" -}}
enabled: "true"
mountPath: "/init.sh"
subPath: "init.sh"
type: "custom"
volumeSpec:
configMap:
name: {{ include "common.names.fullname" . }}-init
defaultMode: 0755
{{- end -}}
{{- define "octoprint.initContainer" -}}
name: init-octoprint
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: data
mountPath: /octoprint
- name: octoprint-init
mountPath: /init.sh
subPath: init.sh
command:
- sh
- -c
- /init.sh
{{- end -}}
{{- $_ := set .Values.persistence "octoprint-init" (include "octoprint.init" . | fromYaml) -}}
{{- $_ := set .Values.initContainers "octoprint-init" (include "octoprint.initContainer" . | fromYaml) -}}
{{/* Render the templates */}}
{{ include "common.all" . }}

View file

@ -0,0 +1,17 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "common.names.fullname" . }}-init
labels:
{{- include "common.labels" . | nindent 4 }}
data:
init.sh: |
#!/bin/bash
if ! octoprint --version 2>/dev/null ; then
cd; mkdir tmp; tar xzf ${octoprint_ref}.tar.gz --strip-components 1 -C tmp ; cd tmp; pip install .
fi
{{- if .Values.octoprint.plugins.install }}
{{- range .Values.octoprint.plugins.plugins }}
pip install{{if $.Values.octoprint.plugins.upgrade }} --upgrade{{ end }} {{.}}
{{- end }}
{{- end }}

View file

@ -0,0 +1,55 @@
{{- include "common.values.setup" . }}
{{- define "octoprint.streamer" -}}
name: webcam-streamer
{{- if .Values.mjpg_streamer.enabled }}
image: {{ .Values.mjpg_streamer.image | default "badsmoke/mjpg-streamer" }}:{{ .Values.mjpg_streamer.tag | default "latest" }}
imagePullPolicy: {{ .Values.mjpg_streamer.imagePullPolicy | default "IfNotPresent" }}
{{- else }}
image: {{ .Values.ustreamer.image | default "lib42/ustreamer" }}:{{ .Values.ustreamer.tag | default "latest" }}
imagePullPolicy: {{ .Values.ustreamer.imagePullPolicy | default "IfNotPresent" }}
{{- end }}
securityContext:
privileged: true
ports:
- name: http-stream
containerPort: 8080
protocol: TCP
command:
{{- if .Values.mjpg_streamer.enabled }}
- /mjpg-streamer/mjpg-streamer-experimental/docker-start.sh
- -i
- '"./input_uvc.so -u -d {{ .Values.streamer.device | default "/dev/video0"}} -r {{ .Values.streamer.resolution | default "640x480" }} -f {{.Values.mjpg_streamer.framerate | default 15}}"'
- -o
- '"./output_http.so -p {{ .Values.streamer.port | default 8080 }}"'
{{- else }}
- ./ustreamer
- --host=0.0.0.0
- --slowdown
- --drop-same-frames=30
- --device={{ .Values.streamer.device | default "/dev/video0" }}
- --encoder={{ .Values.streamer.encoder | default "CPU" }}
- --quality={{ .Values.streamer.quality | default 80 }}
- --port={{ .Values.streamer.port | default 8080 }}
- --desired-fps={{ .Values.streamer.fps | default 15 }}
- --format={{ .Values.streamer.format | default "YUYV" }}
- --resolution={{ .Values.streamer.resolution | default "640x480" }}
{{- end }}
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 10
failureThreshold: 3
timeoutSeconds: 1
periodSeconds: 10
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 10
failureThreshold: 3
timeoutSeconds: 1
periodSeconds: 10
{{- end -}}
{{- if or .Values.mjpg_streamer.enabled .Values.ustreamer.enabled -}}
{{- $_ := set .Values.additionalContainers "webcam-streamer" (include "octoprint.streamer" . | fromYaml) -}}
{{- end -}}

View file

@ -0,0 +1,128 @@
#
# IMPORTANT NOTE
#
# 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 repository
repository: octoprint/octoprint
# -- image tag
tag: 1.6.1-minimal
# -- image pull policy
pullPolicy: IfNotPresent
# -- environment variables.
# @default -- See below
env:
# -- Set the container timezone
TZ: UTC
# -- Configures service settings for the chart.
# @default -- See values.yaml
service:
main:
enabled: true
ports:
http:
port: 80
targetPort: 5000
# Webcam Stream
stream:
enabled: false
ports:
http-stream:
enabled: true
port: 80
targetPort: 8080
# Octoprint settings
octoprint:
# Octoprint Plugins
plugins:
# Install plugins before starting octoprint?
install: false
# Upgrade installed plugins?
upgrade: false
## List of plugins to install/upgrade
#plugins:
#- https://github.com/tg44/OctoPrint-Prometheus-Exporter/archive/master.zip
#- https://github.com/LazeMSS/OctoPrint-UICustomizer/archive/main.zip
#- https://github.com/NilsRo/OctoPrint-SlicerEstimator/archive/master.zip
# Webcam Streamer config for mjpg & ustreamer
# Requires to enable one of mjpg_streamer and ustreamer
streamer:
device: /dev/video0
resolution: 640x480
framerate: 15
port: 8080
resolution: 640x480
# ustreamer-only - YUYV, UYVY, RGB565, RGB24, MJPEG, JPEG; default: YUYV
format: YUYV
encoder: CPU
quality: 70
## Choose on of these if you want to stream a webcam feed:
# mjpg-streamer the old classic
mjpg_streamer:
enabled: false
image: badsmoke/mjpg-streamer
tag: latest
imagePullPolicy: IfNotPresent
# ustreamer - new, written in go
ustreamer:
enabled: false
image: lib42/ustreamer
tag: latest
imagePullPolicy: IfNotPresent
## Pod annotations e.g. for octoprint prometheus exporter
#podAnnotations:
# prometheus.io/scrape: "true"
# prometheus.io/port: "5000"
# prometheus.io/path: "/plugin/prometheus_exporter/metrics"
ingress:
# -- Enable and configure ingress settings for the chart under this key.
# @default -- See values.yaml
main:
enabled: false
#annotations:
# # Increased body-size lets you upload bigger gcode
# nginx.ingress.kubernetes.io/proxy-body-size: 100m
securityContext:
# -- (bool) Privileged securityContext may be required if USB devics are accessed directly through the host machine
privileged: true
# -- Configure persistence settings for the chart under this key.
# @default -- See values.yaml
persistence:
data:
enabled: false
mountPath: /octoprint
accessMode: ReadWriteOnce
size: 1Gi
# -- Configure a hostPathMount to mount a USB device in the container.
# @default -- See values.yaml
printer:
enabled: false
type: hostPath
hostPath: /dev/ttyACM0
# Device path of webcam
camera:
enabled: false
type: hostPath
hostPath: /dev/video0

View file

@ -0,0 +1,8 @@
config:
description: Octoprint 3D-Printer Server
apps:
- name: octoprint
repoURL: https://github.com/nold360/hive-apps
path: projects/octoprint/chart
targetRevision: main

View file

@ -0,0 +1,88 @@
USER-SUPPLIED VALUES:
env:
TZ: UTC
image:
pullPolicy: IfNotPresent
repository: octoprint/octoprint
tag: 1.8.1
ingress:
main:
annotations:
cert-manager.io/cluster-issuer: vault-issuer
nginx.ingress.kubernetes.io/proxy-body-size: 100m
traefik.ingress.kubernetes.io/router.tls: "true"
enabled: true
hosts:
- host: octo.dc
paths:
- path: /
pathType: Prefix
- path: /stream
pathType: Prefix
service:
name: octo2-octoprint-stream
port: 80
tls:
- hosts:
- octo.dc
secretName: octo-tls
mjpg_streamer:
enabled: false
image: badsmoke/mjpg-streamer
imagePullPolicy: IfNotPresent
tag: latest
octoprint:
plugins:
install: true
plugins:
- https://github.com/LazeMSS/OctoPrint-UICustomizer/archive/main.zip
- https://github.com/NilsRo/OctoPrint-SlicerEstimator/archive/master.zip
upgrade: true
persistence:
camera:
enabled: true
hostPath: /dev/video0
type: hostPath
data:
accessMode: ReadWriteOnce
enabled: true
mountPath: /octoprint
size: 1Gi
storageClass: local-path
printer:
enabled: true
hostPath: /dev/ttyACM0
type: hostPath
podAnnotations:
prometheus.io/path: /plugin/prometheus_exporter/metrics
prometheus.io/port: "5000"
prometheus.io/scrape: "true"
securityContext:
privileged: true
service:
main:
enabled: true
ports:
http:
port: 80
targetPort: 5000
stream:
enabled: true
ports:
http-stream:
enabled: true
port: 80
targetPort: 8080
streamer:
device: /dev/video0
encoder: CPU
format: YUYV
framerate: 15
port: 8080
quality: 70
resolution: 640x480
ustreamer:
enabled: true
image: lib42/ustreamer
imagePullPolicy: IfNotPresent
tag: latest