Compare commits
47 Commits
869a756e4b
...
fix_statef
Author | SHA1 | Date | |
---|---|---|---|
|
224c1ccd2f | ||
|
f924f986a9 | ||
2ae5f80aa4 | |||
|
db1b814416 | ||
8753852318 | |||
|
fef72ffc1a | ||
35fbb3534e | |||
|
0fe6d615a0 | ||
|
d4a800e3d4 | ||
|
04aa844ce6 | ||
|
4f2a9ba9b7 | ||
|
dd11ed2197 | ||
|
817fdf175a | ||
3cd2466816 | |||
|
5b8b037905 | ||
|
088ce48d6c | ||
cf63ca5dc5 | |||
5ec2a72505 | |||
|
82caca32d4 | ||
|
0204cc88db | ||
|
f7fd24fe6f | ||
|
bc9963a6ca | ||
|
9222a6f811 | ||
|
4f5f14adfc | ||
|
e596c93931 | ||
|
d3c3107491 | ||
|
174835f9fc | ||
|
0f4336caf9 | ||
|
5a4b3d7612 | ||
|
0cf4704fd2 | ||
|
3610963a9e | ||
|
8de903f860 | ||
|
5942d11624 | ||
|
b2ea2d9f0c | ||
|
e9cca5c631 | ||
|
7fff421620 | ||
|
deeeb10366 | ||
|
ce53a03d54 | ||
|
25dafc3c82 | ||
|
1866faf883 | ||
|
353a0268f2 | ||
|
0a3982ff7f | ||
|
1ac11c9a92 | ||
|
eb8c3dad8d | ||
|
61d3fe832f | ||
|
d52444b21c | ||
|
15806b7ab7 |
19
.frigate
Normal file
19
.frigate
Normal file
@@ -0,0 +1,19 @@
|
||||
{% extends "markdown.jinja2" %}
|
||||
|
||||
|
||||
|
||||
{% block title -%}
|
||||
# {{ name | upper }}
|
||||
|
||||
|
||||
to use, add this to your Charts.yaml
|
||||
```
|
||||
dependencies:
|
||||
- name: lib
|
||||
repository: oci://repo.rre.nu/helm
|
||||
version: <chart version>
|
||||
```
|
||||
|
||||
|
||||
|
||||
{%- endblock %}
|
37
.gitea/workflows/buildPush.yaml
Normal file
37
.gitea/workflows/buildPush.yaml
Normal file
@@ -0,0 +1,37 @@
|
||||
name: Package and publish helm chart
|
||||
|
||||
on:
|
||||
push:
|
||||
# Pattern matched against refs/tags
|
||||
tags:
|
||||
- '**' # Push events to every tag including hierarchical tags like v1.0/beta
|
||||
jobs:
|
||||
package-helm:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
name: Check out code
|
||||
|
||||
- name: Get package name
|
||||
id: chart_name
|
||||
uses: mikefarah/yq@master
|
||||
with:
|
||||
cmd: yq .name Chart.yaml
|
||||
|
||||
- name: Get package version
|
||||
id: chart_version
|
||||
uses: mikefarah/yq@master
|
||||
with:
|
||||
cmd: yq .version Chart.yaml
|
||||
|
||||
- name: build helm package
|
||||
shell: bash
|
||||
env:
|
||||
PACKAGE_TOKEN: ${{ secrets.REPO_HOST }}
|
||||
CHART_NAME: ${{ steps.chart_name.outputs.result }}
|
||||
CHART_VERSION: ${{ steps.chart_version.outputs.result }}
|
||||
run: |
|
||||
REPO_PATH=$(git rev-parse --show-toplevel)
|
||||
mkdir /tmp/build
|
||||
cd /tmp/build
|
||||
curl -H "Authorization: token $PACKAGE_TOKEN" -X POST --upload-file $CHART_NAME-$CHART_VERSION.tgz https://git.rre.nu/api/packages/jonas/helm/api/charts
|
26
.gitea/workflows/lint.yaml
Normal file
26
.gitea/workflows/lint.yaml
Normal file
@@ -0,0 +1,26 @@
|
||||
name: Lint and Test Charts
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
lint-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Helm
|
||||
uses: azure/setup-helm@v4.2.0
|
||||
with:
|
||||
version: v3.14.4
|
||||
|
||||
- name: Lint the helm package
|
||||
env:
|
||||
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
run: |
|
||||
helm lint ./
|
38
.gitignore
vendored
Normal file
38
.gitignore
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# General files for the project
|
||||
pkg/*
|
||||
*.pyc
|
||||
bin/*
|
||||
.project
|
||||
/.bin
|
||||
/_test/secrets/*.json
|
||||
*.tgz
|
||||
|
||||
# OSX leaves these everywhere on SMB shares
|
||||
._*
|
||||
|
||||
# OSX trash
|
||||
.DS_Store
|
||||
|
||||
# Files generated by JetBrains IDEs, e.g. IntelliJ IDEA
|
||||
.idea/
|
||||
*.iml
|
||||
|
||||
# Vscode files
|
||||
.vscode
|
||||
|
||||
# Emacs save files
|
||||
*~
|
||||
\#*\#
|
||||
.\#*
|
||||
|
||||
# Vim-related files
|
||||
[._]*.s[a-w][a-z]
|
||||
[._]s[a-w][a-z]
|
||||
*.un~
|
||||
Session.vim
|
||||
.netrwhist
|
||||
|
||||
# Chart dependencies
|
||||
**/charts/*.tgz
|
||||
|
||||
.history
|
@@ -21,3 +21,4 @@
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
*.tgz
|
||||
|
20
.pre-commit-config.yaml
Normal file
20
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v3.2.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
exclude: ^README.md$
|
||||
- id: check-yaml
|
||||
- id: check-added-large-files
|
||||
- repo: https://github.com/rapidsai/frigate/
|
||||
rev: v0.4.0
|
||||
hooks:
|
||||
- id: frigate
|
||||
args:
|
||||
- --output=README.rst
|
||||
- --format=rst
|
||||
- --no-credits
|
||||
- --no-deps
|
6
CHANGES.md
Normal file
6
CHANGES.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# next
|
||||
- added env.TZ to default to Europe/Stockholm
|
||||
- added deployment type
|
||||
|
||||
# v1.0.0
|
||||
- first version
|
@@ -3,9 +3,11 @@ apiVersion: v2
|
||||
name: lib
|
||||
description: Common functions for my helm charts at home
|
||||
type: library
|
||||
version: 0.0.0
|
||||
version: 1.0.3
|
||||
kubeVersion: ">=1.27.0"
|
||||
home: git.rre.nu
|
||||
sources:
|
||||
- https://git.rre.nu/jonas/common-helm-lib
|
||||
maintainers:
|
||||
- name: Jonas Forsberg
|
||||
email: barregargamel@gmail.com
|
||||
|
5
Makefile
5
Makefile
@@ -1,5 +1,10 @@
|
||||
NEW_VERSION:=$(shell yq '.version |= (split(".") | .[-1] |= ((. tag = "!!int") + 1) | join("."))' Chart.yaml | yq '.version')
|
||||
|
||||
|
||||
pre-commit:
|
||||
pip install pre-commit
|
||||
pre-commit install
|
||||
|
||||
branch:
|
||||
@echo "New chart version is: $(NEW_VERSION)"
|
||||
git checkout -b lib_$(NEW_VERSION)
|
||||
|
68
README.md
Normal file
68
README.md
Normal file
@@ -0,0 +1,68 @@
|
||||
|
||||
# LIB
|
||||
|
||||
|
||||
to use, add this to your Charts.yaml
|
||||
```
|
||||
dependencies:
|
||||
- name: lib
|
||||
repository: oci://repo.rre.nu/helm
|
||||
version: <chart version>
|
||||
```
|
||||
Common functions for my helm charts at home
|
||||
|
||||
|
||||
## Configuration
|
||||
|
||||
The following table lists the configurable parameters of the Lib chart and their default values.
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| ------------------------ | ----------------------- | -------------- |
|
||||
| `namespace` | namespace to install to | `"default"` |
|
||||
| `controller.enabled` | should the main workload be included or not | `true` |
|
||||
| `controller.type` | valid options are deployment, statefulset, job | `"deployment"` |
|
||||
| `controller.replicas` | number of replicas | `1` |
|
||||
| `controller.lifecycle` | Define postStart and preStop handlers | `{}` |
|
||||
| `controller.command` | override the containers entrypoint | `null` |
|
||||
| `controller.args` | add argument to the override command | `[]` |
|
||||
| `image.repository` | container image name | `null` |
|
||||
| `image.pullPolicy` | kubernetes pull policy | `"IfNotPresent"` |
|
||||
| `image.tag` | Overrides the image tag whose default is the chart appVersion. | `""` |
|
||||
| `fullnameOverride` | override the name of the helm release | `""` |
|
||||
| `service.main.enabled` | | `false` |
|
||||
| `service.main.type` | | `"ClusterIP"` |
|
||||
| `service.main.annotations` | | `{}` |
|
||||
| `service.main.labels` | | `{}` |
|
||||
| `service.main.ports` | | `null` |
|
||||
| `ingress.enabled` | | `false` |
|
||||
| `ingress.service` | what service should the ingress target | `"main"` |
|
||||
| `ingress.servicePort` | | `80` |
|
||||
| `ingress.className` | | `""` |
|
||||
| `ingress.annotations` | | `{}` |
|
||||
| `ingress.hosts` | | `[{"host": "chart-example.local", "paths": [{"path": "/", "pathType": "ImplementationSpecific"}]}]` |
|
||||
| `ingress.tls` | | `[]` |
|
||||
| `resources` | | `{}` |
|
||||
| `autoscaling.enabled` | | `false` |
|
||||
| `autoscaling.minReplicas` | | `1` |
|
||||
| `autoscaling.maxReplicas` | | `5` |
|
||||
| `autoscaling.targetCPUUtilizationPercentage` | | `80` |
|
||||
| `secrets` | Secrets that needs to be created | `{}` |
|
||||
| `configs` | ConfigMaps that needs to be created | `{}` |
|
||||
| `envFrom` | mount environment variables from secrets or configMaps | `[]` |
|
||||
| `env.TZ` | | `"Europe/Stockholm"` |
|
||||
| `volumes` | | `[]` |
|
||||
| `volumeMounts` | | `[]` |
|
||||
| `volumeClaimTemplates` | used for statefulset https://kubernetes.io/docs/concepts/workloads/controllers/statefulset | `[]` |
|
||||
| `serviceAccount.create` | | `true` |
|
||||
| `serviceAccount.automount` | | `true` |
|
||||
| `serviceAccount.annotations` | | `{}` |
|
||||
| `serviceAccount.name` | | `""` |
|
||||
| `livenessProbe` | | `{}` |
|
||||
| `readinessProbe` | | `{}` |
|
||||
| `nodeSelector` | | `{}` |
|
||||
| `tolerations` | | `[]` |
|
||||
| `affinity` | | `{}` |
|
||||
|
||||
|
||||
|
||||
|
@@ -4,12 +4,19 @@ Main entrypoint for the common library chart. It will render all underlying temp
|
||||
{{- define "lib.all" -}}
|
||||
{{- include "lib.values.setup" . }}
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{- include "lib.serviceaccount" . | nindent 0 }}
|
||||
{{- include "lib.serviceaccount" . | nindent 0 }}
|
||||
{{- end -}}
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- include "lib.ingress" . | nindent 0}}
|
||||
{{- end -}}
|
||||
{{ include "lib.service" . | nindent 0 }}
|
||||
{{ if eq .Values.controller.type "statefulset" }}
|
||||
{{- include "lib.statefulset" . | nindent 0}}
|
||||
{{ include "lib.secrets" . | nindent 0 }}
|
||||
{{ include "lib.configs" . | nindent 0 }}
|
||||
{{ if .Values.controller.enabled }}
|
||||
{{ if eq .Values.controller.type "statefulset" }}
|
||||
{{- include "lib.statefulset" . | nindent 0 }}
|
||||
{{ else if eq .Values.controller.type "deployment" }}
|
||||
{{- include "lib.deployment" . | nindent 0 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
|
28
templates/_configmaps.tpl
Normal file
28
templates/_configmaps.tpl
Normal file
@@ -0,0 +1,28 @@
|
||||
{{- define "lib.configs" -}}
|
||||
{{- $fullName := include "lib.fullname" . -}}
|
||||
{{- $namespace := .Values.namespace | default "default" -}}
|
||||
{{- $commonLabels := include "lib.labels" . }}
|
||||
{{- range $name, $values := .Values.configs }}
|
||||
{{- if $values.enabled -}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ $fullName }}-{{ $name }}
|
||||
namespace: {{ $namespace }}
|
||||
labels:
|
||||
{{- $commonLabels | nindent 4 }}
|
||||
{{- with $values.labels }}
|
||||
{{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with $values.annotations }}
|
||||
annotations:
|
||||
{{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with $values.data }}
|
||||
data:
|
||||
{{- tpl (toYaml .) $ | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
54
templates/_deployment.tpl
Normal file
54
templates/_deployment.tpl
Normal file
@@ -0,0 +1,54 @@
|
||||
{{- define "lib.deployment" -}}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "lib.fullname" . }}
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "lib.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "lib.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "lib.labels" . | nindent 8 }}
|
||||
{{- with .Values.controller.labels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "lib.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
{{- include "lib.parts.container" . | nindent 8 -}}
|
||||
{{- with .Values.volumes }}
|
||||
volumes:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
@@ -61,7 +61,9 @@ Create the name of the service account to use
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* Merge the local chart values and the library chart defaults */}}
|
||||
{{/*
|
||||
Merge the local chart values and the library chart defaults
|
||||
*/}}
|
||||
{{- define "lib.values.setup" -}}
|
||||
{{- if .Values.lib -}}
|
||||
{{- $defaultValues := deepCopy .Values.lib -}}
|
||||
|
@@ -1,12 +1,13 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{ define "lib.ingress" }}
|
||||
{{- $fullName := include "lib.fullname" . -}}
|
||||
{{- $svcName := .Values.ingress.service -}}
|
||||
{{- $svcPort := .Values.ingress.servicePort -}}
|
||||
{{- $svcName := .Values.ingress.service -}}
|
||||
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
|
||||
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
|
||||
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
@@ -17,6 +18,7 @@ apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "lib.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
@@ -50,11 +52,11 @@ spec:
|
||||
backend:
|
||||
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
name: {{ $fullName }}-{{ $svcName }}
|
||||
port:
|
||||
number: {{ $svcPort }}
|
||||
{{- else }}
|
||||
serviceName: {{ $fullName }}
|
||||
serviceName: {{ $fullName }}-${{ $svcName }}
|
||||
servicePort: {{ $svcPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
33
templates/_secrets.tpl
Normal file
33
templates/_secrets.tpl
Normal file
@@ -0,0 +1,33 @@
|
||||
{{- define "lib.secrets" -}}
|
||||
{{- $fullName := include "lib.fullname" . -}}
|
||||
{{- $namespace := .Values.namespace | default "default" -}}
|
||||
{{- $commonLabels := include "lib.labels" . }}
|
||||
{{- range $name, $values := .Values.secrets }}
|
||||
{{- if $values.enabled -}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ $fullName }}-{{ $name }}
|
||||
namespace: {{ $namespace }}
|
||||
labels:
|
||||
{{- $commonLabels | nindent 4 }}
|
||||
{{- with $values.labels }}
|
||||
{{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with $values.annotations }}
|
||||
annotations:
|
||||
{{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
type: {{ $values.type | default "Opauge" }}
|
||||
{{- with $values.data }}
|
||||
data:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with $values.stringData }}
|
||||
stringData:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@@ -14,16 +14,16 @@ metadata:
|
||||
labels:
|
||||
{{- $labels | nindent 4 }}
|
||||
spec:
|
||||
type: {{ $values.type }}
|
||||
type: {{ default "ClusterIP" $values.type }}
|
||||
ports:
|
||||
{{- range $k, $v := $values.ports }}
|
||||
- port: {{ $v.port }}
|
||||
targetPort: {{ default $v.targetPort $v.port }}
|
||||
protocol: {{ $v.protocol }}
|
||||
targetPort: {{ default $v.port $v.targetPort }}
|
||||
protocol: {{ default "TCP" $v.protocol }}
|
||||
name: {{ $k }}
|
||||
{{- end }}
|
||||
selector:
|
||||
{{- $selectorlabels | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
@@ -12,4 +12,4 @@ metadata:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
@@ -35,35 +35,7 @@ spec:
|
||||
securityContext:
|
||||
{{- toYaml .Values.controller.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.controller.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
{{- range $name, $values := .Values.service -}}
|
||||
{{- if $values.enabled -}}
|
||||
{{- range $k, $v := $values.ports }}
|
||||
- name: {{ $k }}
|
||||
containerPort: {{ $v.targetPort | default $v.port }}
|
||||
protocol: {{ $v.protocol }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
{{- toYaml .Values.livenessProbe | nindent 12 }}
|
||||
readinessProbe:
|
||||
{{- toYaml .Values.readinessProbe | nindent 12 }}
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
{{- with .Values.volumeMounts }}
|
||||
volumeMounts:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.volumes }}
|
||||
volumes:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- include "lib.parts.container" . | nindent 8 -}}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
@@ -76,4 +48,16 @@ spec:
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
volumeClaimTemplates:
|
||||
{{- range $i, $values := .Values.volumeClaimTemplates }}
|
||||
- metadata:
|
||||
name: {{ $values.name }}
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ required (printf "accessMode is required for volumeClaimTemplate %v" $values.name) $values.accessMode | quote }}
|
||||
storageClassName: {{ required (printf "storageClassName is required for volumeClaimTemplate %v" $values.name) $values.storageClassName | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ required (printf "size is required for volumeClaimTemplate %v" $values.name) $values.size | quote }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
53
templates/parts/_containers.tpl
Normal file
53
templates/parts/_containers.tpl
Normal file
@@ -0,0 +1,53 @@
|
||||
{{- define "lib.parts.container" -}}
|
||||
{{/*
|
||||
create the environment varable list
|
||||
*/}}
|
||||
- name: {{ .Chart.Name }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 4 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- with .Values.controller.command }}
|
||||
command: {{ toYaml . | nindent 4}}
|
||||
{{- end }}
|
||||
{{- with .Values.controller.args }}
|
||||
args: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.controller.lifecycle }}
|
||||
lifecycle:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
{{- range $name, $values := .Values.service -}}
|
||||
{{- if $values.enabled -}}
|
||||
{{- range $k, $v := $values.ports }}
|
||||
- name: {{ $k }}
|
||||
containerPort: {{ default $v.port $v.targetPort }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
env:
|
||||
{{- include "lib.parts.env" . | nindent 4 -}}
|
||||
{{- with .Values.livenessProbe }}
|
||||
livenessProbe:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.readinessProbe }}
|
||||
readinessProbe:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.volumeMounts .Values.volumeClaimTemplates }}
|
||||
volumeMounts:
|
||||
{{- end }}
|
||||
{{- with .Values.volumeMounts }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- range $v := .Values.volumeClaimTemplates }}
|
||||
- name: {{ $v.name }}
|
||||
mountPath: {{ $v.mountPath }}
|
||||
{{- end }}
|
||||
{{- end }}
|
26
templates/parts/_env.tpl
Normal file
26
templates/parts/_env.tpl
Normal file
@@ -0,0 +1,26 @@
|
||||
{{/*
|
||||
Get all environment variables configMaps and
|
||||
secrets that should be mounted as environment variables
|
||||
*/}}
|
||||
{{- define "lib.parts.env" -}}
|
||||
{{/*
|
||||
environment variables from .Values.env
|
||||
*/}}
|
||||
{{- range $name, $value := .Values.env -}}
|
||||
{{- printf "- name: %s" $name | nindent 0 }}
|
||||
{{- printf "value: %s" $value | nindent 2 }}
|
||||
{{- end -}}
|
||||
{{/*
|
||||
environment variables from configMaps
|
||||
*/}}
|
||||
{{- range $cfgName, $settings := .Values.configs -}}
|
||||
{{- if and $settings.enabled $settings.env -}}
|
||||
{{- range $key, $value := $settings.data -}}
|
||||
{{- printf "- name: %s" $key | nindent 0 }}
|
||||
{{- printf "valueFrom:" | nindent 2 }}
|
||||
{{- printf "configMapKeyRef:" | nindent 4 }}
|
||||
{{- printf "name: %s" $key | nindent 5 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
145
values.yaml
145
values.yaml
@@ -1,54 +1,27 @@
|
||||
---
|
||||
# Namespace to deploy to, if not set it targets default namespace
|
||||
namespace: default
|
||||
|
||||
controller:
|
||||
# -- enable the controller
|
||||
enabled: true
|
||||
# type of controller
|
||||
# valid options are deployment, statefulset, job
|
||||
type: deployment
|
||||
annotations: {}
|
||||
labels: {}
|
||||
replicas: 1
|
||||
podSecurityContext: {}
|
||||
securityContext: {}
|
||||
# capabilities:
|
||||
# drop:
|
||||
# - ALL
|
||||
# readOnlyRootFilesystem: true
|
||||
# runAsNonRoot: true
|
||||
# runAsUser: 1000
|
||||
namespace: default # namespace to install to
|
||||
controller: # main workload
|
||||
enabled: true # should the main workload be included or not
|
||||
type: deployment # valid options are deployment, statefulset, job
|
||||
replicas: 1 # number of replicas
|
||||
lifecycle: {} # Define postStart and preStop handlers
|
||||
command: # override the containers entrypoint
|
||||
args: [] # add argument to the override command
|
||||
|
||||
image:
|
||||
repository:
|
||||
pullPolicy:
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
tag: ""
|
||||
repository: # container image name
|
||||
pullPolicy: IfNotPresent # kubernetes pull policy
|
||||
tag: "" # Overrides the image tag whose default is the chart appVersion.
|
||||
|
||||
imagePullSecrets: []
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
fullnameOverride: "" # override the name of the helm release
|
||||
|
||||
serviceAccount:
|
||||
# Specifies whether a service account should be created
|
||||
create: true
|
||||
# Automatically mount a ServiceAccount's API credentials?
|
||||
automount: true
|
||||
# Annotations to add to the service account
|
||||
annotations: {}
|
||||
# The name of the service account to use.
|
||||
# If not set and create is true, a name is generated using the fullname template
|
||||
name: ""
|
||||
|
||||
|
||||
service:
|
||||
service: # services that should be created
|
||||
main:
|
||||
enabled: false
|
||||
type: ClusterIP
|
||||
annotations: {}
|
||||
labels: {}
|
||||
ports: {}
|
||||
ports:
|
||||
# http:
|
||||
# # -- Enables or disables the port
|
||||
# enabled: false#
|
||||
@@ -68,27 +41,27 @@ service:
|
||||
#
|
||||
# # -- Specify the nodePort value for the LoadBalancer and NodePort service types.
|
||||
# # [[ref]](https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport)
|
||||
# nodePort:
|
||||
|
||||
# nodePort:
|
||||
|
||||
ingress:
|
||||
main:
|
||||
enabled: false
|
||||
className: ""
|
||||
annotations: {}
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
service: main
|
||||
servicePort: 80
|
||||
hosts:
|
||||
- host: chart-example.local
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
tls: []
|
||||
# - secretName: chart-example-tls
|
||||
# hosts:
|
||||
# - chart-example.local
|
||||
enabled: false
|
||||
service: main # what service should the ingress target
|
||||
#Service to target
|
||||
servicePort: 80
|
||||
className: ""
|
||||
annotations:
|
||||
{}
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
hosts:
|
||||
- host: chart-example.local
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
tls: []
|
||||
# - secretName: chart-example-tls
|
||||
# hosts:
|
||||
# - chart-example.local
|
||||
|
||||
resources: {}
|
||||
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||
@@ -109,6 +82,33 @@ autoscaling:
|
||||
targetCPUUtilizationPercentage: 80
|
||||
# targetMemoryUtilizationPercentage: 80
|
||||
|
||||
secrets: {} # Secrets that needs to be created
|
||||
# secrets:
|
||||
# <name>:
|
||||
# type: #default Opaque
|
||||
# annotations: {}
|
||||
# labels: {}
|
||||
# data:
|
||||
# KEY: VALUE
|
||||
|
||||
configs: {} # ConfigMaps that needs to be created
|
||||
# configs:
|
||||
# <name>:
|
||||
# enabled: false # should the configMap be created or not
|
||||
# annotations: {}
|
||||
# labels: {}
|
||||
# data:
|
||||
# KEY: VALUE
|
||||
|
||||
envFrom: [] # mount environment variables from secrets or configMaps
|
||||
# - configMapRef:
|
||||
# name: config-map-name
|
||||
# - secretRef:
|
||||
# name: secret-name
|
||||
|
||||
env: # environment variables the controller should have
|
||||
TZ: Europe/Stockholm
|
||||
|
||||
# Additional volumes on the output Deployment definition.
|
||||
volumes: []
|
||||
# - name: foo
|
||||
@@ -122,6 +122,31 @@ volumeMounts: []
|
||||
# mountPath: "/etc/foo"
|
||||
# readOnly: true
|
||||
|
||||
volumeClaimTemplates: [] # used for statefulset https://kubernetes.io/docs/concepts/workloads/controllers/statefulset
|
||||
#volumeClaimTemplates:
|
||||
# - name: www
|
||||
# mountPath: /var/www/html
|
||||
# accessModes: "ReadWriteOnce"
|
||||
# storageClassName: "my-storage-class"
|
||||
# size: 1Gi
|
||||
|
||||
|
||||
|
||||
serviceAccount:
|
||||
# Specifies whether a service account should be created
|
||||
create: true
|
||||
# Automatically mount a ServiceAccount's API credentials?
|
||||
automount: true
|
||||
# Annotations to add to the service account
|
||||
annotations: {}
|
||||
# The name of the service account to use.
|
||||
# If not set and create is true, a name is generated using the fullname template
|
||||
name: ""
|
||||
|
||||
livenessProbe: {}
|
||||
|
||||
readinessProbe: {}
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
Reference in New Issue
Block a user