mirror of
https://github.com/truecharts/library-charts.git
synced 2026-07-08 02:56:23 -03:00
BREAKING CHANGE: Common Refactor (#110)
* Split and reorganise some file for refactorign and add docs (#15) * refactor(general): initial restructure, renaming, documenting changes and splitting some files for clearity * bump to make clear this is refactor work * fix(deviceList): fix perdict missing var * fix(common-test): rename loader * remove targz from common-test * different perdict name * reshuffle * reorder more * fix device and persistence lists * no message * Add secret spawner (#17) * add secret spawner (cherry picked from commit 19be71210adb17534da3a380630c8a6548d6c2fd) * move secret spawner * some more cleanup * whoopps * minor env cleanup * more * certs * update test * misc fixes * Move hpa to class (#18) * Move hpa to class * use spawner instead of direct class * Fix some tests * Allow for multiple networkPolicies (#19) * Allow for multiple networkPolicies * also update values.yaml * fix mistake * update tests * lowercase * hmm * refactor serviceAccount creation (#77) * make serviceAccounts more flexible * fixup * fixup * fixup 3 * refactor RBAC creation (#76) * Add support for more than one RBAC to be configured * adapt values.yaml * fixup * fixup2 * rbac tweak * hmmm * work on cleaning things up (#81) * restructure folders a bit * cleanup some references * merge autopermissions with hostpatch and remove docker-compose disable * fixup * SCALE->scale * portal to scale folder * remove dep-common * hmm * render prep as script * fix some permission mistakes * patch auto-permissions tests * More TPL usage for containers and pods (#82) * tpl pod content * fix * fix2 * more mainContainer tpl support * fix again * volume and volumemount tpl options expansion * missing space * readonly fix * finish tpl addition to non-class files * fix port * no tpl for group number * more tpl and test fixes * allow to disable inotify patch * no message * add nfs support to persistence and port a patch from KAH * allow externalTrafficPolicy on all types of services * change fix * Ensure SCALE specific code is not run outside of SCALE (#83) * only apply SCALE specific non-storage settings when running as SCALE App * fix ingress and portal tests * significantly simplify SCALE PVC naming and make it only run when used as SCALE App * fix certificate tests * use global ixChartContext where suitable * Add auto-permissions support for (NFSv4) ACL's (#84) * initial work on NFS4 ACL support * remove automatic permission tests for now... * more verbosity * test another solution * set rights for both user AND group * test auto permissions during run tests * hmmm * hmm2 * fix quoting issues * different quotes * ahhh * Update charts/common/templates/lib/controller/_prepare.tpl Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * improve acl detector * invert acl detector * stick to group permissions * ensure chown uses a path Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * Tests and small fixes Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
1d1945f20a
commit
f267828efe
@@ -1,38 +0,0 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.154.0/containers/ruby
|
||||
{
|
||||
"name": "Ruby",
|
||||
"image": "tccr.io/truecharts/devcontainer:v2.2.1"
|
||||
|
||||
// Set *default* container specific settings.json values on container create.
|
||||
"settings": {
|
||||
"terminal.integrated.shell.linux": "/bin/bash"
|
||||
},
|
||||
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"ms-kubernetes-tools.vscode-kubernetes-tools",
|
||||
"rebornix.Ruby",
|
||||
"github.vscode-pull-request-github",
|
||||
"eamodio.gitlens",
|
||||
"yzhang.markdown-all-in-one",
|
||||
"davidanson.vscode-markdownlint",
|
||||
"esbenp.prettier-vscode",
|
||||
"2gua.rainbow-brackets",
|
||||
"bmuskalla.vscode-tldr",
|
||||
"visualstudioexptteam.vscodeintellicode",
|
||||
"wingrunr21.vscode-ruby",
|
||||
"redhat.vscode-yaml",
|
||||
"spmeesseman.vscode-taskexplorer",
|
||||
"formulahendry.code-runner"
|
||||
],
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"postCreateCommand": "export RUBYJQ_USE_SYSTEM_LIBRARIES=1 && bundle install",
|
||||
|
||||
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "vscode"
|
||||
}
|
||||
2
.github/ct-lint.yaml
vendored
2
.github/ct-lint.yaml
vendored
@@ -4,4 +4,4 @@ helm-extra-args: --timeout 600s
|
||||
chart-dirs:
|
||||
- charts
|
||||
chart-repos:
|
||||
- k8s-at-home-libraries=https://library-charts.truecharts.org
|
||||
- truecharts-libraries=https://library-charts.truecharts.org
|
||||
|
||||
99
.github/workflows/charts-lint-test.yaml
vendored
Normal file
99
.github/workflows/charts-lint-test.yaml
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
name: "Charts: Lint and test"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/charts-lint-test.yaml'
|
||||
- 'charts/**'
|
||||
- 'helper-charts/**'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint charts
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
changed: ${{ steps.list-changed.outputs.changed }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@v1
|
||||
with:
|
||||
version: v3.5.4
|
||||
|
||||
- uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: 3.7
|
||||
|
||||
- name: Set up chart-testing
|
||||
uses: helm/chart-testing-action@v2.2.1
|
||||
|
||||
- name: Run chart-testing (list-changed)
|
||||
id: list-changed
|
||||
run: |
|
||||
changed=$(ct list-changed --config .github/ct-lint.yaml)
|
||||
if [[ -n "$changed" ]]; then
|
||||
echo "::set-output name=changed::true"
|
||||
fi
|
||||
- name: Run chart-testing (lint)
|
||||
id: lint
|
||||
if: steps.list-changed.outputs.changed == 'true'
|
||||
run: ct lint --config .github/ct-lint.yaml
|
||||
|
||||
unittest:
|
||||
needs:
|
||||
- lint
|
||||
name: Run unit tests
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@v1
|
||||
with:
|
||||
version: v3.5.4
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
helm plugin install https://github.com/vbehar/helm3-unittest --version v1.0.16
|
||||
cd helper-charts/common-test/
|
||||
helm dependency update
|
||||
helm unittest -f "tests/**/*_test.yaml" .
|
||||
install:
|
||||
needs:
|
||||
- lint
|
||||
name: Install charts
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@v1
|
||||
with:
|
||||
version: v3.5.4
|
||||
|
||||
- uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: 3.7
|
||||
|
||||
- name: Set up chart-testing
|
||||
uses: helm/chart-testing-action@v2.2.1
|
||||
|
||||
- name: Create k3d cluster
|
||||
uses: nolar/setup-k3d-k3s@v1
|
||||
with:
|
||||
version: v1.22.4+k3s1
|
||||
if: needs.lint.outputs.changed == 'true'
|
||||
|
||||
- name: Run chart-testing (install)
|
||||
if: needs.lint.outputs.changed == 'true'
|
||||
run: find ./ -type f -name *.yaml -exec sed -i 's/tccr.io/ghcr.io/gI' {} \; && ct install --config .github/ct-install.yaml
|
||||
78
.github/workflows/common.test.yaml
vendored
78
.github/workflows/common.test.yaml
vendored
@@ -1,78 +0,0 @@
|
||||
name: "common: Tests"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- '**'
|
||||
tags-ignore:
|
||||
- '**'
|
||||
paths:
|
||||
- 'charts/**'
|
||||
- 'helper-charts/**'
|
||||
- 'tests/**'
|
||||
- '.github/workflows/common.test.yaml'
|
||||
- '.github/ct-install.yaml'
|
||||
- '.github/ct-lint.yaml'
|
||||
|
||||
jobs:
|
||||
unit-and-lint:
|
||||
name: Unit and Lint tests
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: tccr.io/truecharts/devcontainer:v2.2.1@sha256:4ace13c049bf00f85c63e0070f86b71656a7c3b2113aa3e21c3107f3d1f7bf87
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
||||
name: Checkout
|
||||
with:
|
||||
fetch-depth: 100
|
||||
|
||||
- name: Run chart-testing (lint)
|
||||
run: ct lint --config .github/ct-lint.yaml --charts 'helper-charts/common-test'
|
||||
|
||||
- name: Run common unit tests
|
||||
run: |
|
||||
bundle exec m -r tests
|
||||
|
||||
run-tests:
|
||||
name: Run tests
|
||||
runs-on: ubuntu-latest
|
||||
needs: [unit-and-lint]
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
|
||||
name: Checkout
|
||||
with:
|
||||
fetch-depth: 100
|
||||
|
||||
- name: Install Helm
|
||||
if: ${{ matrix.app != '.gitkee' }}
|
||||
uses: azure/setup-helm@18bc76811624f360dbd7f18c2d4ecb32c7b87bab # renovate: tag=v1
|
||||
with:
|
||||
version: v3.7.1
|
||||
|
||||
- uses: actions/setup-python@98f2ad02fd48d057ee3b4d4f66525b231c3e52b6 # tag=v3
|
||||
if: ${{ matrix.app != '.gitkee' }}
|
||||
with:
|
||||
python-version: 3.7
|
||||
|
||||
- name: Set up chart-testing
|
||||
if: ${{ matrix.app != '.gitkee' }}
|
||||
uses: helm/chart-testing-action@dae259e86a35ff09145c0805e2d7dd3f7207064a # tag=v2.2.1
|
||||
|
||||
##
|
||||
# Chart-Testing Section
|
||||
##
|
||||
|
||||
- uses: actions/setup-python@98f2ad02fd48d057ee3b4d4f66525b231c3e52b6 # tag=v3
|
||||
if: ${{ matrix.app != '.gitkee' }}
|
||||
with:
|
||||
python-version: 3.7
|
||||
|
||||
- name: Create k3d cluster
|
||||
uses: nolar/setup-k3d-k3s@v1
|
||||
with:
|
||||
version: v1.22.4+k3s1
|
||||
|
||||
- name: Run chart-testing (install)
|
||||
run: find ./ -type f -name *.yaml -exec sed -i 's/tccr.io/ghcr.io/gI' {} \; && ct install --config .github/ct-install.yaml --charts 'helper-charts/common-test'
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -48,3 +48,7 @@ charts/**/charts/*.tgz
|
||||
charts/**/render/*
|
||||
catalog/
|
||||
dh_catalog/
|
||||
charts/*/Chart.lock
|
||||
charts/*/charts
|
||||
helper-charts/*/Chart.lock
|
||||
helper-charts/*/charts
|
||||
|
||||
12
Gemfile
12
Gemfile
@@ -1,12 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source 'https://rubygems.org'
|
||||
|
||||
group :test do
|
||||
gem 'm'
|
||||
gem 'minitest'
|
||||
gem 'minitest-implicit-subject'
|
||||
gem 'minitest-reporters'
|
||||
gem 'pry'
|
||||
gem 'ruby-jq'
|
||||
end
|
||||
@@ -15,4 +15,4 @@ maintainers:
|
||||
name: common
|
||||
sources: null
|
||||
type: library
|
||||
version: 9.3.29
|
||||
version: 10.0.1
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
This template serves as a blueprint for External Interface objects that are created
|
||||
using the SCALE GUI.
|
||||
*/}}
|
||||
{{- define "common.classes.externalInterfaces" -}}
|
||||
{{- define "tc.common.scale.externalInterfaces" -}}
|
||||
{{- if .Values.global.ixChartContext }}
|
||||
{{- range $index, $iface := .Values.ixExternalInterfacesConfiguration }}
|
||||
---
|
||||
apiVersion: "k8s.cni.cncf.io/v1"
|
||||
@@ -12,4 +13,5 @@ metadata:
|
||||
spec:
|
||||
config: '{{ $iface }}'
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -1,9 +1,9 @@
|
||||
{{- define "common.configmap.portal" -}}
|
||||
|
||||
{{- define "tc.common.scale.portal" -}}
|
||||
{{- if .Values.ixChartContext }}
|
||||
{{- if .Values.portal }}
|
||||
{{- if .Values.portal.enabled }}
|
||||
{{- $primaryService := get .Values.service (include "common.service.primary" .) }}
|
||||
{{- $primaryPort := get $primaryService.ports (include "common.classes.service.ports.primary" (dict "values" $primaryService)) -}}
|
||||
{{- $primaryService := get .Values.service (include "tc.common.lib.util.service.primary" .) }}
|
||||
{{- $primaryPort := get $primaryService.ports (include "tc.common.lib.util.service.ports.primary" (dict "values" $primaryService)) -}}
|
||||
{{- $ingr := index .Values.ingress (keys .Values.ingress | first) -}}
|
||||
{{- $host := "$node_ip" }}
|
||||
{{- $port := 443 }}
|
||||
@@ -80,9 +80,7 @@ kind: ConfigMap
|
||||
metadata:
|
||||
name: portal
|
||||
labels:
|
||||
{{ include "common.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
rollme: {{ randAlphaNum 5 | quote }}
|
||||
{{ include "tc.common.labels" . | nindent 4 }}
|
||||
data:
|
||||
protocol: {{ $protocol }}
|
||||
host: {{ $host | quote }}
|
||||
@@ -91,4 +89,5 @@ data:
|
||||
url: {{ ( printf "%v://%v:%v%v" $protocol $host $port $path ) | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -1,6 +1,6 @@
|
||||
{{- define "common.cert.secret" -}}
|
||||
{{- define "tc.common.scale.cert.secret" -}}
|
||||
|
||||
{{- $secretName := include "common.names.fullname" . -}}
|
||||
{{- $secretName := include "tc.common.names.fullname" . -}}
|
||||
|
||||
{{- if .ObjectValues.certHolder -}}
|
||||
{{- if hasKey .ObjectValues.certHolder "nameOverride" -}}
|
||||
@@ -13,7 +13,7 @@
|
||||
{{- $secretName = ( printf "%v-%v-%v-%v" $secretName "scalecert" "ixcert" .Values.scaleCert ) -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- if eq (include "common.cert.available" $ ) "true" -}}
|
||||
{{- if eq (include "tc.common.scale.cert.available" $ ) "true" -}}
|
||||
|
||||
|
||||
{{- printf "\n%s\n" "---" }}
|
||||
@@ -21,10 +21,10 @@ apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ $secretName }}-{{ .Release.Revision }}
|
||||
labels: {{ include "common.labels" . | nindent 4 }}
|
||||
labels: {{ include "tc.common.labels" . | nindent 4 }}
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
tls.crt: {{ (include "common.cert.publicKey" $ ) | toString | b64enc | quote }}
|
||||
tls.key: {{ (include "common.cert.privateKey" $ ) | toString | b64enc | quote }}
|
||||
tls.crt: {{ (include "tc.common.scale.cert.publicKey" $ ) | toString | b64enc | quote }}
|
||||
tls.key: {{ (include "tc.common.scale.cert.privateKey" $ ) | toString | b64enc | quote }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -1,11 +1,11 @@
|
||||
{{/*
|
||||
Retrieve true/false if certificate is configured
|
||||
*/}}
|
||||
{{- define "common.cert.available" -}}
|
||||
{{- define "tc.common.scale.cert.available" -}}
|
||||
{{- if .ObjectValues.certHolder.scaleCert -}}
|
||||
{{- $values := (. | mustDeepCopy) -}}
|
||||
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.ObjectValues.certHolder.scaleCert) -}}
|
||||
{{- template "common.cert_present" $values -}}
|
||||
{{- template "tc.common.scale.cert_present" $values -}}
|
||||
{{- else -}}
|
||||
{{- false -}}
|
||||
{{- end -}}
|
||||
@@ -15,26 +15,26 @@ Retrieve true/false if certificate is configured
|
||||
{{/*
|
||||
Retrieve public key of certificate
|
||||
*/}}
|
||||
{{- define "common.cert.publicKey" -}}
|
||||
{{- define "tc.common.scale.cert.publicKey" -}}
|
||||
{{- $values := (. | mustDeepCopy) -}}
|
||||
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.ObjectValues.certHolder.scaleCert "publicKey" true) -}}
|
||||
{{ include "common.cert" $values }}
|
||||
{{ include "tc.common.scale.cert" $values }}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{/*
|
||||
Retrieve private key of certificate
|
||||
*/}}
|
||||
{{- define "common.cert.privateKey" -}}
|
||||
{{- define "tc.common.scale.cert.privateKey" -}}
|
||||
{{- $values := (. | mustDeepCopy) -}}
|
||||
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.ObjectValues.certHolder.scaleCert) -}}
|
||||
{{ include "common.cert" $values }}
|
||||
{{ include "tc.common.scale.cert" $values }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Retrieve true/false if certificate is available in ixCertificates
|
||||
*/}}
|
||||
{{- define "common.cert_present" -}}
|
||||
{{- define "tc.common.scale.cert_present" -}}
|
||||
{{- $values := . -}}
|
||||
{{- hasKey $values.Values.ixCertificates ($values.commonCertOptions.certKeyName | toString) -}}
|
||||
{{- end -}}
|
||||
@@ -43,7 +43,7 @@ Retrieve true/false if certificate is available in ixCertificates
|
||||
{{/*
|
||||
Retrieve certificate from variable name
|
||||
*/}}
|
||||
{{- define "common.cert" -}}
|
||||
{{- define "tc.common.scale.cert" -}}
|
||||
{{- $values := . -}}
|
||||
{{- $certKey := ($values.commonCertOptions.certKeyName | toString) -}}
|
||||
{{- if hasKey $values.Values.ixCertificates $certKey -}}
|
||||
@@ -1,37 +0,0 @@
|
||||
{{/*
|
||||
This template serves as a blueprint for horizontal pod autoscaler objects that are created
|
||||
using the common library.
|
||||
*/}}
|
||||
{{- define "common.hpa" -}}
|
||||
{{- if .Values.autoscaling.enabled -}}
|
||||
{{- $hpaName := include "common.names.fullname" . -}}
|
||||
{{- $targetName := include "common.names.fullname" . }}
|
||||
---
|
||||
apiVersion: autoscaling/v2beta1
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ $hpaName }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: {{ include "common.names.controllerType" . }}
|
||||
name: {{ .Values.autoscaling.target | default $targetName }}
|
||||
minReplicas: {{ .Values.autoscaling.minReplicas | default 1 }}
|
||||
maxReplicas: {{ .Values.autoscaling.maxReplicas | default 3 }}
|
||||
metrics:
|
||||
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -1,40 +0,0 @@
|
||||
{{/*
|
||||
This template serves as the blueprint for the DaemonSet objects that are created
|
||||
within the common library.
|
||||
*/}}
|
||||
{{- define "common.daemonset" }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- with .Values.controller.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- include "common.annotations.workload" . | nindent 4 }}
|
||||
{{- with .Values.controller.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "common.labels.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- include "common.annotations.workload.spec" . | nindent 8 }}
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "common.labels.selectorLabels" . | nindent 8 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- include "common.controller.pod" . | nindent 6 }}
|
||||
{{- end }}
|
||||
@@ -1,63 +0,0 @@
|
||||
{{/*
|
||||
Secondary entrypoint and primary loader for the common chart
|
||||
*/}}
|
||||
{{- define "common.postSetup" -}}
|
||||
{{- /* Render the externalInterfaces */ -}}
|
||||
{{ include "common.classes.externalInterfaces" . | nindent 0 }}
|
||||
|
||||
{{- /* Enable code-server add-on if required */ -}}
|
||||
{{- if .Values.addons.codeserver.enabled }}
|
||||
{{- include "common.addon.codeserver" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Enable VPN add-on if required */ -}}
|
||||
{{- if ne "disabled" .Values.addons.vpn.type -}}
|
||||
{{- include "common.addon.vpn" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Enable promtail add-on if required */ -}}
|
||||
{{- if .Values.addons.promtail.enabled }}
|
||||
{{- include "common.addon.promtail" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Enable netshoot add-on if required */ -}}
|
||||
{{- if .Values.addons.netshoot.enabled }}
|
||||
{{- include "common.addon.netshoot" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Build the confimap */ -}}
|
||||
{{ include "common.configmap" . | nindent 0 }}
|
||||
|
||||
{{- /* Build the templates */ -}}
|
||||
{{- include "common.pvc" . }}
|
||||
|
||||
{{- include "common.serviceAccount" . }}
|
||||
|
||||
{{- if .Values.controller.enabled }}
|
||||
{{- if eq .Values.controller.type "deployment" }}
|
||||
{{- include "common.deployment" . | nindent 0 }}
|
||||
{{ else if eq .Values.controller.type "daemonset" }}
|
||||
{{- include "common.daemonset" . | nindent 0 }}
|
||||
{{ else if eq .Values.controller.type "statefulset" }}
|
||||
{{- include "common.statefulset" . | nindent 0 }}
|
||||
{{ else }}
|
||||
{{- fail (printf "Not a valid controller.type (%s)" .Values.controller.type) }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{ include "common.rbac" . | nindent 0 }}
|
||||
|
||||
{{ include "common.hpa" . | nindent 0 }}
|
||||
|
||||
{{ include "common.service" . | nindent 0 }}
|
||||
|
||||
{{ include "common.ingress" . | nindent 0 }}
|
||||
|
||||
{{- if .Values.secret -}}
|
||||
{{ include "common.secret" . | nindent 0 }}
|
||||
{{- end -}}
|
||||
|
||||
{{ include "common.configmap.portal" . | nindent 0 }}
|
||||
|
||||
{{ include "common.networkpolicy" . | nindent 0 }}
|
||||
{{- end -}}
|
||||
@@ -1,52 +0,0 @@
|
||||
{{/*
|
||||
This template serves as a blueprint for all PersistentVolumeClaim objects that are created
|
||||
within the common library.
|
||||
*/}}
|
||||
{{- define "common.rbac" -}}
|
||||
{{- if .Values.rbac.enabled }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- with .Values.rbac.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- with .Values.rbac.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.rbac.rules }}
|
||||
rules:
|
||||
{{- . | toYaml | nindent 4 }}
|
||||
{{- end}}
|
||||
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- with .Values.rbac.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- with .Values.rbac.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ include "common.names.serviceAccountName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
{{- with .Values.rbac.subjects }}
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -1,17 +0,0 @@
|
||||
{{/*
|
||||
The Secret object to be created.
|
||||
*/}}
|
||||
{{- define "common.secret" }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
{{- with .Values.secret }}
|
||||
stringData:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -1,43 +0,0 @@
|
||||
{{/*
|
||||
Renders the Service objects required by the chart.
|
||||
*/}}
|
||||
{{- define "common.service" -}}
|
||||
{{- /* Generate named services as required */ -}}
|
||||
{{- range $name, $service := .Values.service }}
|
||||
{{- if $service.enabled -}}
|
||||
{{- $serviceValues := $service -}}
|
||||
|
||||
{{/* set the default nameOverride to the service name */}}
|
||||
{{- if and (not $serviceValues.nameOverride) (ne $name (include "common.service.primary" $)) -}}
|
||||
{{- $_ := set $serviceValues "nameOverride" $name -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- $_ := set $ "ObjectValues" (dict "service" $serviceValues) -}}
|
||||
{{- include "common.classes.service" $ }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Return the primary service object
|
||||
*/}}
|
||||
{{- define "common.service.primary" -}}
|
||||
{{- $enabledServices := dict -}}
|
||||
{{- range $name, $service := .Values.service -}}
|
||||
{{- if $service.enabled -}}
|
||||
{{- $_ := set $enabledServices $name . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $result := "" -}}
|
||||
{{- range $name, $service := $enabledServices -}}
|
||||
{{- if and (hasKey $service "primary") $service.primary -}}
|
||||
{{- $result = $name -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not $result -}}
|
||||
{{- $result = keys $enabledServices | first -}}
|
||||
{{- end -}}
|
||||
{{- $result -}}
|
||||
{{- end -}}
|
||||
@@ -1,18 +0,0 @@
|
||||
{{/*
|
||||
The ServiceAccount object to be created.
|
||||
*/}}
|
||||
{{- define "common.serviceAccount" }}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ default (include "common.names.fullname" .) .Values.serviceAccount.name }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -2,22 +2,22 @@
|
||||
Template to render code-server addon
|
||||
It will include / inject the required templates based on the given values.
|
||||
*/}}
|
||||
{{- define "common.addon.codeserver" -}}
|
||||
{{- define "tc.common.addon.codeserver" -}}
|
||||
{{- if .Values.addons.codeserver.enabled -}}
|
||||
{{/* Append the code-server container to the additionalContainers */}}
|
||||
{{- $container := include "common.addon.codeserver.container" . | fromYaml -}}
|
||||
{{- $container := include "tc.common.addon.codeserver.container" . | fromYaml -}}
|
||||
{{- if $container -}}
|
||||
{{- $_ := set .Values.additionalContainers "addon-codeserver" $container -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Include the deployKeySecret if not empty */}}
|
||||
{{- $secret := include "common.addon.codeserver.deployKeySecret" . -}}
|
||||
{{- $secret := include "tc.common.addon.codeserver.deployKeySecret" . -}}
|
||||
{{- if $secret -}}
|
||||
{{- $secret | nindent 0 -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Append the secret volume to the volumes */}}
|
||||
{{- $volume := include "common.addon.codeserver.deployKeyVolumeSpec" . | fromYaml -}}
|
||||
{{- $volume := include "tc.common.addon.codeserver.deployKeyVolumeSpec" . | fromYaml -}}
|
||||
{{- if $volume -}}
|
||||
{{- $_ := set .Values.persistence "deploykey" (dict "enabled" "true" "mountPath" "-" "type" "custom" "volumeSpec" $volume) -}}
|
||||
{{- end -}}
|
||||
@@ -27,7 +27,7 @@ It will include / inject the required templates based on the given values.
|
||||
{{- $serviceValues := .Values.addons.codeserver.service -}}
|
||||
{{- $_ := set $serviceValues "nameOverride" "codeserver" -}}
|
||||
{{- $_ := set $ "ObjectValues" (dict "service" $serviceValues) -}}
|
||||
{{- include "common.classes.service" $ -}}
|
||||
{{- include "tc.common.class.service" $ -}}
|
||||
{{- $_ := unset $ "ObjectValues" -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -37,13 +37,13 @@ It will include / inject the required templates based on the given values.
|
||||
{{- $_ := set $ingressValues "nameOverride" "codeserver" -}}
|
||||
|
||||
{{/* Determine the target service name & port */}}
|
||||
{{- $svcName := printf "%v-codeserver" (include "common.names.fullname" .) -}}
|
||||
{{- $svcName := printf "%v-codeserver" (include "tc.common.names.fullname" .) -}}
|
||||
{{- $svcPort := .Values.addons.codeserver.service.ports.codeserver.port -}}
|
||||
{{- range $_, $host := $ingressValues.hosts -}}
|
||||
{{- $_ := set (index $host.paths 0) "service" (dict "name" $svcName "port" $svcPort) -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $ "ObjectValues" (dict "ingress" $ingressValues) -}}
|
||||
{{- include "common.classes.ingress" $ -}}
|
||||
{{- include "tc.common.class.ingress" $ -}}
|
||||
{{- $_ := unset $ "ObjectValues" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{/*
|
||||
The code-server sidecar container to be inserted.
|
||||
*/}}
|
||||
{{- define "common.addon.codeserver.container" -}}
|
||||
{{- define "tc.common.addon.codeserver.container" -}}
|
||||
name: codeserver
|
||||
image: "{{ .Values.codeserverImage.repository }}:{{ .Values.codeserverImage.tag }}"
|
||||
imagePullPolicy: {{ .Values.codeserverImage.pullPolicy }}
|
||||
@@ -34,7 +34,7 @@ args:
|
||||
- "--port"
|
||||
- "{{ .Values.addons.codeserver.service.ports.codeserver.port }}"
|
||||
- {{ .Values.addons.codeserver.workingDir | default "/" }}
|
||||
{{- with (include "common.controller.volumeMounts" . | trim) }}
|
||||
{{- with (include "tc.common.controller.volumeMounts" . | trim) }}
|
||||
volumeMounts:
|
||||
{{ nindent 2 . }}
|
||||
{{- end }}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
{{/*
|
||||
The OpenVPN credentials secrets to be included.
|
||||
*/}}
|
||||
{{- define "common.addon.codeserver.deployKeySecret" -}}
|
||||
{{- define "tc.common.addon.codeserver.deployKeySecret" -}}
|
||||
{{- if or .Values.addons.codeserver.git.deployKey .Values.addons.codeserver.git.deployKeyBase64 }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "common.names.fullname" . }}-deploykey
|
||||
name: {{ template "tc.common.names.fullname" . }}-deploykey
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- include "tc.common.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
{{- if .Values.addons.codeserver.git.deployKey }}
|
||||
stringData:
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{{/*
|
||||
The volume (referencing git deploykey) to be inserted into additionalVolumes.
|
||||
*/}}
|
||||
{{- define "common.addon.codeserver.deployKeyVolumeSpec" -}}
|
||||
{{- define "tc.common.addon.codeserver.deployKeyVolumeSpec" -}}
|
||||
{{- if or .Values.addons.codeserver.git.deployKey .Values.addons.codeserver.git.deployKeyBase64 .Values.addons.codeserver.git.deployKeySecret }}
|
||||
secret:
|
||||
{{- if .Values.addons.codeserver.git.deployKeySecret }}
|
||||
secretName: {{ .Values.addons.codeserver.git.deployKeySecret }}
|
||||
{{- else }}
|
||||
secretName: {{ include "common.names.fullname" . }}-deploykey
|
||||
secretName: {{ include "tc.common.names.fullname" . }}-deploykey
|
||||
{{- end }}
|
||||
defaultMode: 256
|
||||
items:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{/*
|
||||
The netshoot sidecar container to be inserted.
|
||||
*/}}
|
||||
{{- define "common.addon.netshoot.container" -}}
|
||||
{{- define "tc.common.addon.netshoot.container" -}}
|
||||
name: netshoot
|
||||
image: "{{ .Values.netshootImage.repository }}:{{ .Values.netshootImage.tag }}"
|
||||
imagePullPolicy: {{ .Values.netshootImage.pullPolicy }}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
Template to render netshoot addon
|
||||
It will include / inject the required templates based on the given values.
|
||||
*/}}
|
||||
{{- define "common.addon.netshoot" -}}
|
||||
{{- define "tc.common.addon.netshoot" -}}
|
||||
{{- if .Values.addons.netshoot.enabled -}}
|
||||
{{/* Append the netshoot container to the additionalContainers */}}
|
||||
{{- $container := include "common.addon.netshoot.container" . | fromYaml -}}
|
||||
{{- $container := include "tc.common.addon.netshoot.container" . | fromYaml -}}
|
||||
{{- if $container -}}
|
||||
{{- $_ := set .Values.additionalContainers "addon-netshoot" $container -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
{{/*
|
||||
The promtail config to be included.
|
||||
*/}}
|
||||
{{- define "common.addon.promtail.configmap" -}}
|
||||
{{- define "tc.common.addon.promtail.configmap" -}}
|
||||
{{- if .Values.addons.promtail.enabled }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}-promtail
|
||||
name: {{ include "tc.common.names.fullname" . }}-promtail
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- include "tc.common.labels" . | nindent 4 }}
|
||||
data:
|
||||
promtail.yaml: |
|
||||
server:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{/*
|
||||
The promtail sidecar container to be inserted.
|
||||
*/}}
|
||||
{{- define "common.addon.promtail.container" -}}
|
||||
{{- define "tc.common.addon.promtail.container" -}}
|
||||
name: promtail
|
||||
image: "{{ .Values.promtailImage.repository }}:{{ .Values.promtailImage.tag }}"
|
||||
imagePullPolicy: {{ .Values.promtailImage.pullPolicy }}
|
||||
@@ -35,7 +35,7 @@ volumeMounts:
|
||||
mountPath: /etc/promtail/promtail.yaml
|
||||
subPath: promtail.yaml
|
||||
readOnly: true
|
||||
{{- with (include "common.controller.volumeMounts" . | trim) }}
|
||||
{{- with (include "tc.common.controller.volumeMounts" . | trim) }}
|
||||
{{ nindent 2 . }}
|
||||
{{- end }}
|
||||
{{- with .Values.addons.promtail.resources }}
|
||||
|
||||
@@ -2,22 +2,22 @@
|
||||
Template to render promtail addon
|
||||
It will include / inject the required templates based on the given values.
|
||||
*/}}
|
||||
{{- define "common.addon.promtail" -}}
|
||||
{{- define "tc.common.addon.promtail" -}}
|
||||
{{- if .Values.addons.promtail.enabled -}}
|
||||
{{/* Append the promtail container to the additionalContainers */}}
|
||||
{{- $container := include "common.addon.promtail.container" . | fromYaml -}}
|
||||
{{- $container := include "tc.common.addon.promtail.container" . | fromYaml -}}
|
||||
{{- if $container -}}
|
||||
{{- $_ := set .Values.additionalContainers "addon-promtail" $container -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Include the configmap if not empty */}}
|
||||
{{- $configmap := include "common.addon.promtail.configmap" . -}}
|
||||
{{- $configmap := include "tc.common.addon.promtail.configmap" . -}}
|
||||
{{- if $configmap -}}
|
||||
{{- $configmap | nindent 0 -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Append the promtail config volume to the volumes */}}
|
||||
{{- $volume := include "common.addon.promtail.volumeSpec" . | fromYaml -}}
|
||||
{{- $volume := include "tc.common.addon.promtail.volumeSpec" . | fromYaml -}}
|
||||
{{- if $volume -}}
|
||||
{{- $_ := set .Values.persistence "promtail-config" (dict "enabled" "true" "mountPath" "-" "type" "custom" "volumeSpec" $volume) -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{/*
|
||||
The volume (referencing config) to be inserted into additionalVolumes.
|
||||
*/}}
|
||||
{{- define "common.addon.promtail.volumeSpec" -}}
|
||||
{{- define "tc.common.addon.promtail.volumeSpec" -}}
|
||||
configMap:
|
||||
name: {{ include "common.names.fullname" . }}-promtail
|
||||
name: {{ include "tc.common.names.fullname" . }}-promtail
|
||||
{{- end -}}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
Template to render VPN addon
|
||||
It will include / inject the required templates based on the given values.
|
||||
*/}}
|
||||
{{- define "common.addon.vpn" -}}
|
||||
{{- define "tc.common.addon.vpn" -}}
|
||||
{{- if ne "disabled" .Values.addons.vpn.type -}}
|
||||
{{- if eq "openvpn" .Values.addons.vpn.type -}}
|
||||
{{- include "common.addon.openvpn" . }}
|
||||
{{- include "tc.common.addon.openvpn" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if eq "wireguard" .Values.addons.vpn.type -}}
|
||||
{{- include "common.addon.wireguard" . }}
|
||||
{{- include "tc.common.addon.wireguard" . }}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
Template to render OpenVPN addon. It will add the container to the list of additionalContainers
|
||||
and add a credentials secret if speciffied.
|
||||
*/}}
|
||||
{{- define "common.addon.openvpn" -}}
|
||||
{{- define "tc.common.addon.openvpn" -}}
|
||||
{{/* Append the openVPN container to the additionalContainers */}}
|
||||
{{- $container := include "common.addon.openvpn.container" . | fromYaml -}}
|
||||
{{- $container := include "tc.common.addon.openvpn.container" . | fromYaml -}}
|
||||
{{- if $container -}}
|
||||
{{- $_ := set .Values.additionalContainers "addon-openvpn" $container -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Include the secret if not empty */}}
|
||||
{{- $secret := include "common.addon.openvpn.secret" . -}}
|
||||
{{- $secret := include "tc.common.addon.openvpn.secret" . -}}
|
||||
{{- if $secret -}}
|
||||
{{- $secret | nindent 0 -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{/*
|
||||
The OpenVPN sidecar container to be inserted.
|
||||
*/}}
|
||||
{{- define "common.addon.openvpn.container" -}}
|
||||
{{- define "tc.common.addon.openvpn.container" -}}
|
||||
name: openvpn
|
||||
image: "{{ .Values.openvpnImage.repository }}:{{ .Values.openvpnImage.tag }}"
|
||||
imagePullPolicy: {{ .Values.openvpnImage.pullPolicy }}
|
||||
@@ -52,7 +52,7 @@ env:
|
||||
{{- if or ( .Values.addons.vpn.openvpn.username ) ( .Values.addons.vpn.openvpn.password ) }}
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: {{ include "common.names.fullname" . }}-openvpn
|
||||
name: {{ include "tc.common.names.fullname" . }}-openvpn
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- mountPath: {{ .Values.persistence.shared.mountPath }}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{{/*
|
||||
The OpenVPN credentials secrets to be included.
|
||||
*/}}
|
||||
{{- define "common.addon.openvpn.secret" -}}
|
||||
{{- define "tc.common.addon.openvpn.secret" -}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" $ }}-openvpn
|
||||
name: {{ include "tc.common.names.fullname" $ }}-openvpn
|
||||
labels:
|
||||
{{- include "common.labels" $ | nindent 4 }}
|
||||
{{- include "tc.common.labels" $ | nindent 4 }}
|
||||
data:
|
||||
VPN_AUTH: {{ ( printf "%v;%v" .Values.addons.vpn.openvpn.username .Values.addons.vpn.openvpn.password ) | b64enc }}
|
||||
{{- end -}}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
Template to render Wireguard addon. It will add the container to the list of additionalContainers.
|
||||
*/}}
|
||||
*/}}
|
||||
{{- define "common.addon.wireguard" -}}
|
||||
{{- define "tc.common.addon.wireguard" -}}
|
||||
{{/* Append the Wireguard container to the additionalContainers */}}
|
||||
{{- $container := fromYaml (include "common.addon.wireguard.container" .) -}}
|
||||
{{- $container := fromYaml (include "tc.common.addon.wireguard.container" .) -}}
|
||||
{{- if $container -}}
|
||||
{{- $_ := set .Values.additionalContainers "addon-wireguard" $container -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{/*
|
||||
The Wireguard sidecar container to be inserted.
|
||||
*/}}
|
||||
{{- define "common.addon.wireguard.container" -}}
|
||||
{{- define "tc.common.addon.wireguard.container" -}}
|
||||
name: wireguard
|
||||
image: "{{ .Values.wireguardImage.repository }}:{{ .Values.wireguardImage.tag }}"
|
||||
imagePullPolicy: {{ .Values.wireguardImage.pullPolicy }}
|
||||
|
||||
47
charts/common/templates/class/_HorizontalPodAutoscaler.tpl
Normal file
47
charts/common/templates/class/_HorizontalPodAutoscaler.tpl
Normal file
@@ -0,0 +1,47 @@
|
||||
{{/*
|
||||
This template serves as a blueprint for horizontal pod autoscaler objects that are created
|
||||
using the common library.
|
||||
*/}}
|
||||
{{- define "tc.common.class.hpa" -}}
|
||||
{{- $targetName := include "tc.common.names.fullname" . }}
|
||||
{{- $fullName := include "tc.common.names.fullname" . -}}
|
||||
{{- $hpaName := $fullName -}}
|
||||
{{- $values := .Values.hpa -}}
|
||||
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.hpa -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $hpaName = printf "%v-%v" $hpaName $values.nameOverride -}}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ $hpaName }}
|
||||
labels:
|
||||
{{- include "tc.common.labels" . | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: {{ $values.targetKind | default ( include "tc.common.names.controllerType" . ) }}
|
||||
name: {{ $values.target | default $targetName }}
|
||||
minReplicas: {{ $values.minReplicas | default 1 }}
|
||||
maxReplicas: {{ $values.maxReplicas | default 3 }}
|
||||
metrics:
|
||||
{{- if $values.targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
targetAverageUtilization: {{ $values.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- if $values.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
targetAverageUtilization: {{ $values.targetMemoryUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -2,8 +2,8 @@
|
||||
This template serves as a blueprint for all configMap objects that are created
|
||||
within the common library.
|
||||
*/}}
|
||||
{{- define "common.classes.configmap" -}}
|
||||
{{- $fullName := include "common.names.fullname" . -}}
|
||||
{{- define "tc.common.class.configmap" -}}
|
||||
{{- $fullName := include "tc.common.names.fullname" . -}}
|
||||
{{- $configMapName := $fullName -}}
|
||||
{{- $values := .Values.configmap -}}
|
||||
|
||||
@@ -21,14 +21,12 @@ apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ $configMapName }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- with $values.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with $values.annotations }}
|
||||
{{- with (merge ($values.labels | default dict) (include "tc.common.labels" $ | fromYaml)) }}
|
||||
labels: {{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with (merge ($values.annotations | default dict) (include "tc.common.annotations" $ | fromYaml)) }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
{{- with $values.data }}
|
||||
@@ -2,8 +2,8 @@
|
||||
This template serves as a blueprint for all Ingress objects that are created
|
||||
within the common library.
|
||||
*/}}
|
||||
{{- define "common.classes.ingress" -}}
|
||||
{{- $fullName := include "common.names.fullname" . -}}
|
||||
{{- define "tc.common.class.ingress" -}}
|
||||
{{- $fullName := include "tc.common.names.fullname" . -}}
|
||||
{{- $ingressName := $fullName -}}
|
||||
{{- $values := .Values.ingress -}}
|
||||
|
||||
@@ -17,13 +17,13 @@ within the common library.
|
||||
{{- $ingressName = printf "%v-%v" $ingressName $values.nameOverride -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $primaryService := get .Values.service (include "common.service.primary" .) -}}
|
||||
{{- $autoLinkService := get .Values.service (include "common.service.primary" .) -}}
|
||||
{{- $primaryService := get .Values.service (include "tc.common.lib.util.service.primary" .) -}}
|
||||
{{- $autoLinkService := get .Values.service (include "tc.common.lib.util.service.primary" .) -}}
|
||||
{{- $defaultServiceName := $fullName -}}
|
||||
{{- if and (hasKey $primaryService "nameOverride") $primaryService.nameOverride -}}
|
||||
{{- $defaultServiceName = printf "%v-%v" $defaultServiceName $primaryService.nameOverride -}}
|
||||
{{- end -}}
|
||||
{{- $defaultServicePort := get $primaryService.ports (include "common.classes.service.ports.primary" (dict "values" $primaryService)) -}}
|
||||
{{- $defaultServicePort := get $primaryService.ports (include "tc.common.lib.util.service.ports.primary" (dict "values" $primaryService)) -}}
|
||||
|
||||
{{- if and (hasKey $values "nameOverride") ( $values.nameOverride ) ( $values.autoLink ) -}}
|
||||
{{- $autoLinkService = get .Values.service $values.nameOverride -}}
|
||||
@@ -32,7 +32,7 @@ within the common library.
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{- $isStable := include "common.capabilities.ingress.isStable" . }}
|
||||
{{- $isStable := include "tc.common.capabilities.ingress.isStable" . }}
|
||||
|
||||
{{- $mddwrNamespace := "default" }}
|
||||
{{- if $values.ingressClassName }}
|
||||
@@ -66,20 +66,18 @@ within the common library.
|
||||
{{ end }}
|
||||
|
||||
---
|
||||
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
|
||||
apiVersion: {{ include "tc.common.capabilities.ingress.apiVersion" . }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $ingressName }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- with $values.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with (merge ($values.labels | default dict) (include "tc.common.labels" $ | fromYaml)) }}
|
||||
labels: {{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
"traefik.ingress.kubernetes.io/router.entrypoints": {{ $values.entrypoint | default "websecure" }}
|
||||
"traefik.ingress.kubernetes.io/router.middlewares": {{ $middlewares | quote }}
|
||||
{{- with $values.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- with (merge ($values.annotations | default dict) (include "tc.common.annotations" $ | fromYaml)) }}
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if and $isStable $values.ingressClassName }}
|
||||
@@ -1,40 +1,57 @@
|
||||
{{/*
|
||||
Blueprint for the NetworkPolicy object that can be included in the addon.
|
||||
*/}}
|
||||
{{- define "common.networkpolicy" -}}
|
||||
{{- if .Values.networkPolicy.enabled }}
|
||||
{{- define "tc.common.class.networkpolicy" -}}
|
||||
{{- $fullName := include "tc.common.names.fullname" . -}}
|
||||
{{- $networkPolicyName := $fullName -}}
|
||||
{{- $values := .Values.networkPolicy -}}
|
||||
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.networkPolicy -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $networkPolicyName = printf "%v-%v" $networkPolicyName $values.nameOverride -}}
|
||||
{{- end }}
|
||||
---
|
||||
kind: NetworkPolicy
|
||||
apiVersion: networking.k8s.io/v1
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
name: {{ $networkPolicyName }}
|
||||
{{- with (merge ($values.labels | default dict) (include "tc.common.labels" $ | fromYaml)) }}
|
||||
labels: {{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with (merge ($values.annotations | default dict) (include "tc.common.annotations" $ | fromYaml)) }}
|
||||
annotations:
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
podSelector:
|
||||
{{- if .Values.networkPolicy.podSelector }}
|
||||
{{- with .Values.networkPolicy.podSelector }}
|
||||
{{- if $values.podSelector }}
|
||||
{{- with $values.podSelector }}
|
||||
{{- . | toYaml | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- else }}
|
||||
matchLabels:
|
||||
{{- include "common.labels.selectorLabels" . | nindent 6 }}
|
||||
{{- include "tc.common.labels.selectorLabels" . | nindent 6 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.networkPolicy.policyType }}
|
||||
{{- if eq .Values.networkPolicy.policyType "ingress" }}
|
||||
{{- if $values.policyType }}
|
||||
{{- if eq $values.policyType "ingress" }}
|
||||
policyTypes: ["Ingress"]
|
||||
{{- else if eq .Values.networkPolicy.policyType "egress" }}
|
||||
{{- else if eq $values.policyType "egress" }}
|
||||
policyTypes: ["Egress"]
|
||||
|
||||
{{- else if eq .Values.networkPolicy.policyType "ingress-egress" }}
|
||||
{{- else if eq $values.policyType "ingress-egress" }}
|
||||
policyTypes: ["Ingress", "Egress"]
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .Values.networkPolicy.egress }}
|
||||
{{- if $values.egress }}
|
||||
egress:
|
||||
{{- range .Values.networkPolicy.egress }}
|
||||
{{- range $values.egress }}
|
||||
- to:
|
||||
{{- range .to }}
|
||||
{{- $nss := false }}
|
||||
@@ -95,9 +112,9 @@ spec:
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .Values.networkPolicy.ingress }}
|
||||
{{- if $values.ingress }}
|
||||
ingress:
|
||||
{{- range .Values.networkPolicy.ingress }}
|
||||
{{- range $values.ingress }}
|
||||
- from:
|
||||
{{- range .from }}
|
||||
{{- $nss := false }}
|
||||
@@ -156,7 +173,4 @@ spec:
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -2,14 +2,14 @@
|
||||
This template serves as a blueprint for all PersistentVolumeClaim objects that are created
|
||||
within the common library.
|
||||
*/}}
|
||||
{{- define "common.classes.pvc" -}}
|
||||
{{- define "tc.common.class.pvc" -}}
|
||||
{{- $values := .Values.persistence -}}
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.persistence -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
{{- $pvcName := include "common.names.fullname" . -}}
|
||||
{{- $pvcName := include "tc.common.names.fullname" . -}}
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- if not (eq $values.nameOverride "-") -}}
|
||||
{{- $pvcName = printf "%v-%v" $pvcName $values.nameOverride -}}
|
||||
@@ -28,14 +28,14 @@ metadata:
|
||||
{{- if $values.retain }}
|
||||
"helm.sh/resource-policy": keep
|
||||
{{- end }}
|
||||
{{- with $values.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- with (merge ($values.annotations | default dict) (include "tc.common.annotations" $ | fromYaml)) }}
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- include "tc.common.labels" . | nindent 4 }}
|
||||
{{- with $values.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
@@ -43,8 +43,12 @@ spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ $values.size | default "999Gi" | quote }}
|
||||
{{ include "common.storage.class" ( dict "persistence" $values "global" $ ) }}
|
||||
{{- with $values.spec }}
|
||||
{{ tpl ( toYaml . ) $ | indent 2 }}
|
||||
{{- end }}
|
||||
{{ include "tc.common.storage.class" ( dict "persistence" $values "global" $ ) }}
|
||||
{{- if $values.volumeName }}
|
||||
volumeName: {{ $values.volumeName | quote }}
|
||||
{{- end }}
|
||||
|
||||
{{- end -}}
|
||||
64
charts/common/templates/class/_rbac.tpl
Normal file
64
charts/common/templates/class/_rbac.tpl
Normal file
@@ -0,0 +1,64 @@
|
||||
{{/*
|
||||
This template serves as a blueprint for rbac objects that are created
|
||||
using the common library.
|
||||
*/}}
|
||||
{{- define "tc.common.class.rbac" -}}
|
||||
{{- $targetName := include "tc.common.names.fullname" . }}
|
||||
{{- $fullName := include "tc.common.names.fullname" . -}}
|
||||
{{- $rbacName := $fullName -}}
|
||||
{{- $values := .Values.rbac -}}
|
||||
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.rbac -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $rbacName = printf "%v-%v" $rbacName $values.nameOverride -}}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ $rbacName }}
|
||||
labels:
|
||||
{{- include "tc.common.labels" . | nindent 4 }}
|
||||
{{- with $values.labels }}
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- with (merge ($values.annotations | default dict) (include "tc.common.annotations" $ | fromYaml)) }}
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with $values.rules }}
|
||||
rules:
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end}}
|
||||
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ $rbacName }}
|
||||
labels:
|
||||
{{- include "tc.common.labels" . | nindent 4 }}
|
||||
{{- with $values.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- with (merge ($values.annotations | default dict) (include "tc.common.annotations" $ | fromYaml)) }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ $rbacName }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ default (include "tc.common.names.serviceAccountName" .) $values.serviceAccountName }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- with $values.subjects }}
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
35
charts/common/templates/class/_secret.tpl
Normal file
35
charts/common/templates/class/_secret.tpl
Normal file
@@ -0,0 +1,35 @@
|
||||
{{/*
|
||||
This template serves as a blueprint for all secret objects that are created
|
||||
within the common library.
|
||||
*/}}
|
||||
{{- define "tc.common.class.secret" -}}
|
||||
{{- $fullName := include "tc.common.names.fullname" . -}}
|
||||
{{- $secretName := $fullName -}}
|
||||
{{- $values := .Values.secret -}}
|
||||
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.secret -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $secretName = printf "%v-%v" $secretName $values.nameOverride -}}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: secret
|
||||
metadata:
|
||||
name: {{ $secretName }}
|
||||
{{- with (merge ($values.labels | default dict) (include "tc.common.labels" $ | fromYaml)) }}
|
||||
labels: {{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with (merge ($values.annotations | default dict) (include "tc.common.annotations" $ | fromYaml)) }}
|
||||
annotations:
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
stringData:
|
||||
{{- with $values.data }}
|
||||
{{- tpl (toYaml .) $ | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -2,7 +2,7 @@
|
||||
This template serves as a blueprint for all Service objects that are created
|
||||
within the common library.
|
||||
*/}}
|
||||
{{- define "common.classes.service" -}}
|
||||
{{- define "tc.common.class.service" -}}
|
||||
{{- $values := .Values.service -}}
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.service -}}
|
||||
@@ -10,31 +10,29 @@ within the common library.
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- $serviceName := include "common.names.fullname" . -}}
|
||||
{{- $serviceName := include "tc.common.names.fullname" . -}}
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $serviceName = printf "%v-%v" $serviceName $values.nameOverride -}}
|
||||
{{ end -}}
|
||||
{{- $svcType := $values.type | default "" -}}
|
||||
{{- $primaryPort := get $values.ports (include "common.classes.service.ports.primary" (dict "values" $values)) }}
|
||||
{{- $primaryPort := get $values.ports (include "tc.common.lib.util.service.ports.primary" (dict "values" $values)) }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $serviceName }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- if $values.labels }}
|
||||
{{ toYaml $values.labels | nindent 4 }}
|
||||
{{- with (merge ($values.labels | default dict) (include "tc.common.labels" $ | fromYaml)) }}
|
||||
labels: {{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- if eq ( $primaryPort.protocol | default "" ) "HTTPS" }}
|
||||
traefik.ingress.kubernetes.io/service.serversscheme: https
|
||||
{{- end }}
|
||||
{{- if eq ( $svcType | default "" ) "LoadBalancer" }}
|
||||
metallb.universe.tf/allow-shared-ip: {{ include "common.names.fullname" . }}
|
||||
metallb.universe.tf/allow-shared-ip: {{ include "tc.common.names.fullname" . }}
|
||||
{{- end }}
|
||||
{{- with $values.annotations }}
|
||||
{{ toYaml . | nindent 4 }}
|
||||
{{- with (merge ($values.annotations | default dict) (include "tc.common.annotations" $ | fromYaml)) }}
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if (or (eq $svcType "ClusterIP") (empty $svcType)) }}
|
||||
@@ -51,9 +49,6 @@ spec:
|
||||
{{- if $values.loadBalancerIP }}
|
||||
loadBalancerIP: {{ $values.loadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if $values.externalTrafficPolicy }}
|
||||
externalTrafficPolicy: {{ $values.externalTrafficPolicy }}
|
||||
{{- end }}
|
||||
{{- if $values.loadBalancerSourceRanges }}
|
||||
loadBalancerSourceRanges:
|
||||
{{ toYaml $values.loadBalancerSourceRanges | nindent 4 }}
|
||||
@@ -61,6 +56,9 @@ spec:
|
||||
{{- else }}
|
||||
type: {{ $svcType }}
|
||||
{{- end }}
|
||||
{{- if $values.externalTrafficPolicy }}
|
||||
externalTrafficPolicy: {{ $values.externalTrafficPolicy }}
|
||||
{{- end }}
|
||||
{{- if $values.sessionAffinity }}
|
||||
sessionAffinity: {{ $values.sessionAffinity }}
|
||||
{{- if $values.sessionAffinityConfig }}
|
||||
@@ -109,7 +107,7 @@ spec:
|
||||
{{- tpl (toYaml .) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- include "common.labels.selectorLabels" . | nindent 4 }}
|
||||
{{- include "tc.common.labels.selectorLabels" . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if eq $svcType "ExternalIP" }}
|
||||
@@ -119,7 +117,7 @@ kind: Endpoints
|
||||
metadata:
|
||||
name: {{ $serviceName }}
|
||||
labels:
|
||||
{{- include "common.labels" $ | nindent 4 }}
|
||||
{{- include "tc.common.labels" $ | nindent 4 }}
|
||||
subsets:
|
||||
- addresses:
|
||||
- ip: {{ $values.externalIP }}
|
||||
31
charts/common/templates/class/_serviceaccount.tpl
Normal file
31
charts/common/templates/class/_serviceaccount.tpl
Normal file
@@ -0,0 +1,31 @@
|
||||
{{/*
|
||||
This template serves as a blueprint for ServiceAccount objects that are created
|
||||
using the common library.
|
||||
*/}}
|
||||
{{- define "tc.common.class.serviceaccount" -}}
|
||||
{{- $targetName := include "tc.common.names.fullname" . }}
|
||||
{{- $fullName := include "tc.common.names.fullname" . -}}
|
||||
{{- $saName := $fullName -}}
|
||||
{{- $values := .Values.serviceAccount -}}
|
||||
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.serviceAccount -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
||||
{{- $saName = printf "%v-%v" $saName $values.nameOverride -}}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ $saName }}
|
||||
labels:
|
||||
{{- include "tc.common.labels" . | nindent 4 }}
|
||||
{{- with $values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -1,11 +1,21 @@
|
||||
{{/* Common annotations shared across objects */}}
|
||||
{{- define "common.annotations.workload.spec" -}}
|
||||
rollme: {{ randAlphaNum 5 | quote }}
|
||||
{{- define "tc.common.annotations" -}}
|
||||
{{- with .Values.global.annotations }}
|
||||
{{- range $k, $v := . }}
|
||||
{{- $name := $k }}
|
||||
{{- $value := tpl $v $ }}
|
||||
{{ $name }}: {{ quote $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Annotations on all workload spec objects */}}
|
||||
{{- define "tc.common.annotations.workload.spec" -}}
|
||||
{{- if .Values.ixExternalInterfacesConfigurationNames }}
|
||||
k8s.v1.cni.cncf.io/networks: {{ join ", " .Values.ixExternalInterfacesConfigurationNames }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "common.annotations.workload" -}}
|
||||
rollme: {{ randAlphaNum 5 | quote }}
|
||||
{{/* Annotations on all workload objects */}}
|
||||
{{- define "tc.common.annotations.workload" -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
{{/* Allow KubeVersion to be overridden. */}}
|
||||
{{- define "common.capabilities.ingress.kubeVersion" -}}
|
||||
{{- define "tc.common.capabilities.ingress.kubeVersion" -}}
|
||||
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Return the appropriate apiVersion for Ingress objects */}}
|
||||
{{- define "common.capabilities.ingress.apiVersion" -}}
|
||||
{{- define "tc.common.capabilities.ingress.apiVersion" -}}
|
||||
{{- print "networking.k8s.io/v1" -}}
|
||||
{{- if semverCompare "<1.19" (include "common.capabilities.ingress.kubeVersion" .) -}}
|
||||
{{- if semverCompare "<1.19" (include "tc.common.capabilities.ingress.kubeVersion" .) -}}
|
||||
{{- print "beta1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Check Ingress stability */}}
|
||||
{{- define "common.capabilities.ingress.isStable" -}}
|
||||
{{- if eq (include "common.capabilities.ingress.apiVersion" .) "networking.k8s.io/v1" -}}
|
||||
{{- define "tc.common.capabilities.ingress.isStable" -}}
|
||||
{{- if eq (include "tc.common.capabilities.ingress.apiVersion" .) "networking.k8s.io/v1" -}}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,15 +1,23 @@
|
||||
{{/* Common labels shared across objects */}}
|
||||
{{- define "common.labels" -}}
|
||||
helm.sh/chart: {{ include "common.names.chart" . }}
|
||||
{{ include "common.labels.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
{{- define "tc.common.labels" -}}
|
||||
helm.sh/chart: {{ include "tc.common.names.chart" . }}
|
||||
{{ include "tc.common.labels.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
helm-revision: "{{ .Release.Revision }}"
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- with .Values.global.labels }}
|
||||
{{- range $k, $v := . }}
|
||||
{{- $name := $k }}
|
||||
{{- $value := tpl $v $ }}
|
||||
{{ $name }}: {{ quote $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Selector labels shared across objects */}}
|
||||
{{- define "common.labels.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "common.names.name" . }}
|
||||
{{- define "tc.common.labels.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "tc.common.names.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{/* Expand the name of the chart */}}
|
||||
{{- define "common.names.name" -}}
|
||||
{{- define "tc.common.names.name" -}}
|
||||
{{- $globalNameOverride := "" -}}
|
||||
{{- if hasKey .Values "global" -}}
|
||||
{{- $globalNameOverride = (default $globalNameOverride .Values.global.nameOverride) -}}
|
||||
@@ -12,8 +12,8 @@ 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 "common.names.fullname" -}}
|
||||
{{- $name := include "common.names.name" . -}}
|
||||
{{- define "tc.common.names.fullname" -}}
|
||||
{{- $name := include "tc.common.names.name" . -}}
|
||||
{{- $globalFullNameOverride := "" -}}
|
||||
{{- if hasKey .Values "global" -}}
|
||||
{{- $globalFullNameOverride = (default $globalFullNameOverride .Values.global.fullnameOverride) -}}
|
||||
@@ -31,21 +31,21 @@ If release name contains chart name it will be used as a full name.
|
||||
{{- end -}}
|
||||
|
||||
{{/* Create chart name and version as used by the chart label */}}
|
||||
{{- define "common.names.chart" -}}
|
||||
{{- define "tc.common.names.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Create the name of the ServiceAccount to use */}}
|
||||
{{- define "common.names.serviceAccountName" -}}
|
||||
{{- define "tc.common.names.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{- default (include "common.names.fullname" .) .Values.serviceAccount.name -}}
|
||||
{{- default (include "tc.common.names.fullname" .) .Values.serviceAccount.name -}}
|
||||
{{- else -}}
|
||||
{{- default "default" .Values.serviceAccount.name -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Return the properly cased version of the controller type */}}
|
||||
{{- define "common.names.controllerType" -}}
|
||||
{{- define "tc.common.names.controllerType" -}}
|
||||
{{- if eq .Values.controller.type "deployment" -}}
|
||||
{{- print "Deployment" -}}
|
||||
{{- else if eq .Values.controller.type "daemonset" -}}
|
||||
@@ -60,6 +60,6 @@ If release name contains chart name it will be used as a full name.
|
||||
{{/*
|
||||
Create the "name" + "." + "namespace" fqdn
|
||||
*/}}
|
||||
{{- define "common.names.fqdn" -}}
|
||||
{{- printf "%s.%s" (include "common.names.fullname" .) .Release.Namespace | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- define "tc.common.names.fqdn" -}}
|
||||
{{- printf "%s.%s" (include "tc.common.names.fullname" .) .Release.Namespace | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
{{- define "common.setup" -}}
|
||||
|
||||
{{- /* Merge the local chart values and the common chart defaults */ -}}
|
||||
{{- include "common.values" . }}
|
||||
|
||||
{{- /* Autogenerate postgresql passwords if needed */ -}}
|
||||
{{- include "common.dependencies.postgresql.injector" . }}
|
||||
|
||||
{{- /* Autogenerate redis passwords if needed */ -}}
|
||||
{{- include "common.dependencies.redis.injector" . }}
|
||||
|
||||
{{- /* Autogenerate mariadb passwords if needed */ -}}
|
||||
{{- include "common.dependencies.mariadb.injector" . }}
|
||||
|
||||
{{- /* Autogenerate mongodb passwords if needed */ -}}
|
||||
{{- include "common.dependencies.mongodb.injector" . }}
|
||||
{{- end -}}
|
||||
@@ -1,283 +0,0 @@
|
||||
{{/* Merge the local chart values and the common chart defaults */}}
|
||||
{{- define "common.values" -}}
|
||||
{{- if .Values.common -}}
|
||||
{{- $defaultValues := deepCopy .Values.common -}}
|
||||
{{- $userValues := deepCopy (omit .Values "common") -}}
|
||||
{{- $mergedValues := mustMergeOverwrite $defaultValues $userValues -}}
|
||||
{{- $_ := set . "Values" (deepCopy $mergedValues) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* merge podAnnotationsList with podAnnotations */}}
|
||||
{{- $podAnnotationsDict := dict }}
|
||||
{{- range .Values.podAnnotationsList }}
|
||||
{{- $_ := set $podAnnotationsDict .name .value }}
|
||||
{{- end }}
|
||||
{{- $podanno := merge .Values.podAnnotations $podAnnotationsDict }}
|
||||
{{- $_ := set .Values "podAnnotations" (deepCopy $podanno) -}}
|
||||
|
||||
{{/* merge podLabelsList with podLabels */}}
|
||||
{{- $podLabelsDict := dict }}
|
||||
{{- range .Values.controller.labelsList }}
|
||||
{{- $_ := set $podLabelsDict .name .value }}
|
||||
{{- end }}
|
||||
{{- $podlab := merge .Values.controller.labels $podLabelsDict }}
|
||||
{{- $_ := set .Values.controller "labels" (deepCopy $podlab) -}}
|
||||
|
||||
{{/* merge controllerAnnotationsList with controllerAnnotations */}}
|
||||
{{- $controllerAnnotationsDict := dict }}
|
||||
{{- range .Values.controller.annotationsList }}
|
||||
{{- $_ := set $controllerAnnotationsDict .name .value }}
|
||||
{{- end }}
|
||||
{{- $controlleranno := merge .Values.controller.annotations $controllerAnnotationsDict }}
|
||||
{{- $_ := set .Values.controller "annotations" (deepCopy $controlleranno) -}}
|
||||
|
||||
{{/* merge controllerLabelsList with controllerLabels */}}
|
||||
{{- $controllerLabelsDict := dict }}
|
||||
{{- range .Values.controller.labelsList }}
|
||||
{{- $_ := set $controllerLabelsDict .name .value }}
|
||||
{{- end }}
|
||||
{{- $controllerlab := merge .Values.controller.labels $controllerLabelsDict }}
|
||||
{{- $_ := set .Values "labels" (deepCopy $controllerlab) -}}
|
||||
|
||||
|
||||
|
||||
{{/* merge persistenceList with Persitence */}}
|
||||
{{- $perDict := dict }}
|
||||
{{- range $index, $item := .Values.persistenceList -}}
|
||||
{{- $name := ( printf "list-%s" ( $index | toString ) ) }}
|
||||
{{- if $item.name }}
|
||||
{{- $name = $item.name }}
|
||||
{{- end }}
|
||||
{{- $_ := set $perDict $name $item }}
|
||||
{{- end }}
|
||||
|
||||
{{/* merge deviceList with Persitence */}}
|
||||
{{- range $index, $item := .Values.deviceList -}}
|
||||
{{- $name := ( printf "device-%s" ( $index | toString ) ) }}
|
||||
{{- if $item.name }}
|
||||
{{- $name = $item.name }}
|
||||
{{- end }}
|
||||
{{- $_ := set $perDict $name $item }}
|
||||
{{- end }}
|
||||
{{- $per := merge .Values.persistence $perDict }}
|
||||
{{- $_ := set .Values "persistence" (deepCopy $per) -}}
|
||||
|
||||
|
||||
{{/* merge persistenceAnnotationsList with persistenceAnnotations */}}
|
||||
{{- range $index, $item := .Values.persistence }}
|
||||
{{- if $item.enabled }}
|
||||
{{- $persistenceAnnotationsDict := dict }}
|
||||
{{- range $item.annotationsList }}
|
||||
{{- $_ := set $persistenceAnnotationsDict .name .value }}
|
||||
{{- end }}
|
||||
{{- $tmp := $item.annotations }}
|
||||
{{- $persistenceanno := merge $tmp $persistenceAnnotationsDict }}
|
||||
{{- $_ := set $item "annotations" (deepCopy $persistenceanno) -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{/* merge persistenceLabelsList with persistenceLabels */}}
|
||||
{{- range $index, $item := .Values.persistence }}
|
||||
{{- if $item.enabled }}
|
||||
{{- $persistenceLabelsDict := dict }}
|
||||
{{- range $item.labelsList }}
|
||||
{{- $_ := set $persistenceLabelsDict .name .value }}
|
||||
{{- end }}
|
||||
{{- $tmp := $item.labels }}
|
||||
{{- $persistencelab := merge $tmp $persistenceLabelsDict }}
|
||||
{{- $_ := set $item "labels" (deepCopy $persistencelab) -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* merge ingressList with ingress */}}
|
||||
{{- $ingDict := dict }}
|
||||
{{- range $index, $item := .Values.ingressList -}}
|
||||
{{- $name := ( printf "list-%s" ( $index | toString ) ) }}
|
||||
{{- if $item.name }}
|
||||
{{- $name = $item.name }}
|
||||
{{- end }}
|
||||
{{- $_ := set $ingDict $name $item }}
|
||||
{{- end }}
|
||||
{{- $ing := merge .Values.ingress $ingDict }}
|
||||
{{- $_ := set .Values "ingress" (deepCopy $ing) -}}
|
||||
|
||||
|
||||
{{/* merge ingressAnnotationsList with ingressAnnotations */}}
|
||||
{{- range $index, $item := .Values.ingress }}
|
||||
{{- if $item.enabled }}
|
||||
{{- $ingressAnnotationsDict := dict }}
|
||||
{{- range $item.annotationsList }}
|
||||
{{- $_ := set $ingressAnnotationsDict .name .value }}
|
||||
{{- end }}
|
||||
{{- $tmp := $item.annotations }}
|
||||
{{- $ingressanno := merge $tmp $ingressAnnotationsDict }}
|
||||
{{- $_ := set $item "annotations" (deepCopy $ingressanno) -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{/* merge ingressLabelsList with ingressLabels */}}
|
||||
{{- range $index, $item := .Values.ingress }}
|
||||
{{- if $item.enabled }}
|
||||
{{- $ingressLabelsDict := dict }}
|
||||
{{- range $item.labelsList }}
|
||||
{{- $_ := set $ingressLabelsDict .name .value }}
|
||||
{{- end }}
|
||||
{{- $tmp := $item.labels }}
|
||||
{{- $ingresslab := merge $tmp $ingressLabelsDict }}
|
||||
{{- $_ := set $item "labels" (deepCopy $ingresslab) -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* Enable privileged securitycontext when deviceList is used */}}
|
||||
{{- if .Values.securityContext.privileged }}
|
||||
{{- else if .Values.deviceList }}
|
||||
{{- $_ := set .Values.securityContext "privileged" true -}}
|
||||
{{- $_ := set .Values.securityContext "allowPrivilegeEscalation" true -}}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{/* save supplementalGroups to placeholder variables */}}
|
||||
{{- $fixedGroups := list 568 }}
|
||||
{{- $valuegroups := list }}
|
||||
{{- $devGroups := list }}
|
||||
{{- $gpuGroups := list }}
|
||||
|
||||
{{/* put user-entered supplementalgroups in placeholder variable */}}
|
||||
{{- if .Values.podSecurityContext.supplementalGroups }}
|
||||
{{- $valuegroups = .Values.podSecurityContext.supplementalGroups }}
|
||||
{{- end }}
|
||||
|
||||
{{/* Append requered groups to supplementalGroups when deviceList is used */}}
|
||||
{{- if .Values.deviceList}}
|
||||
{{- $devGroups = list 5 10 20 24 }}
|
||||
{{- end }}
|
||||
|
||||
{{/* Append requered groups to supplementalGroups when scaleGPU is used */}}
|
||||
{{- if .Values.scaleGPU }}
|
||||
{{- $gpuGroups = list 44 107 }}
|
||||
{{- end }}
|
||||
|
||||
{{/* combine and write all supplementalGroups to .Values */}}
|
||||
{{- $supGroups := concat $fixedGroups $valuegroups $devGroups $gpuGroups }}
|
||||
{{- $_ := set .Values.podSecurityContext "supplementalGroups" $supGroups -}}
|
||||
|
||||
{{/* merge serviceList with service */}}
|
||||
{{- $portsDict := dict }}
|
||||
{{- range $index, $item := .Values.serviceList -}}
|
||||
{{- if $item.enabled }}
|
||||
{{- $name := ( printf "list-%s" ( $index | toString ) ) }}
|
||||
{{- if $item.name }}
|
||||
{{- $name = $item.name }}
|
||||
{{- end }}
|
||||
{{- $_ := set $portsDict $name $item }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $srv := merge .Values.service $portsDict }}
|
||||
{{- $_ := set .Values "service" (deepCopy $srv) -}}
|
||||
|
||||
{{/* merge portsList with ports */}}
|
||||
{{- range $index, $item := .Values.service -}}
|
||||
{{- if $item.enabled }}
|
||||
{{- $portsDict := dict }}
|
||||
{{- range $index2, $item2 := $item.portsList -}}
|
||||
{{- if $item2.enabled }}
|
||||
{{- $name := ( printf "list-%s" ( $index2 | toString ) ) }}
|
||||
{{- if $item2.name }}
|
||||
{{- $name = $item2.name }}
|
||||
{{- end }}
|
||||
{{- $_ := set $portsDict $name $item2 }}
|
||||
{{- end }}
|
||||
{{- $tmp := $item.ports }}
|
||||
{{- $ports := merge $tmp $portsDict }}
|
||||
{{- $_ := set $item "ports" (deepCopy $ports) -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{/* automatically set CAP_NET_BIND_SERVICE */}}
|
||||
{{- $fixedCapAdd := list }}
|
||||
{{- $customCapAdd := list }}
|
||||
{{- $valueCapAdd := list }}
|
||||
{{- $dynamicCapAdd := list }}
|
||||
{{- $fixedCapDrop := list }}
|
||||
{{- $customCapDrop := list }}
|
||||
{{- $valueCapDrop := list }}
|
||||
{{- $dynamicCapDrop := list }}
|
||||
{{- if .Values.securityContext.capabilities.add }}
|
||||
{{- $valueCapAdd = .Values.securityContext.capabilities.add }}
|
||||
{{- end }}
|
||||
{{- if .Values.securityContext.capabilities.drop }}
|
||||
{{- $valueCapDrop = .Values.securityContext.capabilities.drop }}
|
||||
{{- end }}
|
||||
{{- if .Values.customCapabilities.add }}
|
||||
{{- $customCapAdd = .Values.customCapabilities.add }}
|
||||
{{- end }}
|
||||
{{- if .Values.customCapabilities.drop }}
|
||||
{{- $customCapDrop = .Values.customCapabilities.drop }}
|
||||
{{- end }}
|
||||
|
||||
{{- $privPort := false }}
|
||||
{{- range .Values.service }}
|
||||
{{- range $name, $values := .ports }}
|
||||
{{- if and ( $values.targetPort ) ( kindIs "int" $values.targetPort ) }}
|
||||
{{- if ( semverCompare "<= 1024" ( toString $values.targetPort ) ) }}
|
||||
{{- $privPort = true }}
|
||||
{{- end }}
|
||||
{{- else if and ( $values.port ) ( kindIs "int" $values.port ) }}
|
||||
{{- if ( semverCompare "<= 1024" ( toString $values.port ) ) }}
|
||||
{{- $privPort = true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if or ( $privPort ) ( .Values.hostNetwork ) }}
|
||||
{{- $dynamicCapAdd = list "NET_BIND_SERVICE" }}
|
||||
{{- end }}
|
||||
|
||||
{{/* combine and write all capabilities to .Values */}}
|
||||
{{- $CapAdd := concat $fixedCapAdd $valueCapAdd $dynamicCapAdd }}
|
||||
{{- $CapDrop := concat $fixedCapDrop $valueCapDrop $dynamicCapDrop }}
|
||||
{{- if $CapDrop }}
|
||||
{{- $_ := set .Values.securityContext.capabilities "drop" $CapDrop -}}
|
||||
{{- end }}
|
||||
{{- if $CapAdd }}
|
||||
{{- $_ := set .Values.securityContext.capabilities "add" $CapAdd -}}
|
||||
{{- end }}
|
||||
|
||||
{{- range .Values.persistence }}
|
||||
{{- if .type }}
|
||||
{{- if eq .type "simplePVC" }}
|
||||
{{- $_ := set . "type" "pvc" }}
|
||||
{{- end }}
|
||||
{{- if eq .type "simpleHP" }}
|
||||
{{- $_ := set . "type" "hostPath" }}
|
||||
{{- if .setPermissionsSimple }}
|
||||
{{- $_ := set . "setPermissions" .setPermissionsSimple }}
|
||||
{{- end }}
|
||||
{{- if .hostPathSimple }}
|
||||
{{- $_ := set . "hostPath" .hostPathSimple }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- range .Values.volumeClaimTemplates }}
|
||||
{{- if .type }}
|
||||
{{- if eq .type "simplePVC" }}
|
||||
{{- $_ := set . "type" "pvc" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- range .Values.service }}
|
||||
{{- if .type }}
|
||||
{{- if eq .type "Simple" }}
|
||||
{{- $_ := set . "type" "LoadBalancer" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -1,43 +0,0 @@
|
||||
{{/*
|
||||
This template serves as the blueprint for the mountPermissions job that is run
|
||||
before chart installation.
|
||||
*/}}
|
||||
{{- define "common.controller.autopermissions" -}}
|
||||
{{- $group := .Values.podSecurityContext.fsGroup -}}
|
||||
{{- $hostPathMounts := dict -}}
|
||||
{{- range $name, $mount := .Values.persistence -}}
|
||||
{{- if and $mount.enabled $mount.setPermissions -}}
|
||||
{{- $name = default ( $name| toString ) $mount.name -}}
|
||||
{{- $_ := set $hostPathMounts $name $mount -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
- name: autopermissions
|
||||
image: {{ .Values.alpineImage.repository }}:{{ .Values.alpineImage.tag }}
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
privileged: false
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
resources:
|
||||
{{- with .Values.resources }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
command:
|
||||
- "/bin/sh"
|
||||
- "-c"
|
||||
- "echo 'Automatically correcting permissions...';{{ if and ( .Values.addons.vpn.configFile.enabled ) ( not ( eq .Values.addons.vpn.type "disabled" )) }}chown -R 568:568 /vpn/vpn.conf; chmod -R g+w /vpn/vpn.conf || echo 'chmod failed for vpn config, are you running NFSv4 ACLs?';{{ end }}{{ range $_, $hpm := $hostPathMounts }}chown -R :{{ $group }} {{ $hpm.mountPath | squote }}; chmod -R g+w || echo 'chmod failed for {{ $hpm.mountPath }}, are you running NFSv4 ACLs?' {{ $hpm.mountPath | squote }};{{ end }}"
|
||||
volumeMounts:
|
||||
{{- if and ( .Values.addons.vpn.configFile.enabled ) ( not ( eq .Values.addons.vpn.type "disabled" )) }}
|
||||
- name: vpnconfig
|
||||
mountPath: /vpn/vpn.conf
|
||||
{{- end }}
|
||||
{{- range $name, $hpm := $hostPathMounts }}
|
||||
- name: {{ $name }}
|
||||
mountPath: {{ $hpm.mountPath }}
|
||||
{{- if $hpm.subPath }}
|
||||
subPath: {{ $hpm.subPath }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -1,12 +1,12 @@
|
||||
{{- /* The main container included in the controller */ -}}
|
||||
{{- define "common.controller.mainContainer" -}}
|
||||
- name: {{ include "common.names.fullname" . }}
|
||||
image: {{ include "common.images.selector" . }}
|
||||
{{- define "tc.common.controller.mainContainer" -}}
|
||||
- name: {{ include "tc.common.names.fullname" . }}
|
||||
image: {{ include "tc.common.images.selector" . }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- with .Values.command }}
|
||||
command:
|
||||
{{- if kindIs "string" . }}
|
||||
- {{ . }}
|
||||
- {{ tpl . $ }}
|
||||
{{- else }}
|
||||
{{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
@@ -15,53 +15,57 @@
|
||||
args:
|
||||
{{- with .Values.args }}
|
||||
{{- if kindIs "string" . }}
|
||||
- {{ . }}
|
||||
- {{ tpl . $ }}
|
||||
{{- else }}
|
||||
{{ toYaml . | nindent 4 }}
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraArgs }}
|
||||
{{- if kindIs "string" . }}
|
||||
- {{ . }}
|
||||
- {{ tpl . $ }}
|
||||
{{- else }}
|
||||
{{ toYaml . | nindent 4 }}
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
tty: {{ .Values.tty }}
|
||||
stdin: {{ .Values.stdin }}
|
||||
{{- with .Values.tty }}
|
||||
tty: {{ tpl . $ }}
|
||||
{{- end }}
|
||||
{{- with .Values.stdin }}
|
||||
stdin: {{ tpl . $ }}
|
||||
{{- end }}
|
||||
{{- with .Values.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.lifecycle }}
|
||||
lifecycle:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.termination.messagePath }}
|
||||
terminationMessagePath: {{ . }}
|
||||
terminationMessagePath: {{ tpl . $ }}
|
||||
{{- end }}
|
||||
{{- with .Values.termination.messagePolicy }}
|
||||
terminationMessagePolicy: {{ . }}
|
||||
terminationMessagePolicy: {{ tpl . $ }}
|
||||
{{- end }}
|
||||
|
||||
env:
|
||||
- name: PUID
|
||||
value: {{ .Values.security.PUID | quote }}
|
||||
value: {{ tpl ( toYaml .Values.security.PUID ) $ | quote }}
|
||||
- name: USER_ID
|
||||
value: {{ .Values.security.PUID | quote }}
|
||||
value: {{ tpl ( toYaml .Values.security.PUID ) $ | quote }}
|
||||
- name: UID
|
||||
value: {{ .Values.security.PUID | quote }}
|
||||
value: {{ tpl ( toYaml .Values.security.PUID ) $ | quote }}
|
||||
- name: UMASK
|
||||
value: {{ .Values.security.UMASK | quote }}
|
||||
value: {{ tpl ( toYaml .Values.security.UMASK ) $ | quote }}
|
||||
- name: UMASK_SET
|
||||
value: {{ .Values.security.UMASK | quote }}
|
||||
value: {{ tpl ( toYaml .Values.security.UMASK ) $ | quote }}
|
||||
- name: PGID
|
||||
value: {{ .Values.podSecurityContext.fsGroup | quote }}
|
||||
value: {{ tpl ( toYaml .Values.podSecurityContext.fsGroup ) $ | quote }}
|
||||
- name: GROUP_ID
|
||||
value: {{ .Values.podSecurityContext.fsGroup | quote }}
|
||||
value: {{ tpl ( toYaml .Values.podSecurityContext.fsGroup ) $ | quote }}
|
||||
- name: GID
|
||||
value: {{ .Values.podSecurityContext.fsGroup | quote }}
|
||||
value: {{ tpl ( toYaml .Values.podSecurityContext.fsGroup ) $ | quote }}
|
||||
{{- if or ( .Values.securityContext.readOnlyRootFilesystem ) ( .Values.securityContext.runAsNonRoot ) }}
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
@@ -74,7 +78,7 @@
|
||||
value: "all"
|
||||
{{- end }}
|
||||
- name: TZ
|
||||
value: {{ .Values.TZ | quote }}
|
||||
value: {{ tpl ( toYaml .Values.TZ ) $ | quote }}
|
||||
{{- with .Values.env }}
|
||||
{{- range $k, $v := . }}
|
||||
{{- $name := $k }}
|
||||
@@ -87,7 +91,7 @@
|
||||
{{- if hasKey $value "value" }}
|
||||
{{- $value = $value.value -}}
|
||||
{{- else if hasKey $value "valueFrom" }}
|
||||
{{- toYaml $value | nindent 6 }}
|
||||
{{- dict "valueFrom" $value.valueFrom | toYaml | nindent 6 }}
|
||||
{{- else }}
|
||||
{{- dict "valueFrom" $value | toYaml | nindent 6 }}
|
||||
{{- end }}
|
||||
@@ -100,10 +104,6 @@
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- range $key, $value := .Values.envTpl }}
|
||||
- name: {{ $key }}
|
||||
value: {{ tpl $value $ | quote }}
|
||||
{{- end }}
|
||||
{{- range $key, $value := .Values.envValueFrom }}
|
||||
- name: {{ $key }}
|
||||
valueFrom:
|
||||
@@ -128,7 +128,7 @@
|
||||
{{- end }}
|
||||
{{- end}}
|
||||
envFrom:
|
||||
{{- range .Values.envFrom -}}
|
||||
{{- range .Values.envFrom }}
|
||||
{{- if .secretRef }}
|
||||
- secretRef:
|
||||
name: {{ tpl .secretRef.name $ | quote }}
|
||||
@@ -137,18 +137,18 @@
|
||||
name: {{ tpl .configMapRef.name $ | quote }}
|
||||
{{- else }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- if .Values.secret }}
|
||||
- secretRef:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.secretEnv }}
|
||||
- secretRef:
|
||||
name: {{ include "tc.common.names.fullname" . }}
|
||||
{{- end }}
|
||||
ports:
|
||||
{{- include "common.controller.ports" . | trim | nindent 4 }}
|
||||
{{- with (include "common.controller.volumeMounts" . | trim) }}
|
||||
{{- include "tc.common.controller.ports" . | trim | nindent 4 }}
|
||||
{{- with (include "tc.common.controller.volumeMounts" . | trim) }}
|
||||
volumeMounts:
|
||||
{{ nindent 4 . }}
|
||||
{{- end }}
|
||||
{{- include "common.controller.probes" . | trim | nindent 2 }}
|
||||
{{- include "tc.common.controller.probes" . | trim | nindent 2 }}
|
||||
{{/*
|
||||
Merges the TrueNAS SCALE generated GPU info with the .Values.resources dict
|
||||
*/}}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
{{/*
|
||||
This template serves as the blueprint for the mountPermissions job that is run
|
||||
before chart installation.
|
||||
TODO: delete docker compose deletion once iX has disabled it
|
||||
*/}}
|
||||
{{- define "common.controller.hostpatch" -}}
|
||||
- name: hostpatch
|
||||
image: {{ .Values.alpineImage.repository }}:{{ .Values.alpineImage.tag }}
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
privileged: true
|
||||
command:
|
||||
- "/bin/sh"
|
||||
- "-c"
|
||||
- ( sysctl -w fs.inotify.max_user_watches=524288 || echo "error setting inotify") && ( sysctl -w fs.inotify.max_user_instances=512 || echo "error setting inotify") && ( chmod -x /host/usr/bin/docker-compose || echo "error locking docker-compose") && ( chmod -x /host/bin/docker-compose || echo "error locking docker-compose")
|
||||
volumeMounts:
|
||||
- mountPath: /host/usr/bin
|
||||
name: host-usr-bin
|
||||
- mountPath: /host/bin
|
||||
name: host-bin
|
||||
{{- end -}}
|
||||
@@ -1,27 +1,27 @@
|
||||
{{- /*
|
||||
The pod definition included in the controller.
|
||||
*/ -}}
|
||||
{{- define "common.controller.pod" -}}
|
||||
{{- define "tc.common.controller.pod" -}}
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{ tpl ( toYaml . ) $ | nindent 2 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "common.names.serviceAccountName" . }}
|
||||
serviceAccountName: {{ include "tc.common.names.serviceAccountName" . }}
|
||||
{{- with .Values.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{ tpl ( toYaml . ) $ | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with .Values.priorityClassName }}
|
||||
priorityClassName: {{ . }}
|
||||
priorityClassName: {{ tpl . $ }}
|
||||
{{- end }}
|
||||
{{- with .Values.schedulerName }}
|
||||
schedulerName: {{ . }}
|
||||
schedulerName: {{ tpl . $ }}
|
||||
{{- end }}
|
||||
{{- with .Values.hostNetwork }}
|
||||
hostNetwork: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.hostname }}
|
||||
hostname: {{ . }}
|
||||
hostname: {{ tpl . $ }}
|
||||
{{- end }}
|
||||
{{- if .Values.dnsPolicy }}
|
||||
dnsPolicy: {{ .Values.dnsPolicy }}
|
||||
@@ -34,15 +34,15 @@ dnsPolicy: ClusterFirst
|
||||
dnsConfig:
|
||||
{{- with .Values.dnsConfig.options }}
|
||||
options:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{ tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.dnsConfig.nameservers }}
|
||||
nameservers: []
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{ tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.dnsConfig.searches }}
|
||||
searches: []
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{ tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
enableServiceLinks: {{ .Values.enableServiceLinks }}
|
||||
@@ -50,13 +50,11 @@ enableServiceLinks: {{ .Values.enableServiceLinks }}
|
||||
terminationGracePeriodSeconds: {{ . }}
|
||||
{{- end }}
|
||||
initContainers:
|
||||
{{- include "common.controller.autopermissions" . | nindent 2 }}
|
||||
{{- include "common.controller.hostpatch" . | nindent 2 }}
|
||||
{{- include "common.dependencies.postgresql.init" . | nindent 2 }}
|
||||
{{- include "common.dependencies.mariadb.init" . | nindent 2 }}
|
||||
{{- include "common.dependencies.mongodb.init" . | nindent 2 }}
|
||||
{{- if .Release.IsInstall }}
|
||||
{{- if .Values.installContainers }}
|
||||
{{- include "tc.common.controller.prepare" . | nindent 2 }}
|
||||
{{- include "tc.common.dependencies.postgresql.init" . | nindent 2 }}
|
||||
{{- include "tc.common.dependencies.mariadb.init" . | nindent 2 }}
|
||||
{{- include "tc.common.dependencies.mongodb.init" . | nindent 2 }}
|
||||
{{- if and ( or ( .Release.IsInstall ) ( .Values.test.install ) ) ( .Values.installContainers )}}
|
||||
{{- $installContainers := list }}
|
||||
{{- range $index, $key := (keys .Values.installContainers | uniq | sortAlpha) }}
|
||||
{{- $container := get $.Values.installContainers $key }}
|
||||
@@ -67,9 +65,7 @@ initContainers:
|
||||
{{- end }}
|
||||
{{- tpl (toYaml $installContainers) $ | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Release.IsUpgrade }}
|
||||
{{- if .Values.upgradeContainers }}
|
||||
{{- if and ( or ( .Release.IsUpgrade ) ( .Values.test.upgrade ) ) ( .Values.upgradeContainers )}}
|
||||
{{- $upgradeContainers := list }}
|
||||
{{- range $index, $key := (keys .Values.upgradeContainers | uniq | sortAlpha) }}
|
||||
{{- $container := get $.Values.upgradeContainers $key }}
|
||||
@@ -80,7 +76,6 @@ initContainers:
|
||||
{{- end }}
|
||||
{{- tpl (toYaml $upgradeContainers) $ | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.initContainers }}
|
||||
{{- $initContainers := list }}
|
||||
{{- range $index, $key := (keys .Values.initContainers | uniq | sortAlpha) }}
|
||||
@@ -93,7 +88,7 @@ initContainers:
|
||||
{{- tpl (toYaml $initContainers) $ | nindent 2 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
{{- include "common.controller.mainContainer" . | nindent 2 }}
|
||||
{{- include "tc.common.controller.mainContainer" . | nindent 2 }}
|
||||
{{- with .Values.additionalContainers }}
|
||||
{{- $additionalContainers := list }}
|
||||
{{- range $name, $container := . }}
|
||||
@@ -104,28 +99,28 @@ containers:
|
||||
{{- end }}
|
||||
{{- tpl (toYaml $additionalContainers) $ | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with (include "common.controller.volumes" . | trim) }}
|
||||
{{- with (include "tc.common.controller.volumes" . | trim) }}
|
||||
volumes:
|
||||
{{- nindent 2 . }}
|
||||
{{- end }}
|
||||
{{- with .Values.hostAliases }}
|
||||
hostAliases:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{ tpl ( toYaml . ) $ | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{ tpl ( toYaml . ) $ | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{ tpl ( toYaml . ) $ | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with .Values.topologySpreadConstraints }}
|
||||
topologySpreadConstraints:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{ tpl ( toYaml . ) $ | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{ tpl ( toYaml . ) $ | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{/*
|
||||
Ports included by the controller.
|
||||
*/}}
|
||||
{{- define "common.controller.ports" -}}
|
||||
{{- define "tc.common.controller.ports" -}}
|
||||
{{- $ports := list -}}
|
||||
{{- range .Values.service -}}
|
||||
{{- if .enabled -}}
|
||||
@@ -16,7 +16,7 @@ Ports included by the controller.
|
||||
{{- if $ports -}}
|
||||
{{- range $_ := $ports }}
|
||||
{{- if .enabled }}
|
||||
- name: {{ .name }}
|
||||
- name: {{ tpl .name $ }}
|
||||
{{- if and .targetPort (kindIs "string" .targetPort) }}
|
||||
{{- fail (printf "Our charts do not support named ports for targetPort. (port name %s, targetPort %s)" .name .targetPort) }}
|
||||
{{- end }}
|
||||
@@ -25,7 +25,7 @@ Ports included by the controller.
|
||||
{{- if or ( eq .protocol "HTTP" ) ( eq .protocol "HTTPS" ) ( eq .protocol "TCP" ) }}
|
||||
protocol: TCP
|
||||
{{- else }}
|
||||
protocol: {{ .protocol }}
|
||||
protocol: {{ tpl .protocol $ }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
protocol: TCP
|
||||
|
||||
70
charts/common/templates/lib/controller/_prepare.tpl
Normal file
70
charts/common/templates/lib/controller/_prepare.tpl
Normal file
@@ -0,0 +1,70 @@
|
||||
{{/*
|
||||
This template serves as the blueprint for the mountPermissions job that is run
|
||||
before chart installation.
|
||||
*/}}
|
||||
{{- define "tc.common.controller.prepare" -}}
|
||||
{{- $group := .Values.podSecurityContext.fsGroup -}}
|
||||
{{- $hostPathMounts := dict -}}
|
||||
{{- range $name, $mount := .Values.persistence -}}
|
||||
{{- if and $mount.enabled $mount.setPermissions -}}
|
||||
{{- $name = default ( $name| toString ) $mount.name -}}
|
||||
{{- $_ := set $hostPathMounts $name $mount -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
- name: autopermissions
|
||||
image: {{ .Values.alpineImage.repository }}:{{ .Values.alpineImage.tag }}
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
privileged: true
|
||||
resources:
|
||||
{{- with .Values.resources }}
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
command:
|
||||
- "/bin/sh"
|
||||
- "-c"
|
||||
- |
|
||||
/bin/bash <<'EOF'
|
||||
echo "Automatically correcting permissions..."
|
||||
{{- if and ( .Values.addons.vpn.configFile.enabled ) ( not ( eq .Values.addons.vpn.type "disabled" )) }}
|
||||
echo "Automatically correcting permissions for vpn config file..."
|
||||
if nfs4xdr_getfacl && nfs4xdr_getfacl | grep -qv "Failed to get NFSv4 ACL"; then
|
||||
echo "NFSv4 ACLs detected, using nfs4_setfacl to set permissions..."
|
||||
nfs4_setfacl -a A::568:RWX /vpn/vpn.conf
|
||||
nfs4_setfacl -a A:g:568:RWX /vpn/vpn.conf
|
||||
else
|
||||
echo "No NFSv4 ACLs detected, trying chown/chmod..."
|
||||
chown -R 568:568 /vpn/vpn.conf
|
||||
chmod -R g+w /vpn/vpn.conf
|
||||
fi
|
||||
{{- end }}
|
||||
{{- range $_, $hpm := $hostPathMounts }}
|
||||
echo "Automatically correcting permissions for {{ $hpm.mountPath }}..."
|
||||
if nfs4xdr_getfacl && nfs4xdr_getfacl | grep -qv "Failed to get NFSv4 ACL"; then
|
||||
echo "NFSv4 ACLs detected, using nfs4_setfacl to set permissions..."
|
||||
nfs4_setfacl -R -a A:g:{{ $group }}:RWX {{ tpl $hpm.mountPath $ | squote }}
|
||||
else
|
||||
echo "No NFSv4 ACLs detected, trying chown/chmod..."
|
||||
chown -R :{{ $group }} {{ tpl $hpm.mountPath $ | squote }}
|
||||
chmod -R g+rwx {{ tpl $hpm.mountPath $ | squote }}
|
||||
fi
|
||||
{{- end }}
|
||||
{{- if .Values.patchInotify }}
|
||||
echo "increasing inotify limits..."
|
||||
( sysctl -w fs.inotify.max_user_watches=524288 || echo "error setting inotify") && ( sysctl -w fs.inotify.max_user_instances=512 || echo "error setting inotify")
|
||||
{{- end }}
|
||||
EOF
|
||||
|
||||
volumeMounts:
|
||||
{{- range $name, $hpm := $hostPathMounts }}
|
||||
- name: {{ $name }}
|
||||
mountPath: {{ $hpm.mountPath }}
|
||||
{{- if $hpm.subPath }}
|
||||
subPath: {{ $hpm.subPath }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and ( .Values.addons.vpn.configFile.enabled ) ( not ( eq .Values.addons.vpn.type "disabled" )) }}
|
||||
- name: vpnconfig
|
||||
mountPath: /vpn/vpn.conf
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -1,11 +1,11 @@
|
||||
{{/*
|
||||
Probes selection logic.
|
||||
*/}}
|
||||
{{- define "common.controller.probes" -}}
|
||||
{{- $primaryService := get .Values.service (include "common.service.primary" .) -}}
|
||||
{{- define "tc.common.controller.probes" -}}
|
||||
{{- $primaryService := get .Values.service (include "tc.common.lib.util.service.primary" .) -}}
|
||||
{{- $primaryPort := "" -}}
|
||||
{{- if $primaryService -}}
|
||||
{{- $primaryPort = get $primaryService.ports (include "common.classes.service.ports.primary" (dict "serviceName" (include "common.service.primary" .) "values" $primaryService)) -}}
|
||||
{{- $primaryPort = get $primaryService.ports (include "tc.common.lib.util.service.ports.primary" (dict "serviceName" (include "tc.common.lib.util.service.primary" .) "values" $primaryService)) -}}
|
||||
{{- end -}}
|
||||
{{- $probeType := "TCP" -}}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{/* Volumes included by the controller */}}
|
||||
{{- define "common.controller.volumeMounts" -}}
|
||||
{{- define "tc.common.controller.volumeMounts" -}}
|
||||
{{- range $index, $item := .Values.persistence }}
|
||||
{{- if not $item.noMount }}
|
||||
{{- $mountPath := (printf "/%v" $index) -}}
|
||||
@@ -10,16 +10,16 @@
|
||||
{{- $mountPath = . -}}
|
||||
{{- end }}
|
||||
{{- if and $item.enabled (ne $mountPath "-") }}
|
||||
- mountPath: {{ $mountPath }}
|
||||
name: {{ $index }}
|
||||
- mountPath: {{ tpl $mountPath $ }}
|
||||
name: {{ tpl $index $ }}
|
||||
{{- with $item.subPath }}
|
||||
subPath: {{ . }}
|
||||
subPath: {{ tpl . $ }}
|
||||
{{- end }}
|
||||
{{- with $item.readOnly }}
|
||||
readOnly: {{ . }}
|
||||
{{- end }}
|
||||
{{- with $item.mountPropagation }}
|
||||
mountPropagation: {{ . }}
|
||||
mountPropagation: {{ tpl . $ }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -27,19 +27,11 @@
|
||||
|
||||
{{- if eq .Values.controller.type "statefulset" }}
|
||||
{{- range $index, $vct := .Values.volumeClaimTemplates }}
|
||||
{{- $vctname := $index }}
|
||||
{{- if $vct.name }}
|
||||
{{- $vctname := $vct.name }}
|
||||
{{- end }}
|
||||
{{- if not $vct.noMount }}
|
||||
- mountPath: {{ $vct.mountPath }}
|
||||
name: {{ $vctname }}
|
||||
name: {{ $vct.name }}
|
||||
{{- if $vct.subPath }}
|
||||
subPath: {{ $vct.subPath }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{{/*
|
||||
Volumes included by the controller.
|
||||
*/}}
|
||||
{{- define "common.controller.volumes" -}}
|
||||
{{- define "tc.common.controller.volumes" -}}
|
||||
{{- range $index, $persistence := .Values.persistence }}
|
||||
{{- if $persistence.enabled }}
|
||||
- name: {{ $index }}
|
||||
- name: {{ tpl $index $ }}
|
||||
{{- if eq (default "pvc" $persistence.type) "pvc" }}
|
||||
{{- $pvcName := (include "common.names.fullname" $) -}}
|
||||
{{- $pvcName := (include "tc.common.names.fullname" $) -}}
|
||||
{{- if $persistence.existingClaim }}
|
||||
{{- /* Always prefer an existingClaim if that is set */}}
|
||||
{{- $pvcName = $persistence.existingClaim -}}
|
||||
@@ -14,17 +14,17 @@ Volumes included by the controller.
|
||||
{{- /* Otherwise refer to the PVC name */}}
|
||||
{{- if $persistence.nameOverride -}}
|
||||
{{- if not (eq $persistence.nameOverride "-") -}}
|
||||
{{- $pvcName = (printf "%s-%s" (include "common.names.fullname" $) $persistence.nameOverride) -}}
|
||||
{{- $pvcName = (printf "%s-%s" (include "tc.common.names.fullname" $) $persistence.nameOverride) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- $pvcName = (printf "%s-%s" (include "common.names.fullname" $) $index) -}}
|
||||
{{- $pvcName = (printf "%s-%s" (include "tc.common.names.fullname" $) $index) -}}
|
||||
{{- end -}}
|
||||
{{- if $persistence.forceName -}}
|
||||
{{- $pvcName = $persistence.forceName -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ $pvcName }}
|
||||
claimName: {{ tpl $pvcName $ }}
|
||||
{{- else if eq $persistence.type "emptyDir" }}
|
||||
{{- $emptyDir := dict -}}
|
||||
{{- with $persistence.medium -}}
|
||||
@@ -33,7 +33,7 @@ Volumes included by the controller.
|
||||
{{- with $persistence.sizeLimit -}}
|
||||
{{- $_ := set $emptyDir "sizeLimit" . -}}
|
||||
{{- end }}
|
||||
emptyDir: {{- $emptyDir | toYaml | nindent 4 }}
|
||||
emptyDir: {{- tpl ( toYaml $emptyDir ) $ | nindent 4 }}
|
||||
{{- else if or (eq $persistence.type "configMap") (eq $persistence.type "secret") }}
|
||||
{{- $objectName := (required (printf "objectName not set for persistence item %s" $index) $persistence.objectName) }}
|
||||
{{- $objectName = tpl $objectName $ }}
|
||||
@@ -45,20 +45,24 @@ Volumes included by the controller.
|
||||
secretName: {{ $objectName }}
|
||||
{{- end }}
|
||||
{{- with $persistence.defaultMode }}
|
||||
defaultMode: {{ . }}
|
||||
defaultMode: {{ tpl . $ }}
|
||||
{{- end }}
|
||||
{{- with $persistence.items }}
|
||||
items:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- tpl ( toYaml . ) $ | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- else if eq $persistence.type "hostPath" }}
|
||||
hostPath:
|
||||
path: {{ required "hostPath not set" $persistence.hostPath }}
|
||||
{{- with $persistence.hostPathType }}
|
||||
type: {{ . }}
|
||||
type: {{ tpl . $ }}
|
||||
{{- end }}
|
||||
{{- else if eq $persistence.type "nfs" }}
|
||||
nfs:
|
||||
server: {{ required "server not set" $persistence.server }}
|
||||
path: {{ required "path not set" $persistence.path }}
|
||||
{{- else if eq $persistence.type "custom" }}
|
||||
{{- toYaml $persistence.volumeSpec | nindent 2 }}
|
||||
{{- tpl ( toYaml $persistence.volumeSpec ) $ | nindent 2 }}
|
||||
{{- else }}
|
||||
{{- fail (printf "Not a valid persistence.type (%s)" $persistence.type) }}
|
||||
{{- end }}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{/*
|
||||
This template ensures pods with mariadb dependency have a delayed start
|
||||
*/}}
|
||||
{{- define "common.dependencies.mariadb.init" -}}
|
||||
{{- define "tc.common.dependencies.mariadb.init" -}}
|
||||
{{- if .Values.mariadb.enabled }}
|
||||
- name: mariadb-init
|
||||
image: "{{ .Values.mariadbImage.repository}}:{{ .Values.mariadbImage.tag }}"
|
||||
@@ -22,7 +22,7 @@ This template ensures pods with mariadb dependency have a delayed start
|
||||
- ALL
|
||||
resources:
|
||||
{{- with .Values.resources }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
command: ["bash", "-ec"]
|
||||
args:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{/*
|
||||
This template generates a random password and ensures it persists across updates/edits to the chart
|
||||
*/}}
|
||||
{{- define "common.dependencies.mariadb.injector" -}}
|
||||
{{- define "tc.common.dependencies.mariadb.injector" -}}
|
||||
{{- $pghost := printf "%v-%v" .Release.Name "mariadb" }}
|
||||
|
||||
{{- if .Values.mariadb.enabled }}
|
||||
@@ -10,7 +10,7 @@ apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- include "tc.common.labels" . | nindent 4 }}
|
||||
name: mariadbcreds
|
||||
{{- $dbprevious := lookup "v1" "Secret" .Release.Namespace "mariadbcreds" }}
|
||||
{{- $dbPass := "" }}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{/*
|
||||
This template ensures pods with mongodb dependency have a delayed start
|
||||
*/}}
|
||||
{{- define "common.dependencies.mongodb.init" -}}
|
||||
{{- define "tc.common.dependencies.mongodb.init" -}}
|
||||
{{- if .Values.mongodb.enabled }}
|
||||
- name: mongodb-init
|
||||
image: "{{ .Values.mongodbImage.repository}}:{{ .Values.mongodbImage.tag }}"
|
||||
@@ -19,7 +19,7 @@ This template ensures pods with mongodb dependency have a delayed start
|
||||
- ALL
|
||||
resources:
|
||||
{{- with .Values.resources }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
command: ["bash", "-ec"]
|
||||
args:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{/*
|
||||
This template generates a random password and ensures it persists across updates/edits to the chart
|
||||
*/}}
|
||||
{{- define "common.dependencies.mongodb.injector" -}}
|
||||
{{- define "tc.common.dependencies.mongodb.injector" -}}
|
||||
{{- $pghost := printf "%v-%v" .Release.Name "mongodb" }}
|
||||
|
||||
{{- if .Values.mongodb.enabled }}
|
||||
@@ -10,7 +10,7 @@ apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- include "tc.common.labels" . | nindent 4 }}
|
||||
name: mongodbcreds
|
||||
{{- $dbprevious := lookup "v1" "Secret" .Release.Namespace "mongodbcreds" }}
|
||||
{{- $dbPass := "" }}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{/*
|
||||
This template ensures pods with postgresql dependency have a delayed start
|
||||
*/}}
|
||||
{{- define "common.dependencies.postgresql.init" -}}
|
||||
{{- define "tc.common.dependencies.postgresql.init" -}}
|
||||
{{- $pghost := printf "%v-%v" .Release.Name "postgresql" }}
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
- name: postgresql-init
|
||||
@@ -12,7 +12,7 @@ This template ensures pods with postgresql dependency have a delayed start
|
||||
- ALL
|
||||
resources:
|
||||
{{- with .Values.resources }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- tpl ( toYaml . ) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
command:
|
||||
- "sh"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{/*
|
||||
This template generates a random password and ensures it persists across updates/edits to the chart
|
||||
*/}}
|
||||
{{- define "common.dependencies.postgresql.injector" -}}
|
||||
{{- define "tc.common.dependencies.postgresql.injector" -}}
|
||||
{{- $pghost := printf "%v-%v" .Release.Name "postgresql" }}
|
||||
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
@@ -10,7 +10,7 @@ apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- include "tc.common.labels" . | nindent 4 }}
|
||||
name: dbcreds
|
||||
{{- $dbprevious := lookup "v1" "Secret" .Release.Namespace "dbcreds" }}
|
||||
{{- $dbPass := "" }}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{/*
|
||||
This template generates a random password and ensures it persists across updates/edits to the chart
|
||||
*/}}
|
||||
{{- define "common.dependencies.redis.injector" -}}
|
||||
{{- define "tc.common.dependencies.redis.injector" -}}
|
||||
{{- $pghost := printf "%v-%v" .Release.Name "redis" }}
|
||||
|
||||
{{- if .Values.redis.enabled }}
|
||||
@@ -10,7 +10,7 @@ apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- include "tc.common.labels" . | nindent 4 }}
|
||||
name: rediscreds
|
||||
{{- $dbprevious := lookup "v1" "Secret" .Release.Namespace "rediscreds" }}
|
||||
{{- $dbPass := "" }}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
{{/*
|
||||
Return a soft nodeAffinity definition
|
||||
{{ include "common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||
{{ include "tc.common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||
*/}}
|
||||
{{- define "common.affinities.nodes.soft" -}}
|
||||
{{- define "tc.common.affinities.nodes.soft" -}}
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- preference:
|
||||
matchExpressions:
|
||||
@@ -19,9 +19,9 @@ preferredDuringSchedulingIgnoredDuringExecution:
|
||||
|
||||
{{/*
|
||||
Return a hard nodeAffinity definition
|
||||
{{ include "common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||
{{ include "tc.common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||
*/}}
|
||||
{{- define "common.affinities.nodes.hard" -}}
|
||||
{{- define "tc.common.affinities.nodes.hard" -}}
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
@@ -35,27 +35,27 @@ requiredDuringSchedulingIgnoredDuringExecution:
|
||||
|
||||
{{/*
|
||||
Return a nodeAffinity definition
|
||||
{{ include "common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||
{{ include "tc.common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||
*/}}
|
||||
{{- define "common.affinities.nodes" -}}
|
||||
{{- define "tc.common.affinities.nodes" -}}
|
||||
{{- if eq .type "soft" }}
|
||||
{{- include "common.affinities.nodes.soft" . -}}
|
||||
{{- include "tc.common.affinities.nodes.soft" . -}}
|
||||
{{- else if eq .type "hard" }}
|
||||
{{- include "common.affinities.nodes.hard" . -}}
|
||||
{{- include "tc.common.affinities.nodes.hard" . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return a soft podAffinity/podAntiAffinity definition
|
||||
{{ include "common.affinities.pods.soft" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}}
|
||||
{{ include "tc.common.affinities.pods.soft" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}}
|
||||
*/}}
|
||||
{{- define "common.affinities.pods.soft" -}}
|
||||
{{- define "tc.common.affinities.pods.soft" -}}
|
||||
{{- $component := default "" .component -}}
|
||||
{{- $extraMatchLabels := default (dict) .extraMatchLabels -}}
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- podAffinityTerm:
|
||||
labelSelector:
|
||||
matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 10 }}
|
||||
matchLabels: {{- (include "tc.common.labels.matchLabels" .context) | nindent 10 }}
|
||||
{{- if not (empty $component) }}
|
||||
{{ printf "app.kubernetes.io/component: %s" $component }}
|
||||
{{- end }}
|
||||
@@ -70,14 +70,14 @@ preferredDuringSchedulingIgnoredDuringExecution:
|
||||
|
||||
{{/*
|
||||
Return a hard podAffinity/podAntiAffinity definition
|
||||
{{ include "common.affinities.pods.hard" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}}
|
||||
{{ include "tc.common.affinities.pods.hard" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}}
|
||||
*/}}
|
||||
{{- define "common.affinities.pods.hard" -}}
|
||||
{{- define "tc.common.affinities.pods.hard" -}}
|
||||
{{- $component := default "" .component -}}
|
||||
{{- $extraMatchLabels := default (dict) .extraMatchLabels -}}
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- labelSelector:
|
||||
matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 8 }}
|
||||
matchLabels: {{- (include "tc.common.labels.matchLabels" .context) | nindent 8 }}
|
||||
{{- if not (empty $component) }}
|
||||
{{ printf "app.kubernetes.io/component: %s" $component }}
|
||||
{{- end }}
|
||||
@@ -91,12 +91,12 @@ requiredDuringSchedulingIgnoredDuringExecution:
|
||||
|
||||
{{/*
|
||||
Return a podAffinity/podAntiAffinity definition
|
||||
{{ include "common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||
{{ include "tc.common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
|
||||
*/}}
|
||||
{{- define "common.affinities.pods" -}}
|
||||
{{- define "tc.common.affinities.pods" -}}
|
||||
{{- if eq .type "soft" }}
|
||||
{{- include "common.affinities.pods.soft" . -}}
|
||||
{{- include "tc.common.affinities.pods.soft" . -}}
|
||||
{{- else if eq .type "hard" }}
|
||||
{{- include "common.affinities.pods.hard" . -}}
|
||||
{{- include "tc.common.affinities.pods.hard" . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -1,9 +1,9 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Return the proper image name
|
||||
{{ include "common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" $) }}
|
||||
{{ include "tc.common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" $) }}
|
||||
*/}}
|
||||
{{- define "common.images.image" -}}
|
||||
{{- define "tc.common.images.image" -}}
|
||||
{{- $repositoryName := .imageRoot.repository -}}
|
||||
{{- $tag := .imageRoot.tag | toString -}}
|
||||
{{- printf "%s:%s" $repositoryName $tag -}}
|
||||
@@ -11,9 +11,9 @@ Return the proper image name
|
||||
|
||||
{{/*
|
||||
Return the image name using the selector
|
||||
{{ include "common.images.selector" . }}
|
||||
{{ include "tc.common.images.selector" . }}
|
||||
*/}}
|
||||
{{- define "common.images.selector" -}}
|
||||
{{- define "tc.common.images.selector" -}}
|
||||
{{- $imageDict := get .Values "image" }}
|
||||
{{- $selected := .Values.imageSelector }}
|
||||
{{- if hasKey .Values $selected }}
|
||||
@@ -25,15 +25,15 @@ Return the image name using the selector
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead)
|
||||
{{ include "common.images.pullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global) }}
|
||||
Return the proper Docker Image Registry Secret Names (deprecated: use tc.common.images.renderPullSecrets instead)
|
||||
{{ include "tc.common.images.pullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global) }}
|
||||
*/}}
|
||||
{{- define "common.images.pullSecrets" -}}
|
||||
{{- define "tc.common.images.pullSecrets" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Docker Image Registry Secret Names evaluating values as templates
|
||||
{{ include "common.images.renderPullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }}
|
||||
{{ include "tc.common.images.renderPullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.images.renderPullSecrets" -}}
|
||||
{{- define "tc.common.images.renderPullSecrets" -}}
|
||||
{{- end -}}
|
||||
@@ -2,13 +2,13 @@
|
||||
{{/*
|
||||
Kubernetes standard labels
|
||||
*/}}
|
||||
{{- define "common.labels.standard" -}}
|
||||
{{- include "common.labels" . }}
|
||||
{{- define "tc.common.labels.standard" -}}
|
||||
{{- include "tc.common.labels" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector
|
||||
*/}}
|
||||
{{- define "common.labels.matchLabels" -}}
|
||||
{{- include "common.labels.selectorLabels" . }}
|
||||
{{- define "tc.common.labels.matchLabels" -}}
|
||||
{{- include "tc.common.labels.selectorLabels" . }}
|
||||
{{- end -}}
|
||||
21
charts/common/templates/lib/util/_primary-ingress.tpl
Normal file
21
charts/common/templates/lib/util/_primary-ingress.tpl
Normal file
@@ -0,0 +1,21 @@
|
||||
{{/* Return the name of the primary ingress object */}}
|
||||
{{- define "tc.common.lib.util.ingress.primary" -}}
|
||||
{{- $enabledIngresses := dict -}}
|
||||
{{- range $name, $ingress := .Values.ingress -}}
|
||||
{{- if $ingress.enabled -}}
|
||||
{{- $_ := set $enabledIngresses $name . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $result := "" -}}
|
||||
{{- range $name, $ingress := $enabledIngresses -}}
|
||||
{{- if and (hasKey $ingress "primary") $ingress.primary -}}
|
||||
{{- $result = $name -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not $result -}}
|
||||
{{- $result = keys $enabledIngresses | first -}}
|
||||
{{- end -}}
|
||||
{{- $result -}}
|
||||
{{- end -}}
|
||||
23
charts/common/templates/lib/util/_primary-rbac.tpl
Normal file
23
charts/common/templates/lib/util/_primary-rbac.tpl
Normal file
@@ -0,0 +1,23 @@
|
||||
{{/*
|
||||
Return the primary rbac object
|
||||
*/}}
|
||||
{{- define "tc.common.lib.util.rbac.primary" -}}
|
||||
{{- $enabledrbacs := dict -}}
|
||||
{{- range $name, $rbac := .Values.rbac -}}
|
||||
{{- if $rbac.enabled -}}
|
||||
{{- $_ := set $enabledrbacs $name . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $result := "" -}}
|
||||
{{- range $name, $rbac := $enabledrbacs -}}
|
||||
{{- if and (hasKey $rbac "primary") $rbac.primary -}}
|
||||
{{- $result = $name -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not $result -}}
|
||||
{{- $result = keys $enabledrbacs | first -}}
|
||||
{{- end -}}
|
||||
{{- $result -}}
|
||||
{{- end -}}
|
||||
23
charts/common/templates/lib/util/_primary-service.tpl
Normal file
23
charts/common/templates/lib/util/_primary-service.tpl
Normal file
@@ -0,0 +1,23 @@
|
||||
{{/*
|
||||
Return the primary service object
|
||||
*/}}
|
||||
{{- define "tc.common.lib.util.service.primary" -}}
|
||||
{{- $enabledServices := dict -}}
|
||||
{{- range $name, $service := .Values.service -}}
|
||||
{{- if $service.enabled -}}
|
||||
{{- $_ := set $enabledServices $name . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $result := "" -}}
|
||||
{{- range $name, $service := $enabledServices -}}
|
||||
{{- if and (hasKey $service "primary") $service.primary -}}
|
||||
{{- $result = $name -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not $result -}}
|
||||
{{- $result = keys $enabledServices | first -}}
|
||||
{{- end -}}
|
||||
{{- $result -}}
|
||||
{{- end -}}
|
||||
23
charts/common/templates/lib/util/_primary-serviceAccount.tpl
Normal file
23
charts/common/templates/lib/util/_primary-serviceAccount.tpl
Normal file
@@ -0,0 +1,23 @@
|
||||
{{/*
|
||||
Return the primary serviceAccount object
|
||||
*/}}
|
||||
{{- define "tc.common.lib.util.serviceaccount.primary" -}}
|
||||
{{- $enabledServiceaccounts := dict -}}
|
||||
{{- range $name, $serviceAccount := .Values.serviceAccount -}}
|
||||
{{- if $serviceAccount.enabled -}}
|
||||
{{- $_ := set $enabledServiceaccounts $name . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $result := "" -}}
|
||||
{{- range $name, $serviceAccount := $enabledServiceaccounts -}}
|
||||
{{- if and (hasKey $serviceAccount "primary") $serviceAccount.primary -}}
|
||||
{{- $result = $name -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not $result -}}
|
||||
{{- $result = keys $enabledServiceaccounts | first -}}
|
||||
{{- end -}}
|
||||
{{- $result -}}
|
||||
{{- end -}}
|
||||
@@ -1,7 +1,7 @@
|
||||
{{/*
|
||||
Return the primary port for a given Service object.
|
||||
*/}}
|
||||
{{- define "common.classes.service.ports.primary" -}}
|
||||
{{- define "tc.common.lib.util.service.ports.primary" -}}
|
||||
{{- $enabledPorts := dict -}}
|
||||
{{- range $name, $port := .values.ports -}}
|
||||
{{- if $port.enabled -}}
|
||||
20
charts/common/templates/lib/util/_storage.tpl
Normal file
20
charts/common/templates/lib/util/_storage.tpl
Normal file
@@ -0,0 +1,20 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Return the proper Storage Class
|
||||
{{ include "tc.common.storage.class" ( dict "persistence" .Values.path.to.the.persistence "global" $ ) }}
|
||||
*/}}
|
||||
{{- define "tc.common.storage.class" -}}
|
||||
|
||||
{{- if .persistence.storageClass -}}
|
||||
{{- if (eq "-" .persistence.storageClass) -}}
|
||||
{{- printf "storageClassName: \"\"" -}}
|
||||
{{- else if and (eq "SCALE-ZFS" .persistence.storageClass ) -}}
|
||||
{{- printf "storageClassName: %s" .global.Values.global.ixChartContext.storageClassName -}}
|
||||
{{- else -}}
|
||||
{{- printf "storageClassName: %s" .persistence.storageClass -}}
|
||||
{{- end -}}
|
||||
{{- else if .global.Values.global.ixChartContext -}}
|
||||
{{- printf "storageClassName: %s" .global.Values.global.ixChartContext.storageClassName -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- end -}}
|
||||
@@ -2,9 +2,9 @@
|
||||
{{/*
|
||||
Renders a value that contains template.
|
||||
Usage:
|
||||
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
|
||||
{{ include "tc.common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.tplvalues.render" -}}
|
||||
{{- define "tc.common.tplvalues.render" -}}
|
||||
{{- if typeIs "string" .value }}
|
||||
{{- tpl .value .context }}
|
||||
{{- else }}
|
||||
@@ -2,9 +2,9 @@
|
||||
{{/*
|
||||
Warning about using rolling tag.
|
||||
Usage:
|
||||
{{ include "common.warnings.rollingTag" .Values.path.to.the.imageRoot }}
|
||||
{{ include "tc.common.warnings.rollingTag" .Values.path.to.the.imageRoot }}
|
||||
*/}}
|
||||
{{- define "common.warnings.rollingTag" -}}
|
||||
{{- define "tc.common.warnings.rollingTag" -}}
|
||||
|
||||
{{- if not (.tag | toString | regexFind "-r\\d+$|sha256:") }}
|
||||
WARNING: Rolling tag detected ({{ .repository }}:{{ .tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment.
|
||||
@@ -1,41 +0,0 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Return the proper Storage Class
|
||||
{{ include "common.storage.class" ( dict "persistence" .Values.path.to.the.persistence "global" $ ) }}
|
||||
*/}}
|
||||
{{- define "common.storage.class" -}}
|
||||
|
||||
{{- $storageClass := .persistence.storageClass -}}
|
||||
{{- $output := "" -}}
|
||||
|
||||
{{- if ( hasKey .persistence "storageClass" ) -}}
|
||||
{{- if $storageClass -}}
|
||||
{{- if (eq "-" $storageClass) -}}
|
||||
{{- $output = "\"\"" -}}
|
||||
{{- else if (eq "SCALE-ZFS" $storageClass ) }}
|
||||
{{- $output = ( printf "ix-storage-class-%s" .global.Release.Name ) -}}
|
||||
{{- else }}
|
||||
{{- $output = $storageClass -}}
|
||||
{{- end -}}
|
||||
{{- printf "storageClassName: %s" $output -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s" "storageClassName: " -}}
|
||||
{{- end -}}
|
||||
{{- else if .global }}
|
||||
{{- if .global.Values.storageClass -}}
|
||||
{{- $output = .global.Values.storageClass -}}
|
||||
{{- else if .global.Values.ixChartContext }}
|
||||
{{- $output = ( printf "ix-storage-class-%s" .global.Release.Name ) -}}
|
||||
{{- else if .global.Values.global -}}
|
||||
{{- if .global.Values.global.storageClass -}}
|
||||
{{- $output = .global.Values.global.storageClass -}}
|
||||
{{- end -}}
|
||||
{{- if or ( .global.Values.global.ixChartContext ) ( .global.Values.global.isSCALE ) -}}
|
||||
{{- $output = ( printf "ix-storage-class-%s" .global.Release.Name ) -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- if $output -}}
|
||||
{{- printf "storageClassName: %s" $output -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
52
charts/common/templates/lib/values/_capabilities.tpl
Normal file
52
charts/common/templates/lib/values/_capabilities.tpl
Normal file
@@ -0,0 +1,52 @@
|
||||
{{/* automatically set CAP_NET_BIND_SERVICE */}}
|
||||
{{- define "tc.common.lib.values.capabilities" -}}
|
||||
{{- $fixedCapAdd := list }}
|
||||
{{- $customCapAdd := list }}
|
||||
{{- $valueCapAdd := list }}
|
||||
{{- $dynamicCapAdd := list }}
|
||||
{{- $fixedCapDrop := list }}
|
||||
{{- $customCapDrop := list }}
|
||||
{{- $valueCapDrop := list }}
|
||||
{{- $dynamicCapDrop := list }}
|
||||
{{- if .Values.securityContext.capabilities.add }}
|
||||
{{- $valueCapAdd = .Values.securityContext.capabilities.add }}
|
||||
{{- end }}
|
||||
{{- if .Values.securityContext.capabilities.drop }}
|
||||
{{- $valueCapDrop = .Values.securityContext.capabilities.drop }}
|
||||
{{- end }}
|
||||
{{- if .Values.customCapabilities.add }}
|
||||
{{- $customCapAdd = .Values.customCapabilities.add }}
|
||||
{{- end }}
|
||||
{{- if .Values.customCapabilities.drop }}
|
||||
{{- $customCapDrop = .Values.customCapabilities.drop }}
|
||||
{{- end }}
|
||||
|
||||
{{- $privPort := false }}
|
||||
{{- range .Values.service }}
|
||||
{{- range $name, $values := .ports }}
|
||||
{{- if and ( $values.targetPort ) ( kindIs "int" $values.targetPort ) }}
|
||||
{{- if ( semverCompare "<= 1024" ( toString $values.targetPort ) ) }}
|
||||
{{- $privPort = true }}
|
||||
{{- end }}
|
||||
{{- else if and ( $values.port ) ( kindIs "int" $values.port ) }}
|
||||
{{- if ( semverCompare "<= 1024" ( toString $values.port ) ) }}
|
||||
{{- $privPort = true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if $privPort }}
|
||||
{{- $dynamicCapAdd = list "NET_BIND_SERVICE" }}
|
||||
{{- end }}
|
||||
|
||||
{{/* combine and write all capabilities to .Values */}}
|
||||
{{- $CapAdd := concat $fixedCapAdd $valueCapAdd $dynamicCapAdd }}
|
||||
{{- $CapDrop := concat $fixedCapDrop $valueCapDrop $dynamicCapDrop }}
|
||||
{{- if $CapDrop }}
|
||||
{{- $_ := set .Values.securityContext.capabilities "drop" $CapDrop -}}
|
||||
{{- end }}
|
||||
{{- if $CapAdd }}
|
||||
{{- $_ := set .Values.securityContext.capabilities "add" $CapAdd -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
19
charts/common/templates/lib/values/_persistenceSimple.tpl
Normal file
19
charts/common/templates/lib/values/_persistenceSimple.tpl
Normal file
@@ -0,0 +1,19 @@
|
||||
{{/* Allow some extra "fake" persistence options for SCALE GUI simplification */}}
|
||||
{{- define "tc.common.lib.values.persistence.simple" -}}
|
||||
{{- range .Values.persistence }}
|
||||
{{- if .type }}
|
||||
{{- if eq .type "simplePVC" }}
|
||||
{{- $_ := set . "type" "pvc" }}
|
||||
{{- end }}
|
||||
{{- if eq .type "simpleHP" }}
|
||||
{{- $_ := set . "type" "hostPath" }}
|
||||
{{- if .setPermissionsSimple }}
|
||||
{{- $_ := set . "setPermissions" .setPermissionsSimple }}
|
||||
{{- end }}
|
||||
{{- if .hostPathSimple }}
|
||||
{{- $_ := set . "hostPath" .hostPathSimple }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
8
charts/common/templates/lib/values/_privileged.tpl
Normal file
8
charts/common/templates/lib/values/_privileged.tpl
Normal file
@@ -0,0 +1,8 @@
|
||||
{{/* Enable privileged securitycontext when deviceList is used */}}
|
||||
{{- define "tc.common.lib.values.securityContext.privileged" -}}
|
||||
{{- if .Values.securityContext.privileged }}
|
||||
{{- else if .Values.deviceList }}
|
||||
{{- $_ := set .Values.securityContext "privileged" true -}}
|
||||
{{- $_ := set .Values.securityContext "allowPrivilegeEscalation" true -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
10
charts/common/templates/lib/values/_serviceSimple.tpl
Normal file
10
charts/common/templates/lib/values/_serviceSimple.tpl
Normal file
@@ -0,0 +1,10 @@
|
||||
{{/* Allow some extra "fake" service options for SCALE GUI simplification */}}
|
||||
{{- define "tc.common.lib.values.service.simple" -}}
|
||||
{{- range .Values.service }}
|
||||
{{- if .type }}
|
||||
{{- if eq .type "Simple" }}
|
||||
{{- $_ := set . "type" "LoadBalancer" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
28
charts/common/templates/lib/values/_supplementalGroups.tpl
Normal file
28
charts/common/templates/lib/values/_supplementalGroups.tpl
Normal file
@@ -0,0 +1,28 @@
|
||||
{{/* Append default supplementalGroups to user defined groups */}}
|
||||
{{- define "tc.common.lib.values.supplementalGroups" -}}
|
||||
|
||||
{{/* save supplementalGroups to placeholder variables */}}
|
||||
{{- $fixedGroups := list 568 }}
|
||||
{{- $valuegroups := list }}
|
||||
{{- $devGroups := list }}
|
||||
{{- $gpuGroups := list }}
|
||||
|
||||
{{/* put user-entered supplementalgroups in placeholder variable */}}
|
||||
{{- if .Values.podSecurityContext.supplementalGroups }}
|
||||
{{- $valuegroups = .Values.podSecurityContext.supplementalGroups }}
|
||||
{{- end }}
|
||||
|
||||
{{/* Append requered groups to supplementalGroups when deviceList is used */}}
|
||||
{{- if and ( .Values.deviceList ) ( .Values.global.ixChartContext ) }}
|
||||
{{- $devGroups = list 5 10 20 24 }}
|
||||
{{- end }}
|
||||
|
||||
{{/* Append requered groups to supplementalGroups when scaleGPU is used */}}
|
||||
{{- if and ( .Values.scaleGPU ) ( .Values.global.ixChartContext ) }}
|
||||
{{- $gpuGroups = list 44 107 }}
|
||||
{{- end }}
|
||||
|
||||
{{/* combine and write all supplementalGroups to .Values */}}
|
||||
{{- $supGroups := concat $fixedGroups $valuegroups $devGroups $gpuGroups }}
|
||||
{{- $_ := set .Values.podSecurityContext "supplementalGroups" $supGroups -}}
|
||||
{{- end -}}
|
||||
9
charts/common/templates/lib/values/_values.tpl
Normal file
9
charts/common/templates/lib/values/_values.tpl
Normal file
@@ -0,0 +1,9 @@
|
||||
{{/* Merge the local chart values and the common chart defaults */}}
|
||||
{{- define "tc.common.values.init" -}}
|
||||
{{- if .Values.common -}}
|
||||
{{- $defaultValues := deepCopy .Values.common -}}
|
||||
{{- $userValues := deepCopy (omit .Values "common") -}}
|
||||
{{- $mergedValues := mustMergeOverwrite $defaultValues $userValues -}}
|
||||
{{- $_ := set . "Values" (deepCopy $mergedValues) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
10
charts/common/templates/lib/values/_vctSimple.tpl
Normal file
10
charts/common/templates/lib/values/_vctSimple.tpl
Normal file
@@ -0,0 +1,10 @@
|
||||
{{/* Allow some extra "fake" VolumeClaimTemplate options for SCALE GUI simplification */}}
|
||||
{{- define "tc.common.lib.values.volumeClaimTemplates.simple" -}}
|
||||
{{- range .Values.volumeClaimTemplates }}
|
||||
{{- if .type }}
|
||||
{{- if eq .type "simplePVC" }}
|
||||
{{- $_ := set . "type" "pvc" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,9 @@
|
||||
{{/* merge controllerAnnotationsList with controllerAnnotations */}}
|
||||
{{- define "tc.common.lib.values.controller.annotations.list" -}}
|
||||
{{- $controllerAnnotationsDict := dict }}
|
||||
{{- range .Values.controller.annotationsList }}
|
||||
{{- $_ := set $controllerAnnotationsDict .name .value }}
|
||||
{{- end }}
|
||||
{{- $controlleranno := merge .Values.controller.annotations $controllerAnnotationsDict }}
|
||||
{{- $_ := set .Values.controller "annotations" (deepCopy $controlleranno) -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,9 @@
|
||||
{{/* merge controllerLabelsList with controllerLabels */}}
|
||||
{{- define "tc.common.lib.values.controller.label.list" -}}
|
||||
{{- $controllerLabelsDict := dict }}
|
||||
{{- range .Values.controller.labelsList }}
|
||||
{{- $_ := set $controllerLabelsDict .name .value }}
|
||||
{{- end }}
|
||||
{{- $controllerlab := merge .Values.controller.labels $controllerLabelsDict }}
|
||||
{{- $_ := set .Values "labels" (deepCopy $controllerlab) -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,14 @@
|
||||
{{/* merge ingressAnnotationsList with ingressAnnotations */}}
|
||||
{{- define "tc.common.lib.values.ingress.annotations.list" -}}
|
||||
{{- range $index, $item := .Values.ingress }}
|
||||
{{- if $item.enabled }}
|
||||
{{- $ingressAnnotationsDict := dict }}
|
||||
{{- range $item.annotationsList }}
|
||||
{{- $_ := set $ingressAnnotationsDict .name .value }}
|
||||
{{- end }}
|
||||
{{- $tmp := $item.annotations }}
|
||||
{{- $ingressanno := merge $tmp $ingressAnnotationsDict }}
|
||||
{{- $_ := set $item "annotations" (deepCopy $ingressanno) -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,14 @@
|
||||
{{/* merge ingressLabelsList with ingressLabels */}}
|
||||
{{- define "tc.common.lib.values.ingress.label.list" -}}
|
||||
{{- range $index, $item := .Values.ingress }}
|
||||
{{- if $item.enabled }}
|
||||
{{- $ingressLabelsDict := dict }}
|
||||
{{- range $item.labelsList }}
|
||||
{{- $_ := set $ingressLabelsDict .name .value }}
|
||||
{{- end }}
|
||||
{{- $tmp := $item.labels }}
|
||||
{{- $ingresslab := merge $tmp $ingressLabelsDict }}
|
||||
{{- $_ := set $item "labels" (deepCopy $ingresslab) -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
13
charts/common/templates/lib/values/lists/_ingressList.tpl
Normal file
13
charts/common/templates/lib/values/lists/_ingressList.tpl
Normal file
@@ -0,0 +1,13 @@
|
||||
{{/* merge ingressList with ingress */}}
|
||||
{{- define "tc.common.lib.values.ingress.list" -}}
|
||||
{{- $ingDict := dict }}
|
||||
{{- range $index, $item := .Values.ingressList -}}
|
||||
{{- $name := ( printf "list-%s" ( $index | toString ) ) }}
|
||||
{{- if $item.name }}
|
||||
{{- $name = $item.name }}
|
||||
{{- end }}
|
||||
{{- $_ := set $ingDict $name $item }}
|
||||
{{- end }}
|
||||
{{- $ing := merge .Values.ingress $ingDict }}
|
||||
{{- $_ := set .Values "ingress" (deepCopy $ing) -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,14 @@
|
||||
{{/* merge persistenceAnnotationsList with persistenceAnnotations */}}
|
||||
{{- define "tc.common.lib.values.persistence.annotations.list" -}}
|
||||
{{- range $index, $item := .Values.persistence }}
|
||||
{{- if $item.enabled }}
|
||||
{{- $persistenceAnnotationsDict := dict }}
|
||||
{{- range $item.annotationsList }}
|
||||
{{- $_ := set $persistenceAnnotationsDict .name .value }}
|
||||
{{- end }}
|
||||
{{- $tmp := $item.annotations }}
|
||||
{{- $persistenceanno := merge $tmp $persistenceAnnotationsDict }}
|
||||
{{- $_ := set $item "annotations" (deepCopy $persistenceanno) -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,14 @@
|
||||
{{/* merge persistenceLabelsList with persistenceLabels */}}
|
||||
{{- define "tc.common.lib.values.persistence.label.list" -}}
|
||||
{{- range $index, $item := .Values.persistence }}
|
||||
{{- if $item.enabled }}
|
||||
{{- $persistenceLabelsDict := dict }}
|
||||
{{- range $item.labelsList }}
|
||||
{{- $_ := set $persistenceLabelsDict .name .value }}
|
||||
{{- end }}
|
||||
{{- $tmp := $item.labels }}
|
||||
{{- $persistencelab := merge $tmp $persistenceLabelsDict }}
|
||||
{{- $_ := set $item "labels" (deepCopy $persistencelab) -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,21 @@
|
||||
{{/* merge persistenceList with Persitence */}}
|
||||
{{- define "tc.common.lib.values.persistence.list" -}}
|
||||
{{- $perDict := dict }}
|
||||
{{- range $index, $item := .Values.persistenceList -}}
|
||||
{{- $name := ( printf "list-%s" ( $index | toString ) ) }}
|
||||
{{- if $item.name }}
|
||||
{{- $name = $item.name }}
|
||||
{{- end }}
|
||||
{{- $_ := set $perDict $name $item }}
|
||||
{{- end }}
|
||||
|
||||
{{- range $index, $item := .Values.deviceList -}}
|
||||
{{- $name := ( printf "device-%s" ( $index | toString ) ) }}
|
||||
{{- if $item.name }}
|
||||
{{- $name = $item.name }}
|
||||
{{- end }}
|
||||
{{- $_ := set $perDict $name $item }}
|
||||
{{- end }}
|
||||
{{- $per := merge .Values.persistence $perDict }}
|
||||
{{- $_ := set .Values "persistence" (deepCopy $per) -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,9 @@
|
||||
{{/* merge podAnnotationsList with podAnnotations */}}
|
||||
{{- define "tc.common.lib.values.pod.annotations.list" -}}
|
||||
{{- $podAnnotationsDict := dict }}
|
||||
{{- range .Values.podAnnotationsList }}
|
||||
{{- $_ := set $podAnnotationsDict .name .value }}
|
||||
{{- end }}
|
||||
{{- $podanno := merge .Values.podAnnotations $podAnnotationsDict }}
|
||||
{{- $_ := set .Values "podAnnotations" (deepCopy $podanno) -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,9 @@
|
||||
{{/* merge podLabelsList with podLabels */}}
|
||||
{{- define "tc.common.lib.values.pod.label.list" -}}
|
||||
{{- $podLabelsDict := dict }}
|
||||
{{- range .Values.controller.labelsList }}
|
||||
{{- $_ := set $podLabelsDict .name .value }}
|
||||
{{- end }}
|
||||
{{- $podlab := merge .Values.controller.labels $podLabelsDict }}
|
||||
{{- $_ := set .Values.controller "labels" (deepCopy $podlab) -}}
|
||||
{{- end -}}
|
||||
20
charts/common/templates/lib/values/lists/_portsList.tpl
Normal file
20
charts/common/templates/lib/values/lists/_portsList.tpl
Normal file
@@ -0,0 +1,20 @@
|
||||
{{/* merge portsList with ports */}}
|
||||
{{- define "tc.common.lib.values.ports.list" -}}
|
||||
{{- range $index, $item := .Values.service -}}
|
||||
{{- if $item.enabled }}
|
||||
{{- $portsDict := dict }}
|
||||
{{- range $index2, $item2 := $item.portsList -}}
|
||||
{{- if $item2.enabled }}
|
||||
{{- $name := ( printf "list-%s" ( $index2 | toString ) ) }}
|
||||
{{- if $item2.name }}
|
||||
{{- $name = $item2.name }}
|
||||
{{- end }}
|
||||
{{- $_ := set $portsDict $name $item2 }}
|
||||
{{- end }}
|
||||
{{- $tmp := $item.ports }}
|
||||
{{- $ports := merge $tmp $portsDict }}
|
||||
{{- $_ := set $item "ports" (deepCopy $ports) -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
15
charts/common/templates/lib/values/lists/_serviceList.tpl
Normal file
15
charts/common/templates/lib/values/lists/_serviceList.tpl
Normal file
@@ -0,0 +1,15 @@
|
||||
{{/* merge serviceList with service */}}
|
||||
{{- define "tc.common.lib.values.service.list" -}}
|
||||
{{- $portsDict := dict }}
|
||||
{{- range $index, $item := .Values.serviceList -}}
|
||||
{{- if $item.enabled }}
|
||||
{{- $name := ( printf "list-%s" ( $index | toString ) ) }}
|
||||
{{- if $item.name }}
|
||||
{{- $name = $item.name }}
|
||||
{{- end }}
|
||||
{{- $_ := set $portsDict $name $item }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $srv := merge .Values.service $portsDict }}
|
||||
{{- $_ := set .Values "service" (deepCopy $srv) -}}
|
||||
{{- end -}}
|
||||
@@ -1,11 +1,11 @@
|
||||
{{/*
|
||||
Main entrypoint for the common library chart. It will render all underlying templates based on the provided values.
|
||||
*/}}
|
||||
{{- define "common.all" -}}
|
||||
{{- define "tc.common.loader.all" -}}
|
||||
{{- /* Generate chart and dependency values */ -}}
|
||||
{{- include "common.setup" . }}
|
||||
{{- include "tc.common.loader.init" . }}
|
||||
|
||||
{{- /* Generate remaining objects */ -}}
|
||||
{{- include "common.postSetup" . }}
|
||||
{{- include "tc.common.loader.apply" . }}
|
||||
|
||||
{{- end -}}
|
||||
62
charts/common/templates/loader/_apply.tpl
Normal file
62
charts/common/templates/loader/_apply.tpl
Normal file
@@ -0,0 +1,62 @@
|
||||
{{/*
|
||||
Secondary entrypoint and primary loader for the common chart
|
||||
*/}}
|
||||
{{- define "tc.common.loader.apply" -}}
|
||||
{{- /* Render the externalInterfaces */ -}}
|
||||
{{ include "tc.common.scale.externalInterfaces" . | nindent 0 }}
|
||||
|
||||
{{- /* Enable code-server add-on if required */ -}}
|
||||
{{- if .Values.addons.codeserver.enabled }}
|
||||
{{- include "tc.common.addon.codeserver" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Enable VPN add-on if required */ -}}
|
||||
{{- if ne "disabled" .Values.addons.vpn.type -}}
|
||||
{{- include "tc.common.addon.vpn" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Enable promtail add-on if required */ -}}
|
||||
{{- if .Values.addons.promtail.enabled }}
|
||||
{{- include "tc.common.addon.promtail" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Enable netshoot add-on if required */ -}}
|
||||
{{- if .Values.addons.netshoot.enabled }}
|
||||
{{- include "tc.common.addon.netshoot" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Build the configmaps */ -}}
|
||||
{{ include "tc.common.spawner.configmap" . | nindent 0 }}
|
||||
|
||||
{{- /* Build the secrets */ -}}
|
||||
{{ include "tc.common.spawner.secret" . | nindent 0 }}
|
||||
|
||||
{{- /* Build the templates */ -}}
|
||||
{{- include "tc.common.spawner.pvc" . }}
|
||||
|
||||
{{ include "tc.common.spawner.serviceaccount" . | nindent 0 }}
|
||||
|
||||
{{- if .Values.controller.enabled }}
|
||||
{{- if eq .Values.controller.type "deployment" }}
|
||||
{{- include "tc.common.deployment" . | nindent 0 }}
|
||||
{{ else if eq .Values.controller.type "daemonset" }}
|
||||
{{- include "tc.common.daemonset" . | nindent 0 }}
|
||||
{{ else if eq .Values.controller.type "statefulset" }}
|
||||
{{- include "tc.common.statefulset" . | nindent 0 }}
|
||||
{{ else }}
|
||||
{{- fail (printf "Not a valid controller.type (%s)" .Values.controller.type) }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{ include "tc.common.spawner.rbac" . | nindent 0 }}
|
||||
|
||||
{{ include "tc.common.spawner.hpa" . | nindent 0 }}
|
||||
|
||||
{{ include "tc.common.spawner.service" . | nindent 0 }}
|
||||
|
||||
{{ include "tc.common.spawner.ingress" . | nindent 0 }}
|
||||
|
||||
{{ include "tc.common.scale.portal" . | nindent 0 }}
|
||||
|
||||
{{ include "tc.common.spawner.networkpolicy" . | nindent 0 }}
|
||||
{{- end -}}
|
||||
30
charts/common/templates/loader/_init.tpl
Normal file
30
charts/common/templates/loader/_init.tpl
Normal file
@@ -0,0 +1,30 @@
|
||||
{{- define "tc.common.loader.init" -}}
|
||||
{{- /* Merge the local chart values and the common chart defaults */ -}}
|
||||
{{- include "tc.common.values.init" . }}
|
||||
|
||||
{{- include "tc.common.loader.lists" . }}
|
||||
|
||||
{{- include "tc.common.lib.values.persistence.simple" . }}
|
||||
|
||||
{{- include "tc.common.lib.values.volumeClaimTemplates.simple" . }}
|
||||
|
||||
{{- include "tc.common.lib.values.service.simple" . }}
|
||||
|
||||
{{- include "tc.common.lib.values.capabilities" . }}
|
||||
|
||||
{{- include "tc.common.lib.values.supplementalGroups" . }}
|
||||
|
||||
{{- include "tc.common.lib.values.securityContext.privileged" . }}
|
||||
|
||||
{{- /* Autogenerate postgresql passwords if needed */ -}}
|
||||
{{- include "tc.common.dependencies.postgresql.injector" . }}
|
||||
|
||||
{{- /* Autogenerate redis passwords if needed */ -}}
|
||||
{{- include "tc.common.dependencies.redis.injector" . }}
|
||||
|
||||
{{- /* Autogenerate mariadb passwords if needed */ -}}
|
||||
{{- include "tc.common.dependencies.mariadb.injector" . }}
|
||||
|
||||
{{- /* Autogenerate mongodb passwords if needed */ -}}
|
||||
{{- include "tc.common.dependencies.mongodb.injector" . }}
|
||||
{{- end -}}
|
||||
23
charts/common/templates/loader/_lists.tpl
Normal file
23
charts/common/templates/loader/_lists.tpl
Normal file
@@ -0,0 +1,23 @@
|
||||
{{/* load all list to dict injectors */}}
|
||||
{{- define "tc.common.loader.lists" -}}
|
||||
|
||||
|
||||
{{ include "tc.common.lib.values.controller.label.list" . }}
|
||||
{{ include "tc.common.lib.values.controller.annotations.list" . }}
|
||||
|
||||
{{ include "tc.common.lib.values.pod.label.list" . }}
|
||||
{{ include "tc.common.lib.values.pod.annotations.list" . }}
|
||||
|
||||
{{ include "tc.common.lib.values.persistence.list" . }}
|
||||
{{ include "tc.common.lib.values.persistence.label.list" . }}
|
||||
{{ include "tc.common.lib.values.persistence.annotations.list" . }}
|
||||
|
||||
{{ include "tc.common.lib.values.service.list" . }}
|
||||
|
||||
{{ include "tc.common.lib.values.ingress.list" . }}
|
||||
{{ include "tc.common.lib.values.ingress.label.list" . }}
|
||||
{{ include "tc.common.lib.values.ingress.annotations.list" . }}
|
||||
|
||||
|
||||
|
||||
{{- end -}}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user