mirror of
https://github.com/truenas/charts.git
synced 2026-11-20 15:07:07 +00:00
Allow special paths for host path mounts
This commit is contained in:
1 parent
0d29991c20
commit
8b63e23625
561 files changed
+43
-37
No files matched your search
@@ -0,0 +1,32 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "netdata.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 "netdata.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 -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "netdata.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,25 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ template "netdata.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "netdata.name" . }}
|
||||
chart: {{ template "netdata.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources:
|
||||
- "pods" # used by sd, netdata (cgroup-name.sh, get-kubernetes-labels.sh)
|
||||
- "services" # used by sd
|
||||
- "configmaps" # used by sd
|
||||
- "secrets" # used by sd
|
||||
verbs:
|
||||
- "get"
|
||||
- "list"
|
||||
- "watch"
|
||||
- apiGroups: [""]
|
||||
resources:
|
||||
- "namespaces" # used by netdata (cgroup-name.sh, get-kubernetes-labels.sh)
|
||||
verbs:
|
||||
- "get"
|
||||
@@ -0,0 +1,17 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ template "netdata.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "netdata.name" . }}
|
||||
chart: {{ template "netdata.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ template "netdata.fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ .Release.Name }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
@@ -0,0 +1,91 @@
|
||||
{{ include "common.storage.hostPathValidate" .Values }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "netdata.name" . }}
|
||||
labels:
|
||||
app: {{ template "netdata.name" . }}
|
||||
chart: {{ template "netdata.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
role: parent
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels: {{ include "common.labels.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels: {{ include "common.labels.selectorLabels" . | nindent 8 }}
|
||||
annotations:
|
||||
rollme: {{ randAlphaNum 5 | quote }}
|
||||
spec:
|
||||
securityContext:
|
||||
fsGroup: 201
|
||||
serviceAccountName: {{ .Release.Name }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.repository }}:{{ tpl .Values.image.tag . }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
env:
|
||||
{{ $envList := (default list .Values.environmentVariables) }}
|
||||
{{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 19999
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /api/v1/info
|
||||
port: http
|
||||
failureThreshold: 3
|
||||
periodSeconds: 30
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 1
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /api/v1/info
|
||||
port: http
|
||||
failureThreshold: 3
|
||||
periodSeconds: 30
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 1
|
||||
volumeMounts:{{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
|
||||
- name: os-release
|
||||
mountPath: /host/etc/os-release
|
||||
readOnly: true
|
||||
- name: sys
|
||||
mountPath: /host/sys
|
||||
readOnly: true
|
||||
- name: proc
|
||||
mountPath: /host/proc
|
||||
readOnly: true
|
||||
- name: user
|
||||
mountPath: /host/etc/passwd
|
||||
readOnly: true
|
||||
- name: group
|
||||
mountPath: /host/etc/group
|
||||
readOnly: true
|
||||
securityContext:
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_PTRACE
|
||||
terminationGracePeriodSeconds: 60
|
||||
{{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
|
||||
volumes:{{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
|
||||
- name: os-release
|
||||
hostPath:
|
||||
path: /etc/os-release
|
||||
- name: proc
|
||||
hostPath:
|
||||
path: /proc
|
||||
- name: sys
|
||||
hostPath:
|
||||
path: /sys
|
||||
- name: user
|
||||
hostPath:
|
||||
path: /etc/passwd
|
||||
- name: group
|
||||
hostPath:
|
||||
path: /etc/group
|
||||
@@ -0,0 +1,34 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: "{{ template "common.names.fullname" . }}-preinstall-job"
|
||||
labels:
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion }}
|
||||
helm.sh/chart: {{ template "common.names.chart" . }}
|
||||
annotations:
|
||||
"helm.sh/hook": pre-install
|
||||
"helm.sh/hook-delete-policy": hook-succeeded
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
name: "{{ template "common.names.fullname" . }}-preinstall-hook"
|
||||
labels:
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name | quote }}
|
||||
helm.sh/chart: {{ template "common.names.chart" . }}
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: pre-install-job
|
||||
image: "alpine:latest"
|
||||
command:
|
||||
- chown
|
||||
- -R
|
||||
- {{ .Values.runAsUser }}:{{ .Values.runAsGroup }}
|
||||
- {{ .Values.appVolumeMounts.netdatacache.mountPath }}
|
||||
- {{ .Values.appVolumeMounts.netdatalib.mountPath }}
|
||||
- {{ .Values.appVolumeMounts.netdataconfig.mountPath }}
|
||||
volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
|
||||
volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
|
||||
@@ -0,0 +1,6 @@
|
||||
{{ $svc := .Values.service }}
|
||||
{{ $ports := list }}
|
||||
{{ $ports = mustAppend $ports (dict "name" "ui" "port" $svc.nodePort "nodePort" $svc.nodePort "targetPort" 19999) }}
|
||||
{{ $params := . }}
|
||||
{{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }}
|
||||
{{ include "common.classes.service" $params }}
|
||||
@@ -0,0 +1,9 @@
|
||||
kind: ServiceAccount
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "netdata.name" . }}
|
||||
chart: {{ template "netdata.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
name: {{ .Release.Name }}
|
||||
@@ -0,0 +1,21 @@
|
||||
{{- $serviceName := (include "common.names.fullname" .) -}}
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: "{{ .Release.Name }}-netdata-test"
|
||||
labels:
|
||||
app: {{ .Release.Name }}
|
||||
release: {{ .Release.Name }}
|
||||
annotations:
|
||||
"helm.sh/hook": test
|
||||
spec:
|
||||
containers:
|
||||
- name: test-curl
|
||||
image: alpine/curl
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
command:
|
||||
- /bin/sh
|
||||
- -ec
|
||||
- |
|
||||
curl --connect-timeout 5 --max-time 10 --retry 5 --retry-delay 15 --retry-max-time 90 --retry-all-errors -ksf http://{{ $serviceName }}:{{ .Values.service.nodePort }}/
|
||||
restartPolicy: Never
|
||||
Reference in new issue
Block a user