Adding the helm chart
This commit is contained in:
1 parent
49d96722cb
commit
08438b2252
10 files changed
+279
No files matched your search
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: apcupsd-client
|
||||
description: FastAPI + Redis UPS monitoring dashboard
|
||||
type: application
|
||||
version: 1.0.0
|
||||
appVersion: "1.0.0"
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- define "app.labels" -}}
|
||||
app.kubernetes.io/name: {{ .Chart.Name }}
|
||||
app.kubernetes.io/part-of: {{ .Chart.Name }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "app.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ .Chart.Name }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "redis.labels" -}}
|
||||
app.kubernetes.io/name: redis
|
||||
app.kubernetes.io/part-of: {{ .Chart.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "redis.selectorLabels" -}}
|
||||
app.kubernetes.io/name: redis
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,11 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Chart.Name }}-config
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "app.labels" . | nindent 4 }}
|
||||
data:
|
||||
{{- range $key, $val := .Values.config }}
|
||||
{{ $key }}: {{ $val | quote }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,65 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ .Chart.Name }}
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "app.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.app.replicas }}
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxUnavailable: 0
|
||||
maxSurge: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "app.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "app.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.app.securityContext.runAsUser }}
|
||||
runAsGroup: {{ .Values.app.securityContext.runAsGroup }}
|
||||
runAsNonRoot: true
|
||||
fsGroup: {{ .Values.app.securityContext.runAsGroup }}
|
||||
containers:
|
||||
- name: web
|
||||
image: {{ .Values.app.image }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.app.port }}
|
||||
protocol: TCP
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ .Chart.Name }}-config
|
||||
- secretRef:
|
||||
name: {{ .Chart.Name }}-secret
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: {{ .Values.app.probes.liveness.path }}
|
||||
port: {{ .Values.app.port }}
|
||||
initialDelaySeconds: {{ .Values.app.probes.liveness.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.app.probes.liveness.periodSeconds }}
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: {{ .Values.app.probes.readiness.path }}
|
||||
port: {{ .Values.app.port }}
|
||||
initialDelaySeconds: {{ .Values.app.probes.readiness.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.app.probes.readiness.periodSeconds }}
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 3
|
||||
resources:
|
||||
{{- toYaml .Values.app.resources | nindent 12 }}
|
||||
securityContext:
|
||||
readOnlyRootFilesystem: true
|
||||
allowPrivilegeEscalation: false
|
||||
volumeMounts:
|
||||
- name: tmp
|
||||
mountPath: /tmp
|
||||
volumes:
|
||||
- name: tmp
|
||||
emptyDir: {}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- if .Values.redis.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: redis
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "redis.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
{{- include "redis.selectorLabels" . | nindent 4 }}
|
||||
ports:
|
||||
- name: redis
|
||||
protocol: TCP
|
||||
port: {{ .Values.redis.port }}
|
||||
targetPort: {{ .Values.redis.port }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,68 @@
|
||||
{{- if .Values.redis.enabled }}
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: redis
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "redis.labels" . | nindent 4 }}
|
||||
spec:
|
||||
serviceName: redis
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "redis.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "redis.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.redis.securityContext.runAsUser }}
|
||||
runAsGroup: {{ .Values.redis.securityContext.runAsGroup }}
|
||||
fsGroup: {{ .Values.redis.securityContext.runAsGroup }}
|
||||
containers:
|
||||
- name: redis
|
||||
image: {{ .Values.redis.image }}
|
||||
command:
|
||||
- redis-server
|
||||
- --appendonly
|
||||
- "yes"
|
||||
- --appendfsync
|
||||
- everysec
|
||||
ports:
|
||||
- containerPort: {{ .Values.redis.port }}
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- redis-cli
|
||||
- ping
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 5
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- redis-cli
|
||||
- ping
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
resources:
|
||||
{{- toYaml .Values.redis.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: redis-data
|
||||
mountPath: /data
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: redis-data
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.redis.storage }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ .Chart.Name }}-secret
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "app.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
stringData:
|
||||
{{- range $key, $val := .Values.secrets }}
|
||||
{{ $key }}: {{ $val | quote }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Chart.Name }}
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "app.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
selector:
|
||||
{{- include "app.selectorLabels" . | nindent 4 }}
|
||||
ports:
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: {{ .Values.service.port }}
|
||||
targetPort: {{ .Values.app.port }}
|
||||
@@ -0,0 +1,7 @@
|
||||
secrets:
|
||||
# Generate with: python -c "import secrets; print(secrets.token_urlsafe(32))"
|
||||
SESSION_SECRET: ""
|
||||
# Generate with: python -c "from passlib.hash import argon2; print(argon2.hash('yourpassword'))"
|
||||
ADMIN_PASSWORD_HASH: ""
|
||||
# Optional SMTP password
|
||||
SMTP_PASSWORD: ""
|
||||
@@ -0,0 +1,56 @@
|
||||
namespace: apcupsd
|
||||
|
||||
app:
|
||||
image: ghcr.io/k2patel/apcupsd-client:latest
|
||||
replicas: 1
|
||||
port: 8000
|
||||
resources:
|
||||
requests:
|
||||
memory: "128Mi"
|
||||
cpu: "100m"
|
||||
limits:
|
||||
memory: "256Mi"
|
||||
cpu: "500m"
|
||||
securityContext:
|
||||
runAsUser: 10001
|
||||
runAsGroup: 10001
|
||||
probes:
|
||||
liveness:
|
||||
path: /healthz
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 30
|
||||
readiness:
|
||||
path: /readyz
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
|
||||
service:
|
||||
type: LoadBalancer
|
||||
port: 80
|
||||
|
||||
redis:
|
||||
enabled: true
|
||||
image: redis:7-alpine
|
||||
port: 6379
|
||||
resources:
|
||||
requests:
|
||||
memory: "64Mi"
|
||||
cpu: "50m"
|
||||
limits:
|
||||
memory: "128Mi"
|
||||
cpu: "250m"
|
||||
storage: 1Gi
|
||||
securityContext:
|
||||
runAsUser: 999
|
||||
runAsGroup: 999
|
||||
|
||||
config:
|
||||
ADMIN_USERNAME: "admin"
|
||||
REDIS_URL: "redis://redis:6379/0"
|
||||
ALLOW_PRIVATE_IPS: "true"
|
||||
TRUST_PROXY: "false"
|
||||
LOG_LEVEL: "INFO"
|
||||
RATE_LIMIT_ENABLED: "true"
|
||||
SESSION_MAX_AGE_SECONDS: "1209600"
|
||||
TZ: "America/New_York"
|
||||
UPS_CONFIG_PATH: "/config/ups.yaml"
|
||||
Reference in new issue
Block a user