Common Refactor

This commit is contained in:
Kjeld Schouten-Lebbing
2022-11-19 22:31:35 +01:00
parent 0898c5dee7
commit da3e2d2de9
385 changed files with 34405 additions and 11713 deletions

View File

@@ -0,0 +1,38 @@
name: str()
kubeVersion: str()
apiVersion: str()
appVersion: any(str(), num())
version: str(required=True)
upstream_version: any(str(), num(), required=False)
description: str()
type: str(required=False)
home: str()
icon: str()
sources: list(str(), required=False)
dependencies: list(include('dependency'), required=False)
deprecated: bool(required=False)
engine: str(required=False)
condition: str(required=False)
keywords: list(str(), required=False)
tags: str(required=False)
maintainers: list(include('maintainer'))
annotations: map(str(), str(), required=False)
---
maintainer:
name: str()
email: str(required=False)
url: str(required=True)
---
dependency:
name: str()
repository: str()
version: str()
condition: str(required=False)
tags: list(str(), required=False)
import-values: any(list(str()), list(include('import-value')), required=False)
enabled: bool(required=False)
alias: str(required=False)
---
import-value:
child: str()
parent: str()

View File

@@ -0,0 +1,7 @@
remote: origin
target-branch: master
chart-yaml-schema: .github/ct-install-config/chart_schema.yaml
chart-dirs:
- library
- charts
excluded-charts: []

View File

@@ -0,0 +1,7 @@
remote: origin
target-branch: master
helm-extra-args: --timeout 600s --debug
chart-yaml-schema: .github/ct-install-config/chart_schema.yaml
chart-dirs:
- library
excluded-charts: []

View File

@@ -0,0 +1,42 @@
---
rules:
braces:
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: -1
max-spaces-inside-empty: -1
brackets:
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: -1
max-spaces-inside-empty: -1
colons:
max-spaces-before: 0
max-spaces-after: 1
commas:
max-spaces-before: 0
min-spaces-after: 1
max-spaces-after: 1
comments:
require-starting-space: true
min-spaces-from-content: 2
document-end: disable
document-start: disable # No --- to start a file
empty-lines:
max: 2
max-start: 0
max-end: 0
hyphens:
max-spaces-after: 1
indentation:
spaces: consistent
indent-sequences: whatever # - list indentation will handle both indentation and without
check-multi-line-strings: false
key-duplicates: enable
line-length: disable # Lines can be any length
new-line-at-end-of-file: enable
new-lines:
type: unix
trailing-spaces: enable
truthy:
level: warning

View File

@@ -1,7 +0,0 @@
remote: origin
target-branch: main
helm-extra-args: --timeout 600s --debug
chart-dirs:
- helper-charts
chart-repos:
- k8s-at-home-libraries=https://library-charts.truecharts.org

View File

@@ -1,7 +0,0 @@
remote: origin
target-branch: main
helm-extra-args: --timeout 600s
chart-dirs:
- charts
chart-repos:
- truecharts-libraries=https://library-charts.truecharts.org

View File

@@ -1,99 +0,0 @@
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@755da8c3cf115ac066823e79a1e1788f8940201b # tag=v3
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # tag=v3
with:
version: v3.5.4
- uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # tag=v4
with:
python-version: 3.7
- name: Set up chart-testing
uses: helm/chart-testing-action@afea100a513515fbd68b0e72a7bb0ae34cb62aec # tag=v2.3.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@755da8c3cf115ac066823e79a1e1788f8940201b # tag=v3
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # tag=v3
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@755da8c3cf115ac066823e79a1e1788f8940201b # tag=v3
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # tag=v3
with:
version: v3.5.4
- uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # tag=v4
with:
python-version: 3.7
- name: Set up chart-testing
uses: helm/chart-testing-action@afea100a513515fbd68b0e72a7bb0ae34cb62aec # tag=v2.3.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: ct install --all --config .github/ct-install.yaml --debug

View File

@@ -8,7 +8,7 @@ on:
branches:
- main
paths:
- 'charts/**'
- 'charts/*'
jobs:
release-charts:

View File

@@ -0,0 +1,191 @@
name: Common Library Tests
on:
pull_request:
paths:
- library/**
- .github/workflows/common_library_tests.yaml
jobs:
lint:
name: Lint Common
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
# We run tests on Helm version of latest SCALE release, SCALE nightly and manually defined "latest"
helm-version:
- v3.9.4
- v3.10.3
- v3.11.0-rc.1
steps:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
with:
fetch-depth: 1
- name: Install Helm
uses: azure/setup-helm@f382f75448129b3be48f8121b9857be18d815a82 # tag=v3
with:
version: ${{ matrix.helm-version }}
- uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # tag=v4
with:
python-version: "3.10"
- name: Set up chart-testing
uses: helm/chart-testing-action@afea100a513515fbd68b0e72a7bb0ae34cb62aec # tag=v2.3.1
- name: Run chart-testing (lint)
run: |
ct lint --config .github/ct-install-config/ct-lint.yaml \
--lint-conf .github/ct-install-config/lint-conf.yaml \
--charts library/common-test \
--debug
unittest:
name: Unit Tests
runs-on: ubuntu-22.04
env:
helmunitversion: 0.2.11
strategy:
fail-fast: false
matrix:
# We run tests on Helm version of latest SCALE release, SCALE nightly and manually defined "latest"
helm-version:
- v3.9.4
- v3.10.3
- v3.11.0-rc.1
steps:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
with:
fetch-depth: 1
- name: Cache helm plugins
uses: actions/cache@v3
with:
path: |
/home/runner/.local/share/helm/plugins/helm-unittest
key: helm-${{ matrix.helm-version }}-unittest-v${{ env.helmunitversion }}-${{ hashFiles('/home/runner/.local/share/helm/plugins/helm-unittest') }}
restore-keys: |
helm-${{ matrix.helm-version }}-unittest-v${{ env.helmunitversion }}-${{ hashFiles('/home/runner/.local/share/helm/plugins/helm-unittest') }}
helm-${{ matrix.helm-version }}-unittest-v${{ env.helmunitversion }}
- name: Install Helm
uses: azure/setup-helm@f382f75448129b3be48f8121b9857be18d815a82 # tag=v3
with:
version: ${{ matrix.helm-version }}
- name: Run tests
run: |
helm unittest -h || helm plugin install https://github.com/quintush/helm-unittest --version "v${helmunitversion}"
cd library/common-test/
helm dependency update
helm unittest --helm3 -f "tests/*/*.yaml" .
install:
needs:
- lint
name: Install Charts
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
# We run tests on k3s version of latest SCALE release, SCALE nightly and manually defined "latest"
k3s-version:
- v1.25.3+k3s1
- v1.26.0+k3s1
# We run tests on Helm version of latest SCALE release, SCALE nightly and manually defined "latest"
helm-version:
- v3.9.4
- v3.10.3
- v3.11.0-rc.1
steps:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
with:
fetch-depth: 1
- name: Install Helm
uses: azure/setup-helm@f382f75448129b3be48f8121b9857be18d815a82 # tag=v3
with:
version: ${{ matrix.helm-version }}
- uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # tag=v4
with:
python-version: "3.10"
- name: Set up chart-testing
uses: helm/chart-testing-action@afea100a513515fbd68b0e72a7bb0ae34cb62aec # tag=v2.3.1
- name: Create k3d cluster - Attempt 1/3
continue-on-error: true
id: createc1
uses: nolar/setup-k3d-k3s@293b8e5822a20bc0d5bcdd4826f1a665e72aba96 # tag=v1.0.9
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ matrix.k3s-version }}
# Flags found here https://github.com/k3d-io/k3d
k3d-args: --k3s-arg --disable=metrics-server@server:*
- name: Wait 10 second to retry
if: steps.createc1.outcome=='failure'
run: |
sleep 10
- name: Create k3d cluster - Attempt 2/3
continue-on-error: true
if: steps.createc1.outcome=='failure'
id: createc2
uses: nolar/setup-k3d-k3s@293b8e5822a20bc0d5bcdd4826f1a665e72aba96 # tag=v1.0.9
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ matrix.k3s-version }}
# Flags found here https://github.com/k3d-io/k3d
k3d-args: --k3s-arg --disable=metrics-server@server:*
- name: Wait 10 second to retry
if: steps.createc2.outcome=='failure'
run: |
sleep 10
- name: Create k3d cluster - Attempt 3/3
id: createc3
if: steps.createc2.outcome=='failure'
uses: nolar/setup-k3d-k3s@293b8e5822a20bc0d5bcdd4826f1a665e72aba96 # tag=v1.0.9
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ matrix.k3s-version }}
# Flags found here https://github.com/k3d-io/k3d
k3d-args: --k3s-arg --disable=metrics-server@server:*
- name: Move CI values
run: |
mv library/common-test/ci library/common-test/runtests
- name: Run chart-testing (install) - Basic Values
run: |
mv -f library/common-test/runtests/basic-values.yaml library/common-test/values.yaml
ct install --config .github/ct-install-config/ct-install.yaml \
--charts library/common-test \
--debug
- name: Run chart-testing (install) - persistence Values
run: |
mv -f library/common-test/runtests/persistence-values.yaml library/common-test/values.yaml
ct install --config .github/ct-install-config/ct-install.yaml \
--charts library/common-test \
--debug
- name: Run chart-testing (install) - rbac Values
run: |
mv -f library/common-test/runtests/rbac-values.yaml library/common-test/values.yaml
ct install --config .github/ct-install-config/ct-install.yaml \
--charts library/common-test \
--debug

27
.github/workflows/lint.yaml vendored Normal file
View File

@@ -0,0 +1,27 @@
name: flake8
on: [push]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
- name: Setup flake8 config
run: |
echo '[flake8]' > setup.cfg
echo 'max-line-length = 120' >> setup.cfg
- name: Analysing the code with flake8
run: |
find -name upgrade_strategy -exec sh -c "flake8 {} && exit 0 || echo $? > .exit_status" \;
test -f .exit_status && rm .exit_status && exit 1; exit 0;

File diff suppressed because it is too large Load Diff

View File

@@ -1,287 +0,0 @@
# Default Helm-Values
TrueCharts is primarily build to supply TrueNAS SCALE Apps.
However, we also supply all Apps as standard Helm-Charts. In this document we aim to document the default values in our Common Chart.
This chart is used by a lot of our Apps to provide sane defaults and logic.
## Values
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| TZ | string | `"UTC"` | Set Container Timezone |
| additionalContainers | object | `{}` | Specify any additional containers here as dictionary items. Each additional container should have its own key. Helm templates can be used. |
| addons | object | See below | The common chart supports several add-ons. These can be configured under this key. |
| addons.codeserver | object | See values.yaml | The common library supports adding a code-server add-on to access files. It can be configured under this key. For more info, check out [our docs](http://docs.k8s-at-home.com/our-helm-charts/common-library-add-ons/#code-server) |
| addons.codeserver.args | list | `["--auth","none"]` | Set codeserver command line arguments. Consider setting --user-data-dir to a persistent location to preserve code-server setting changes |
| addons.codeserver.enabled | bool | `false` | Enable running a code-server container in the pod |
| addons.codeserver.env | object | `{}` | Set any environment variables for code-server here |
| addons.codeserver.envList | list | `[]` | All variables specified here will be added to the codeserver sidecar container See the documentation of the codeserver image for all config values |
| addons.codeserver.git | object | See below | Optionally allow access a Git repository by passing in a private SSH key |
| addons.codeserver.git.deployKey | string | `""` | Raw SSH private key |
| addons.codeserver.git.deployKeyBase64 | string | `""` | Base64-encoded SSH private key. When both variables are set, the raw SSH key takes precedence. |
| addons.codeserver.git.deployKeySecret | string | `""` | Existing secret containing SSH private key The chart expects it to be present under the `id_rsa` key. |
| addons.codeserver.ingress.enabled | bool | `false` | Enable an ingress for the code-server add-on. |
| addons.codeserver.service.enabled | bool | `true` | Enable a service for the code-server add-on. |
| addons.codeserver.workingDir | string | `"/"` | Specify the working dir that will be opened when code-server starts If not given, the app will default to the mountpah of the first specified volumeMount |
| addons.netshoot | object | See values.yaml | The common library supports adding a netshoot add-on to troubleshoot network issues within a Pod. It can be configured under this key. |
| addons.netshoot.enabled | bool | `false` | Enable running a netshoot container in the pod |
| addons.netshoot.env | object | `{}` | Set any environment variables for netshoot here |
| addons.netshoot.envList | list | `[]` | All variables specified here will be added to the netshoot sidecar container See the documentation of the netshoot image for all config values |
| addons.promtail | object | See values.yaml | The common library supports adding a promtail add-on to to access logs and ship them to loki. It can be configured under this key. |
| addons.promtail.args | list | `[]` | Set promtail command line arguments |
| addons.promtail.enabled | bool | `false` | Enable running a promtail container in the pod |
| addons.promtail.env | object | `{}` | Set any environment variables for promtail here |
| addons.promtail.envList | list | `[]` | All variables specified here will be added to the promtail sidecar container See the documentation of the promtail image for all config values |
| addons.promtail.logs | list | `[]` | The paths to logs on the volume |
| addons.promtail.loki | string | `""` | The URL to Loki |
| addons.vpn | object | See values.yaml | The common chart supports adding a VPN add-on. It can be configured under this key. For more info, check out [our docs](http://docs.k8s-at-home.com/our-helm-charts/common-library-add-ons/#wireguard-vpn) |
| addons.vpn.configFile | object | `{"enabled":true,"hostPath":"/vpn/vpn.conf","hostPathType":"File","noMount":true,"type":"hostPath"}` | Provide a customized vpn configuration file to be used by the VPN. |
| addons.vpn.configFile.hostPath | string | `"/vpn/vpn.conf"` | Which path on the host should be mounted. |
| addons.vpn.configFile.hostPathType | string | `"File"` | Specifying a hostPathType adds a check before trying to mount the path. See Kubernetes documentation for options. |
| addons.vpn.env | object | `{}` | All variables specified here will be added to the vpn sidecar container See the documentation of the VPN image for all config values |
| addons.vpn.envList | list | `[]` | All variables specified here will be added to the vpn sidecar container See the documentation of the VPN image for all config values |
| addons.vpn.openvpn | object | See below | OpenVPN specific configuration |
| addons.vpn.openvpn.username | string | `""` | Credentials to connect to the VPN Service (used with -a) Only using password is enough |
| addons.vpn.securityContext | object | See values.yaml | Set the VPN container specific securityContext |
| addons.vpn.type | string | `"disabled"` | Specify the VPN type. Valid options are disabled, openvpn or wireguard |
| affinity | object | `{}` | Defines affinity constraint rules. [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) |
| alpineImage | object | See below | alpine specific configuration |
| alpineImage.pullPolicy | string | `"IfNotPresent"` | Specify the Alpine image pull policy |
| alpineImage.repository | string | `"ghcr.io/truecharts/alpine"` | Specify the Alpine image |
| alpineImage.tag | string | `"v3.15.2@sha256:29ed3480a0ee43f7af681fed5d4fc215516abf1c41eade6938b26d8c9c2c7583"` | Specify the Alpine image tag |
| args | list | `[]` | Override the args for the default container |
| autoscaling | object | <disabled> | Add a Horizontal Pod Autoscaler |
| codeserverImage | object | See below | codeserver specific configuration |
| codeserverImage.pullPolicy | string | `"IfNotPresent"` | Specify the code-server image pull policy |
| codeserverImage.repository | string | `"ghcr.io/truecharts/code-server"` | Specify the code-server image |
| codeserverImage.tag | string | `"v4.2.0@sha256:82e2d802e59b26954096529aa08e83bebd2004da664fee9ab6c911e4f5ab6c48"` | Specify the code-server image tag |
| command | list | `[]` | Override the command(s) for the default container |
| configmap | object | See below | Configure configMaps for the chart here. Additional configMaps can be added by adding a dictionary key similar to the 'config' object. |
| configmap.config.annotations | object | `{}` | Annotations to add to the configMap |
| configmap.config.data | object | `{}` | configMap data content. Helm template enabled. |
| configmap.config.enabled | bool | `false` | Enables or disables the configMap |
| configmap.config.labels | object | `{}` | Labels to add to the configMap |
| controller.annotations | object | `{}` | Set annotations on the deployment/statefulset/daemonset |
| controller.annotationsList | list | `[]` | Set additional annotations on the deployment/statefulset/daemonset |
| controller.enabled | bool | `true` | enable the controller. |
| controller.labels | object | `{}` | Set labels on the deployment/statefulset/daemonset |
| controller.labelsList | list | `[]` | Set additional labels on the deployment/statefulset/daemonset |
| controller.replicas | int | `1` | Number of desired pods |
| controller.revisionHistoryLimit | int | `3` | ReplicaSet revision history limit |
| controller.rollingUpdate.partition | string | `nil` | Set statefulset RollingUpdate partition |
| controller.rollingUpdate.surge | string | `nil` | Set deployment RollingUpdate max surge |
| controller.rollingUpdate.unavailable | string | `nil` | Set deployment RollingUpdate max unavailable |
| controller.strategy | string | `nil` | Set the controller upgrade strategy For Deployments, valid values are Recreate (default) and RollingUpdate. For StatefulSets, valid values are OnDelete and RollingUpdate (default). DaemonSets ignore this. |
| controller.type | string | `"deployment"` | Set the controller type. Valid options are deployment, daemonset or statefulset |
| customCapabilities | object | `{"add":[],"drop":[]}` | Can be used to set securityContext.capabilities outside of the GUI on TrueNAS SCALE |
| deviceList | list | [] | Configure persistenceList for the chart here. Used to create an additional GUI element in SCALE for mounting USB devices Additional items can be added by adding a items similar to persistence |
| dnsConfig | object | `{"nameservers":[],"options":[{"name":"ndots","value":"1"}],"searches":[]}` | Optional DNS settings, configuring the ndots option may resolve nslookup issues on some Kubernetes setups. |
| dnsPolicy | string | `nil` | Defaults to "ClusterFirst" if hostNetwork is false and "ClusterFirstWithHostNet" if hostNetwork is true. |
| enableServiceLinks | bool | `false` | Enable/disable the generation of environment variables for services. [[ref]](https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#accessing-the-service) |
| env | object | `{}` | Main environment variables. Template enabled. Syntax options: A) TZ: UTC B) PASSWD: '{{ .Release.Name }}' C) PASSWD: envFrom: ... |
| envFrom | list | `[]` | |
| envTpl | object | `{}` | |
| envValueFrom | object | `{}` | |
| externalInterfaces | list | `[]` | Use this directly attach a pod to a SCALE interface. Please be aware: This bypasses k8s services |
| extraArgs | list | `[]` | Add args in addition to the arguments set by default. Primarily for the SCALE GUI |
| global.fullnameOverride | string | `nil` | Set the entire name definition |
| global.isSCALE | bool | `false` | |
| global.nameOverride | string | `nil` | Set an override for the prefix of the fullname |
| hostAliases | list | `[]` | Use hostAliases to add custom entries to /etc/hosts - mapping IP addresses to hostnames. [[ref]](https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/) |
| hostNetwork | bool | `false` | When using hostNetwork make sure you set dnsPolicy to `ClusterFirstWithHostNet` |
| hostname | string | `nil` | Allows specifying explicit hostname setting |
| image.pullPolicy | string | `nil` | image pull policy |
| image.repository | string | `nil` | image repository |
| image.tag | string | `nil` | image tag |
| imageSelector | string | `"image"` | Image Selector allows for easy picking a different image dict, important for the SCALE GUI |
| ingress | object | See below | Configure the ingresses for the chart here. Additional ingresses can be added by adding a dictionary key similar to the 'main' ingress. |
| ingress.main.annotations | object | `{}` | Provide additional annotations which may be required. |
| ingress.main.autoLink | bool | `false` | Autolink the ingress to a service and port, both with the same name as the ingress. |
| ingress.main.enableFixedMiddlewares | bool | `true` | disable to ignore any default middlwares |
| ingress.main.enabled | bool | `false` | Enables or disables the ingress |
| ingress.main.fixedMiddlewares | list | `["chain-basic"]` | List of middlewares in the traefikmiddlewares k8s namespace to add automatically Creates an annotation with the middlewares and appends k8s and traefik namespaces to the middleware names Primarily used for TrueNAS SCALE to add additional (seperate) middlewares without exposing them to the end-user |
| ingress.main.hosts[0].host | string | `"chart-example.local"` | Host address. Helm template can be passed. |
| ingress.main.hosts[0].paths[0].path | string | `"/"` | Path. Helm template can be passed. |
| ingress.main.hosts[0].paths[0].pathType | string | `"Prefix"` | Ignored if not kubeVersion >= 1.14-0 |
| ingress.main.hosts[0].paths[0].service.name | string | `nil` | Overrides the service name reference for this path |
| ingress.main.hosts[0].paths[0].service.port | string | `nil` | Overrides the service port reference for this path |
| ingress.main.ingressClassName | string | `nil` | Set the ingressClass that is used for this ingress. Requires Kubernetes >=1.19 |
| ingress.main.labels | object | `{}` | Provide additional labels which may be required. |
| ingress.main.middlewares | list | `[]` | Additional List of middlewares in the traefikmiddlewares k8s namespace to add automatically Creates an annotation with the middlewares and appends k8s and traefik namespaces to the middleware names |
| ingress.main.nameOverride | string | `nil` | Override the name suffix that is used for this ingress. |
| ingress.main.primary | bool | `true` | Make this the primary ingress (used in probes, notes, etc...). If there is more than 1 ingress, make sure that only 1 ingress is marked as primary. |
| ingress.main.tls | list | `[]` | Configure TLS for the ingress. Both secretName and hosts can process a Helm template. |
| ingressList | list | [] | Configure ingressList for the chart here. Additional items can be added by adding a items similar to ingress |
| initContainers | object | `{}` | Specify any initContainers here as dictionary items. Each initContainer should have its own key. The dictionary item key will determine the order. Helm templates can be used. |
| installContainers | object | `{}` | These containers will be run, as an initcontainer, a single time at install only. |
| lifecycle | object | `{}` | Configure the lifecycle for the main container |
| mariadb | object | See below | mariadb dependency configuration |
| mariadb.url | object | `{}` | can be used to make an easy accessable note which URLS to use to access the DB. |
| mariadbImage | object | See below | mariadb specific configuration |
| mariadbImage.pullPolicy | string | `"IfNotPresent"` | Specify the mariadb image pull policy |
| mariadbImage.repository | string | `"ghcr.io/truecharts/mariadb"` | Specify the mariadb image |
| mariadbImage.tag | string | `"v10.7.3@sha256:63743b10ac562b8f63abd3dfa246298c6678cfeb9e7559c65265f5066385fcf6"` | Specify the mariadb image tag |
| netshootImage | object | See below | netshoot specific configuration |
| netshootImage.pullPolicy | string | `"Always"` | Specify the netshoot image pull policy |
| netshootImage.repository | string | `"ghcr.io/truecharts/netshoot"` | Specify the netshoot image |
| netshootImage.tag | string | `"latest@sha256:505d3430ed7c1d43fed18dbd1177b76ecb6fc376113bc41d34da230c402a4855"` | Specify the netshoot image tag |
| networkPolicy | object | See below | Configure networkPolicy for the chart here. |
| networkPolicy.egress | list | `[]` | add or remove egress policies |
| networkPolicy.enabled | bool | `false` | Enables or disables the networkPolicy |
| networkPolicy.ingress | list | `[]` | add or remove egress policies |
| networkPolicy.policyType | string | `""` | add or remove Policy types. Options: ingress, egress, ingress-egress |
| nodeSelector | object | `{}` | Node selection constraint [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector) |
| openvpnImage | object | See below | OpenVPN specific configuration |
| openvpnImage.pullPolicy | string | `"IfNotPresent"` | Specify the openvpn client image pull policy |
| openvpnImage.repository | string | `"ghcr.io/truecharts/openvpn-client"` | Specify the openvpn client image |
| openvpnImage.tag | string | `"latest@sha256:bc3a56b2c195a4b4ce5c67fb0c209f38036521ebd316df2a7d68b425b9c48b30"` | Specify the openvpn client image tag |
| persistence | object | See below | Configure persistence for the chart here. Additional items can be added by adding a dictionary key similar to the 'config' key. |
| persistence.config | object | See below | Default persistence for configuration files. |
| persistence.config.accessMode | string | `"ReadWriteOnce"` | AccessMode for the persistent volume. Make sure to select an access mode that is supported by your storage provider! [[ref]](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes) |
| persistence.config.annotations | object | `{}` | Add annotations to PVC object |
| persistence.config.enabled | bool | `false` | Enables or disables the persistence item |
| persistence.config.existingClaim | string | `nil` | If you want to reuse an existing claim, the name of the existing PVC can be passed here. |
| persistence.config.forceName | string | `""` | force the complete PVC name Will not add any prefix or suffix |
| persistence.config.labels | object | `{}` | Add labels to PVC object |
| persistence.config.mountPath | string | `nil` | Where to mount the volume in the main container. Defaults to `/<name_of_the_volume>`, setting to '-' creates the volume but disables the volumeMount. |
| persistence.config.nameOverride | string | `nil` | Override the name suffix that is used for this volume. |
| persistence.config.readOnly | bool | `false` | Specify if the volume should be mounted read-only. |
| persistence.config.size | string | `"999Gi"` | The amount of storage that is requested for the persistent volume. |
| persistence.config.storageClass | string | `nil` | Storage Class for the config volume. If set to `-`, dynamic provisioning is disabled. If set to `SCALE-ZFS`, the default provisioner for TrueNAS SCALE is used. If set to something else, the given storageClass is used. If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner. |
| persistence.config.subPath | string | `nil` | Used in conjunction with `existingClaim`. Specifies a sub-path inside the referenced volume instead of its root |
| persistence.config.type | string | `"pvc"` | Sets the persistence type Valid options are: simplePVC, simpleHP, pvc, emptyDir, secret, configMap, hostPath or custom |
| persistence.configmap-example | object | See below | Example of a configmap mount |
| persistence.configmap-example.mountPath | string | `nil` | Where to mount the volume in the main container. Defaults to `/<name_of_the_volume>`, setting to '-' creates the volume but disables the volumeMount. |
| persistence.configmap-example.objectName | string | `"myconfig-map"` | Specify the name of the configmap object to be mounted |
| persistence.configmap-example.readOnly | bool | `false` | Specify if the volume should be mounted read-only. |
| persistence.custom-mount | object | See below | Example of a custom mount |
| persistence.custom-mount.mountPath | string | `nil` | Where to mount the volume in the main container. Defaults to `/<name_of_the_volume>`, setting to '-' creates the volume but disables the volumeMount. |
| persistence.custom-mount.readOnly | bool | `false` | Specify if the volume should be mounted read-only. |
| persistence.custom-mount.volumeSpec | object | `{}` | Define the custom Volume spec here [[ref]](https://kubernetes.io/docs/concepts/storage/volumes/) |
| persistence.host-bin | object | See below | Hostpath mountpoint to allow mounting the /bin folder to disable docker-compose [[ref]]https://kubernetes.io/docs/concepts/storage/volumes/#hostpath) TODO Delete this once iX has blocked docker-compose |
| persistence.host-bin.hostPath | string | `"/bin"` | Which path on the host should be mounted. |
| persistence.host-bin.mountPath | string | `"/host/bin"` | Where to mount the path in the main container. Defaults to the value of `hostPath` |
| persistence.host-dev | object | See below | Example of a hostPath mount [[ref]]https://kubernetes.io/docs/concepts/storage/volumes/#hostpath) |
| persistence.host-dev.hostPath | string | `"/dev"` | Which path on the host should be mounted. |
| persistence.host-dev.hostPathType | string | `""` | Specifying a hostPathType adds a check before trying to mount the path. See Kubernetes documentation for options. |
| persistence.host-dev.mountPath | string | `""` | Where to mount the path in the main container. Defaults to the value of `hostPath` |
| persistence.host-dev.readOnly | bool | `true` | Specify if the path should be mounted read-only. |
| persistence.host-dev.setPermissions | bool | `false` | Automatic set permissions using chown and chmod |
| persistence.host-simple-dev | object | See below | Example of a Simple hostPath mount [[ref]]https://kubernetes.io/docs/concepts/storage/volumes/#hostpath) |
| persistence.host-simple-dev.hostPathSimple | string | `"/dev"` | Which path on the host should be mounted. |
| persistence.host-simple-dev.hostPathType | string | `""` | Specifying a hostPathType adds a check before trying to mount the path. See Kubernetes documentation for options. |
| persistence.host-simple-dev.mountPath | string | `""` | Where to mount the path in the main container. Defaults to the value of `hostPath` |
| persistence.host-simple-dev.readOnly | bool | `true` | Specify if the path should be mounted read-only. |
| persistence.host-simple-dev.setPermissionsSimple | bool | `false` | Automatic set permissions using chown and chmod |
| persistence.host-usr-bin | object | See below | Hostpath mountpoint to allow mounting the /usr/bin folder to disable docker-compose [[ref]]https://kubernetes.io/docs/concepts/storage/volumes/#hostpath) TODO Delete this once iX has blocked docker-compose |
| persistence.host-usr-bin.hostPath | string | `"/usr/bin"` | Which path on the host should be mounted. |
| persistence.host-usr-bin.mountPath | string | `"/host/usr/bin"` | Where to mount the path in the main container. Defaults to the value of `hostPath` |
| persistence.secret-example | object | See below | Example of a secret mount |
| persistence.secret-example.defaultMode | int | `777` | define the default mount mode for the secret |
| persistence.secret-example.items | list | `[{"key":"username","path":"my-group/my-username"}]` | Define the secret items to be mounted |
| persistence.secret-example.mountPath | string | `nil` | Where to mount the volume in the main container. Defaults to `/<name_of_the_volume>`, setting to '-' creates the volume but disables the volumeMount. |
| persistence.secret-example.objectName | string | `"mysecret"` | Specify the name of the secret object to be mounted |
| persistence.secret-example.readOnly | bool | `false` | Specify if the volume should be mounted read-only. |
| persistence.shared | object | See below | Create an emptyDir volume to share between all containers [[ref]]https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) |
| persistence.shared.medium | string | `nil` | Set the medium to "Memory" to mount a tmpfs (RAM-backed filesystem) instead of the storage medium that backs the node. |
| persistence.shared.sizeLimit | string | `nil` | If the `SizeMemoryBackedVolumes` feature gate is enabled, you can specify a size for memory backed volumes. |
| persistence.temp | object | See below | Create an emptyDir volume to share between all containers for temporary storage |
| persistence.temp.medium | string | `"Memory"` | Set the medium to "Memory" to mount a tmpfs (RAM-backed filesystem) instead of the storage medium that backs the node. |
| persistence.temp.sizeLimit | string | `nil` | If the `SizeMemoryBackedVolumes` feature gate is enabled, you can specify a size for memory backed volumes. |
| persistence.varlogs | object | See below | Create an emptyDir volume to share between all containers [[ref]]https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) |
| persistence.varlogs.medium | string | `nil` | Set the medium to "Memory" to mount a tmpfs (RAM-backed filesystem) instead of the storage medium that backs the node. |
| persistence.varlogs.sizeLimit | string | `nil` | If the `SizeMemoryBackedVolumes` feature gate is enabled, you can specify a size for memory backed volumes. |
| persistence.varrun | object | See below | Create an emptyDir volume to share between all containers [[ref]]https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) |
| persistence.varrun.medium | string | `"Memory"` | Set the medium to "Memory" to mount a tmpfs (RAM-backed filesystem) instead of the storage medium that backs the node. |
| persistence.varrun.sizeLimit | string | `nil` | If the `SizeMemoryBackedVolumes` feature gate is enabled, you can specify a size for memory backed volumes. |
| persistenceList | list | [] | Configure persistenceList for the chart here. Additional items can be added by adding a items similar to persistence |
| podAnnotations | object | `{}` | Set annotations on the pod |
| podAnnotationsList | list | `[]` | Set additional annotations on the pod |
| podLabels | object | `{}` | Set labels on the pod |
| podLabelsList | list | `[]` | Set additional labels on the pod |
| podSecurityContext | object | `{"fsGroup":568,"fsGroupChangePolicy":"OnRootMismatch","runAsGroup":568,"runAsUser":568,"supplementalGroups":[]}` | Configure the Security Context for the Pod |
| portal | object | `{"enabled":false}` | Set the primary portal for TrueNAS SCALE |
| portal.enabled | bool | `false` | enable generation of the portal configmap |
| postgresql | object | See below | Postgresql dependency configuration |
| postgresql.url | object | `{}` | can be used to make an easy accessable note which URLS to use to access the DB. |
| postgresqlImage | object | See below | postgresql specific configuration |
| postgresqlImage.pullPolicy | string | `"IfNotPresent"` | Specify the postgresql image pull policy |
| postgresqlImage.repository | string | `"ghcr.io/truecharts/postgresql"` | Specify the postgresql image |
| postgresqlImage.tag | string | `"v14.2.0@sha256:1461d3ab670fcc41923c92f330c932082f6653e031eefd1cc12123adb120f0c3"` | Specify the postgresql image tag |
| priorityClassName | string | `nil` | Custom priority class for different treatment by the scheduler |
| probes | object | See below | [[ref]](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/) |
| probes.liveness | object | See below | Liveness probe configuration |
| probes.liveness.custom | bool | `false` | Set this to `true` if you wish to specify your own livenessProbe |
| probes.liveness.enabled | bool | `true` | Enable the liveness probe |
| probes.liveness.path | string | "/" | If a HTTP probe is used (default for HTTP/HTTPS services) this path is used |
| probes.liveness.spec | object | See below | The spec field contains the values for the default livenessProbe. If you selected `custom: true`, this field holds the definition of the livenessProbe. |
| probes.liveness.type | string | "TCP" | sets the probe type when not using a custom probe |
| probes.readiness | object | See below | Redainess probe configuration |
| probes.readiness.custom | bool | `false` | Set this to `true` if you wish to specify your own readinessProbe |
| probes.readiness.enabled | bool | `true` | Enable the readiness probe |
| probes.readiness.path | string | "/" | If a HTTP probe is used (default for HTTP/HTTPS services) this path is used |
| probes.readiness.spec | object | See below | The spec field contains the values for the default readinessProbe. If you selected `custom: true`, this field holds the definition of the readinessProbe. |
| probes.readiness.type | string | "TCP" | sets the probe type when not using a custom probe |
| probes.startup | object | See below | Startup probe configuration |
| probes.startup.custom | bool | `false` | Set this to `true` if you wish to specify your own startupProbe |
| probes.startup.enabled | bool | `true` | Enable the startup probe |
| probes.startup.path | string | "/" | If a HTTP probe is used (default for HTTP/HTTPS services) this path is used |
| probes.startup.spec | object | See below | The spec field contains the values for the default startupProbe. If you selected `custom: true`, this field holds the definition of the startupProbe. |
| probes.startup.type | string | "TCP" | sets the probe type when not using a custom probe |
| promtailImage | object | See below | promtail specific configuration |
| promtailImage.pullPolicy | string | `"IfNotPresent"` | Specify the promtail image pull policy |
| promtailImage.repository | string | `"ghcr.io/truecharts/promtail"` | Specify the promtail image |
| promtailImage.tag | string | `"v2.4.2@sha256:171e08dcdd1d6c09bff949c37ce4f4756b9ee0132f8d84631986faa223562a30"` | Specify the promtail image tag |
| rbac | object | See below | Create a ClusterRole and ClusterRoleBinding |
| rbac.clusterRoleAnnotations | object | `{}` | Set labels on the ClusterRole |
| rbac.clusterRoleBindingAnnotations | object | `{}` | Set labels on the ClusterRoleBinding |
| rbac.clusterRoleBindingLabels | object | `{}` | Set Annotations on the ClusterRoleBinding |
| rbac.clusterRoleLabels | object | `{}` | Set Annotations on the ClusterRole |
| rbac.enabled | bool | `false` | Enables or disables the ClusterRole and ClusterRoleBinding |
| rbac.rules | object | `{}` | Set Rules on the ClusterRole |
| rbac.subjects | object | `{}` | Add subjects to the ClusterRoleBinding. includes the above created serviceaccount |
| redis | object | See below | Redis dependency configuration |
| redis.url | object | `{}` | can be used to make an easy accessable note which URLS to use to access the DB. |
| resources | object | `{"limits":{"cpu":"4000m","memory":"8Gi"},"requests":{"cpu":"10m","memory":"50Mi"}}` | Set the resource requests / limits for the main container. |
| schedulerName | string | `nil` | Allows specifying a custom scheduler name |
| secret | object | `{}` | Use this to populate a secret with the values you specify. Be aware that these values are not encrypted by default, and could therefore visible to anybody with access to the values.yaml file. |
| security | object | `{"PUID":568,"UMASK":2}` | Set the Process User ID (PUID) env-var seperately |
| securityContext | object | `{"allowPrivilegeEscalation":false,"capabilities":{"add":[],"drop":[]},"privileged":false,"readOnlyRootFilesystem":true,"runAsNonRoot":true}` | Configure the Security Context for the main container |
| service | object | See below | Configure the services for the chart here. Additional services can be added by adding a dictionary key similar to the 'main' service. |
| service.main.annotations | object | `{}` | Provide additional annotations which may be required. |
| service.main.enabled | bool | `true` | Enables or disables the service |
| service.main.ipFamilies | list | `[]` | The ip families that should be used. Options: IPv4, IPv6 |
| service.main.ipFamilyPolicy | string | `"SingleStack"` | Specify the ip policy. Options: SingleStack, PreferDualStack, RequireDualStack |
| service.main.labels | object | `{}` | Provide additional labels which may be required. |
| service.main.nameOverride | string | `nil` | Override the name suffix that is used for this service |
| service.main.ports | object | See below | Configure the Service port information here. Additional ports can be added by adding a dictionary key similar to the 'http' service. |
| service.main.ports.main.enabled | bool | `true` | Enables or disables the port |
| service.main.ports.main.nodePort | string | `nil` | Specify the nodePort value for the LoadBalancer and NodePort service types. [[ref]](https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport) |
| service.main.ports.main.port | string | `nil` | The port number |
| service.main.ports.main.primary | bool | `true` | Make this the primary port (used in probes, notes, etc...) If there is more than 1 service, make sure that only 1 port is marked as primary. |
| service.main.ports.main.protocol | string | `"HTTP"` | Port protocol. Support values are `HTTP`, `HTTPS`, `TCP` and `UDP`. HTTPS and HTTPS spawn a TCP service and get used for internal URL and name generation |
| service.main.ports.main.targetPort | string | `nil` | Specify a service targetPort if you wish to differ the service port from the application port. If `targetPort` is specified, this port number is used in the container definition instead of the `port` value. Therefore named ports are not supported for this field. |
| service.main.portsList | list | See below | Configure additional Service port information here. |
| service.main.primary | bool | `true` | Make this the primary service (used in probes, notes, etc...). If there is more than 1 service, make sure that only 1 service is marked as primary. |
| service.main.selector | object | `{}` | Override default selector |
| service.main.type | string | `"ClusterIP"` | Set the service type Options: Simple(Loadbalancer), LoadBalancer, ClusterIP, NodePort |
| serviceAccount | object | See below | Create serviceaccount |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `false` | Specifies whether a service account should be created |
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
| serviceList | list | See below | Configure additional services for the chart here. |
| stdin | bool | `false` | Determines whether containers in a pod runs with stdin enabled. |
| termination.gracePeriodSeconds | int | `10` | [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle)] |
| termination.messagePath | string | `nil` | [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle-1)] |
| termination.messagePolicy | string | `nil` | [[ref](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle-1)] |
| tolerations | list | `[]` | Specify taint tolerations [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) |
| topologySpreadConstraints | list | `[]` | Defines topologySpreadConstraint rules. [[ref]](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/) |
| tty | bool | `false` | Determines whether containers in a pod runs with TTY enabled. |
| upgradeContainers | object | `{}` | These containers will be run, as an initcontainer, a single time at each edit or update of the chart. |
| volumeClaimTemplates | list | `[]` | Used in conjunction with `controller.type: statefulset` to create individual disks for each instance. |
| wireguardImage | object | See below | WireGuard specific configuration |
| wireguardImage.pullPolicy | string | `"IfNotPresent"` | Specify the WireGuard image pull policy |
| wireguardImage.repository | string | `"ghcr.io/truecharts/wireguard"` | Specify the WireGuard image |
| wireguardImage.tag | string | `"v1.0.20210914@sha256:b7ae4f80183858ed6379b6f8f76f8ef4f1b474b222b8057e091ba0b4e5f62999"` | Specify the WireGuard image tag |
All Rights Reserved - The TrueCharts Project

View File

@@ -1,24 +0,0 @@
---
hide:
- toc
---
# Security Overview
<link href="https://truecharts.org/_static/trivy.css" type="text/css" rel="stylesheet" />
## Helm-Chart
##### Scan Results
| No Misconfigurations found |
|:---------------------------------|
## Containers
##### Detected Containers
##### Scan Results

View File

@@ -1,17 +0,0 @@
{{/*
This template serves as a blueprint for External Interface objects that are created
using the SCALE GUI.
*/}}
{{- define "tc.common.scale.externalInterfaces" -}}
{{- if .Values.global.ixChartContext }}
{{- range $index, $iface := .Values.ixExternalInterfacesConfiguration }}
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: ix-{{ $.Release.Name }}-{{ $index }}
spec:
config: '{{ $iface }}'
{{- end }}
{{- end }}
{{- end -}}

View File

@@ -1,93 +0,0 @@
{{- define "tc.common.scale.portal" -}}
{{- if .Values.ixChartContext }}
{{- if .Values.portal }}
{{- if .Values.portal.enabled }}
{{- $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 }}
{{- $protocol := "https" }}
{{- $path := "/" }}
{{- $ingressport := 443 }}
{{- if $ingr }}
{{- if $ingr.enabled }}
{{- range $ingr.hosts }}
{{- if .hostTpl }}
{{ $host = ( tpl .hostTpl $ ) }}
{{- else if .host }}
{{ $host = .host }}
{{- else }}
{{ $host = "$node_ip" }}
{{- end }}
{{- if .paths }}
{{- $path = (first .paths).path }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- $namespace := "default" }}
{{- if $ingr.ingressClassName }}
{{- $namespace := ( printf "ix-%s" $ingr.ingressClassName ) }}
{{- end }}
{{- $traefikportalhook := lookup "v1" "ConfigMap" $namespace "portalhook" }}
{{- $entrypoint := "websecure" }}
{{- if $ingr.entrypoint }}
{{- $entrypoint = $ingr.entrypoint }}
{{- end }}
{{- if .Values.portal.ingressPort }}
{{- $ingressport = .Values.portal.ingressPort }}
{{- else if $traefikportalhook }}
{{- if ( index $traefikportalhook.data $entrypoint ) }}
{{- $ingressport = ( index $traefikportalhook.data $entrypoint ) }}
{{- end }}
{{- end }}
{{- if eq $host "$node_ip" }}
{{- if eq $primaryService.type "NodePort" }}
{{- $port = $primaryPort.nodePort }}
{{- end }}
{{- if eq $primaryService.type "LoadBalancer" }}
{{- $port = $primaryPort.port }}
{{- end }}
{{- if eq $primaryPort.protocol "HTTP" }}
{{- $protocol = "http" }}
{{- end }}
{{- else }}
{{- $port = $ingressport }}
{{- if $ingr.tls }}
{{- $protocol = "https" }}
{{- end }}
{{- end }}
{{- if and ( .Values.portal.host ) ( eq $host "$node_ip" ) }}
{{- $host = ( tpl .Values.portal.host $ ) }}
{{- end }}
{{- if .Values.portal.path }}
{{- $path = ( tpl .Values.portal.path $ ) }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: portal
labels:
{{ include "tc.common.labels" . | nindent 4 }}
data:
protocol: {{ $protocol }}
host: {{ $host | quote }}
port: {{ $port | quote }}
path: {{ $path | quote }}
url: {{ ( printf "%v://%v:%v%v" $protocol $host $port $path ) | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- end -}}

View File

@@ -1,30 +0,0 @@
{{- define "tc.common.scale.cert.secret" -}}
{{- $secretName := include "tc.common.names.fullname" . -}}
{{- if .ObjectValues.certHolder -}}
{{- if hasKey .ObjectValues.certHolder "nameOverride" -}}
{{- $secretName = ( printf "%v-%v-%v-%v" $secretName .ObjectValues.certHolder.nameOverride "ixcert" .ObjectValues.certHolder.scaleCert ) -}}
{{- else }}
{{- $secretName = ( printf "%v-%v-%v" $secretName "ixcert" .ObjectValues.certHolder.scaleCert ) -}}
{{ end -}}
{{ else }}
{{- $_ := set $ "ObjectValues" (dict "certHolder" .Values) -}}
{{- $secretName = ( printf "%v-%v-%v-%v" $secretName "scalecert" "ixcert" .Values.scaleCert ) -}}
{{ end -}}
{{- if eq (include "tc.common.scale.cert.available" $ ) "true" -}}
{{- printf "\n%s\n" "---" }}
apiVersion: v1
kind: Secret
metadata:
name: {{ $secretName }}-{{ .Release.Revision }}
labels: {{ include "tc.common.labels" . | nindent 4 }}
type: kubernetes.io/tls
data:
tls.crt: {{ (include "tc.common.scale.cert.publicKey" $ ) | toString | b64enc | quote }}
tls.key: {{ (include "tc.common.scale.cert.privateKey" $ ) | toString | b64enc | quote }}
{{- end -}}
{{- end -}}

View File

@@ -1,57 +0,0 @@
{{/*
Retrieve true/false if certificate is configured
*/}}
{{- define "tc.common.scale.cert.available" -}}
{{- if .ObjectValues.certHolder.scaleCert -}}
{{- $values := (. | mustDeepCopy) -}}
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.ObjectValues.certHolder.scaleCert) -}}
{{- template "tc.common.scale.cert_present" $values -}}
{{- else -}}
{{- false -}}
{{- end -}}
{{- end -}}
{{/*
Retrieve public key of certificate
*/}}
{{- define "tc.common.scale.cert.publicKey" -}}
{{- $values := (. | mustDeepCopy) -}}
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.ObjectValues.certHolder.scaleCert "publicKey" true) -}}
{{ include "tc.common.scale.cert" $values }}
{{- end -}}
{{/*
Retrieve private key of certificate
*/}}
{{- define "tc.common.scale.cert.privateKey" -}}
{{- $values := (. | mustDeepCopy) -}}
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.ObjectValues.certHolder.scaleCert) -}}
{{ include "tc.common.scale.cert" $values }}
{{- end -}}
{{/*
Retrieve true/false if certificate is available in ixCertificates
*/}}
{{- define "tc.common.scale.cert_present" -}}
{{- $values := . -}}
{{- hasKey $values.Values.ixCertificates ($values.commonCertOptions.certKeyName | toString) -}}
{{- end -}}
{{/*
Retrieve certificate from variable name
*/}}
{{- define "tc.common.scale.cert" -}}
{{- $values := . -}}
{{- $certKey := ($values.commonCertOptions.certKeyName | toString) -}}
{{- if hasKey $values.Values.ixCertificates $certKey -}}
{{- $cert := get $values.Values.ixCertificates $certKey -}}
{{- if $values.commonCertOptions.publicKey -}}
{{ $cert.certificate }}
{{- else -}}
{{ $cert.privatekey }}
{{- end -}}
{{- end -}}
{{- end -}}

View File

@@ -1,50 +0,0 @@
{{/*
Template to render code-server addon
It will include / inject the required templates based on the given values.
*/}}
{{- define "tc.common.addon.codeserver" -}}
{{- if .Values.addons.codeserver.enabled -}}
{{/* Append the code-server container to the additionalContainers */}}
{{- $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 "tc.common.addon.codeserver.deployKeySecret" . -}}
{{- if $secret -}}
{{- $secret | nindent 0 -}}
{{- end -}}
{{/* Append the secret volume to the volumes */}}
{{- $volume := include "tc.common.addon.codeserver.deployKeyVolumeSpec" . | fromYaml -}}
{{- if $volume -}}
{{- $_ := set .Values.persistence "deploykey" (dict "enabled" "true" "mountPath" "-" "type" "custom" "volumeSpec" $volume) -}}
{{- end -}}
{{/* Add the code-server service */}}
{{- if .Values.addons.codeserver.service.enabled -}}
{{- $serviceValues := .Values.addons.codeserver.service -}}
{{- $_ := set $serviceValues "nameOverride" "codeserver" -}}
{{- $_ := set $ "ObjectValues" (dict "service" $serviceValues) -}}
{{- include "tc.common.class.service" $ -}}
{{- $_ := unset $ "ObjectValues" -}}
{{- end -}}
{{/* Add the code-server ingress */}}
{{- if .Values.addons.codeserver.ingress.enabled -}}
{{- $ingressValues := .Values.addons.codeserver.ingress -}}
{{- $_ := set $ingressValues "nameOverride" "codeserver" -}}
{{/* Determine the target service name & port */}}
{{- $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 "tc.common.class.ingress" $ -}}
{{- $_ := unset $ "ObjectValues" -}}
{{- end -}}
{{- end -}}
{{- end -}}

View File

@@ -1,50 +0,0 @@
{{/*
The code-server sidecar container to be inserted.
*/}}
{{- define "tc.common.addon.codeserver.container" -}}
name: codeserver
image: "{{ .Values.codeserverImage.repository }}:{{ .Values.codeserverImage.tag }}"
imagePullPolicy: {{ .Values.codeserverImage.pullPolicy }}
securityContext:
runAsUser: 0
runAsGroup: 0
env:
{{- range $envList := .Values.addons.codeserver.envList }}
{{- if and $envList.name $envList.value }}
- name: {{ $envList.name }}
value: {{ $envList.value | quote }}
{{- else }}
{{- fail "Please specify name/value for codeserver environment variable" }}
{{- end }}
{{- end}}
{{- with .Values.addons.codeserver.env }}
{{- range $k, $v := . }}
- name: {{ $k }}
value: {{ $v | quote }}
{{- end }}
{{- end }}
ports:
- name: codeserver
containerPort: {{ .Values.addons.codeserver.service.ports.codeserver.port }}
protocol: TCP
args:
{{- range .Values.addons.codeserver.args }}
- {{ . | quote }}
{{- end }}
- "--port"
- "{{ .Values.addons.codeserver.service.ports.codeserver.port }}"
- {{ .Values.addons.codeserver.workingDir | default "/" }}
{{- with (include "tc.common.controller.volumeMounts" . | trim) }}
volumeMounts:
{{ nindent 2 . }}
{{- end }}
{{- if or .Values.addons.codeserver.git.deployKey .Values.addons.codeserver.git.deployKeyBase64 .Values.addons.codeserver.git.deployKeySecret }}
- name: deploykey
mountPath: /root/.ssh/id_rsa
subPath: id_rsa
{{- end }}
{{- with .Values.addons.codeserver.resources }}
resources:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end -}}

View File

@@ -1,22 +0,0 @@
{{/*
The OpenVPN credentials secrets to be included.
*/}}
{{- 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 "tc.common.names.fullname" . }}-deploykey
labels:
{{- include "tc.common.labels" . | nindent 4 }}
type: Opaque
{{- if .Values.addons.codeserver.git.deployKey }}
stringData:
id_rsa: {{ .Values.addons.codeserver.git.deployKey | quote }}
{{- else }}
data:
id_rsa: {{ .Values.addons.codeserver.git.deployKeyBase64 | quote }}
{{- end }}
{{- end }}
{{- end -}}

View File

@@ -1,17 +0,0 @@
{{/*
The volume (referencing git deploykey) to be inserted into additionalVolumes.
*/}}
{{- 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 "tc.common.names.fullname" . }}-deploykey
{{- end }}
defaultMode: 256
items:
- key: id_rsa
path: id_rsa
{{- end -}}
{{- end -}}

View File

@@ -1,24 +0,0 @@
{{/*
Template to render VPN addon
It will include / inject the required templates based on the given values.
*/}}
{{- define "tc.common.addon.vpn" -}}
{{- if ne "disabled" .Values.addons.vpn.type -}}
{{- if eq "openvpn" .Values.addons.vpn.type -}}
{{- include "tc.common.addon.openvpn" . }}
{{- end -}}
{{- if eq "wireguard" .Values.addons.vpn.type -}}
{{- include "tc.common.addon.wireguard" . }}
{{- end -}}
{{- if eq "tailscale" .Values.addons.vpn.type -}}
{{- include "tc.common.addon.tailscale" . }}
{{- end -}}
{{- if ne "tailscale" .Values.addons.vpn.type -}}
{{- $_ := set .Values.persistence "vpnconfig" .Values.addons.vpn.configFile -}}
{{- end -}}
{{- end -}}
{{- end -}}

View File

@@ -1,17 +0,0 @@
{{/*
Template to render OpenVPN addon. It will add the container to the list of additionalContainers
and add a credentials secret if speciffied.
*/}}
{{- define "tc.common.addon.openvpn" -}}
{{/* Append the openVPN container to the additionalContainers */}}
{{- $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 "tc.common.addon.openvpn.secret" . -}}
{{- if $secret -}}
{{- $secret | nindent 0 -}}
{{- end -}}
{{- end -}}

View File

@@ -1,72 +0,0 @@
{{/*
The OpenVPN sidecar container to be inserted.
*/}}
{{- define "tc.common.addon.openvpn.container" -}}
name: openvpn
image: "{{ .Values.openvpnImage.repository }}:{{ .Values.openvpnImage.tag }}"
imagePullPolicy: {{ .Values.openvpnImage.pullPolicy }}
securityContext:
runAsUser: 0
runAsGroup: 0
capabilities:
add:
- NET_ADMIN
- SYS_MODULE
env:
{{- range $envList := .Values.addons.vpn.envList }}
{{- if and $envList.name $envList.value }}
- name: {{ $envList.name }}
value: {{ $envList.value | quote }}
{{- else }}
{{- fail "Please specify name/value for VPN environment variable" }}
{{- end }}
{{- end}}
{{- with .Values.addons.vpn.env }}
{{- range $k, $v := . }}
- name: {{ $k }}
value: {{ $v | quote }}
{{- end }}
{{- end }}
{{- if .Values.addons.vpn.killSwitch }}
- name: FIREWALL
value: "ON"
- name: ROUTE_1
value: "172.16.0.0/12"
{{- range $index, $value := .Values.addons.vpn.excludedNetworks_IPv4 }}
- name: ROUTE_{{ add $index 2 }}
value: {{ $value | quote }}
{{- end}}
{{- if .Values.addons.vpn.excludedNetworks_IPv6 }}
{{- $excludednetworksv6 := ""}}
{{- range .Values.addons.vpn.excludedNetworks_IPv4 }}
{{- $excludednetworksv6 = ( printf "%v;%v" $excludednetworksv6 . ) }}
{{- end}}
{{- range $index, $value := .Values.addons.vpn.excludedNetworks_IPv6 }}
- name: ROUTE6_{{ add $index 1 }}
value: {{ $value | quote }}
{{- end}}
{{- end }}
{{- end }}
{{- if or ( .Values.addons.vpn.openvpn.username ) ( .Values.addons.vpn.openvpn.password ) }}
envFrom:
- secretRef:
name: {{ include "tc.common.names.fullname" . }}-openvpn
{{- end }}
volumeMounts:
- mountPath: {{ .Values.persistence.shared.mountPath }}
name: shared
{{- if .Values.addons.vpn.configFile }}
- name: vpnconfig
mountPath: /vpn/vpn.conf
{{- end }}
{{- with .Values.addons.vpn.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 2 }}
{{- end -}}
{{- with .Values.addons.vpn.resources }}
resources:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end -}}

View File

@@ -1,14 +0,0 @@
{{/*
The OpenVPN credentials secrets to be included.
*/}}
{{- define "tc.common.addon.openvpn.secret" -}}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ include "tc.common.names.fullname" $ }}-openvpn
labels:
{{- include "tc.common.labels" $ | nindent 4 }}
data:
VPN_AUTH: {{ ( printf "%v;%v" .Values.addons.vpn.openvpn.username .Values.addons.vpn.openvpn.password ) | b64enc }}
{{- end -}}

View File

@@ -1,13 +0,0 @@
{{/*
Template to render Tailscale addon. It will add the container to the list of additionalContainers.
*/}}
{{- define "tc.common.addon.tailscale" -}}
{{/* Append the Tailscale container to the additionalContainers */}}
{{- $container := fromYaml (include "tc.common.addon.tailscale.container" .) -}}
{{- if $container -}}
{{- $_ := set .Values.additionalContainers "addon-tailscale" $container -}}
{{- include "tailscale.secret" . -}}
{{- $_ := set .Values.persistence (printf "%v-%v" .Release.Name "tailscale" ) (include "tailscale.addon.persistence" . | fromYaml) -}}
{{- end -}}
{{- end -}}

View File

@@ -1,98 +0,0 @@
{{/*
The Tailscale sidecar container to be inserted.
*/}}
{{- define "tc.common.addon.tailscale.container" -}}
{{- $secretName := printf "%s-tailscale-secret" (include "tc.common.names.fullname" .) }}
name: tailscale
image: "{{ .Values.tailscaleImage.repository }}:{{ .Values.tailscaleImage.tag }}"
imagePullPolicy: {{ .Values.tailscaleImage.pullPolicy }}
command:
- /usr/local/bin/containerboot
securityContext:
{{- if .Values.addons.vpn.tailscale.userspace }}
runAsUser: 1000
runAsGroup: 1000
runAsNonRoot: true
readOnlyRootFilesystem: true
{{- else }}
runAsUser: 0
runAsGroup: 0
runAsNonRoot: false
readOnlyRootFilesystem: false
{{- end }}
capabilities:
add:
- NET_ADMIN
envFrom:
- secretRef:
name: {{ $secretName }}
env:
- name: TS_SOCKET
value: /var/run/tailscale/tailscaled.sock
- name: TS_STATE_DIR
value: /var/lib/tailscale
- name: TS_AUTH_ONCE
value: {{ .Values.addons.vpn.tailscale.auth_once | quote }}
- name: TS_USERSPACE
value: {{ .Values.addons.vpn.tailscale.userspace | quote }}
- name: TS_ACCEPT_DNS
value: {{ .Values.addons.vpn.tailscale.accept_dns | quote }}
{{- with .Values.addons.vpn.tailscale.outbound_http_proxy_listen }}
- name: TS_OUTBOUND_HTTP_PROXY_LISTEN
value: {{ . }}
{{- end }}
{{- with .Values.addons.vpn.tailscale.routes }}
- name: TS_ROUTES
value: {{ . }}
{{- end }}
{{- with .Values.addons.vpn.tailscale.dest_ip }}
- name: TS_DEST_IP
value: {{ . }}
{{- end }}
{{- with .Values.addons.vpn.tailscale.sock5_server }}
- name: TS_SOCKS5_SERVER
value: {{ . }}
{{- end }}
{{- with .Values.addons.vpn.tailscale.extra_args }}
- name: TS_EXTRA_ARGS
value: {{ . | quote }}
{{- end }}
{{- with .Values.addons.vpn.tailscale.daemon_extra_args }}
- name: TS_TAILSCALED_EXTRA_ARGS
value: {{ . | quote }}
{{- end }}
{{- range $envList := .Values.addons.vpn.envList }}
{{- if and $envList.name $envList.value }}
- name: {{ $envList.name }}
value: {{ $envList.value | quote }}
{{- else }}
{{- fail "Please specify name/value for VPN environment variable" }}
{{- end }}
{{- end}}
{{- with .Values.addons.vpn.env }}
{{- range $k, $v := . }}
- name: {{ $k }}
value: {{ $v | quote }}
{{- end }}
{{- end }}
volumeMounts:
- mountPath: {{ .Values.persistence.shared.mountPath }}
name: shared
- mountPath: /var/lib/tailscale
name: {{ printf "%v-%v" .Release.Name "tailscale" }}
{{- with .Values.addons.vpn.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 2 }}
{{- end -}}
{{- with .Values.addons.vpn.resources }}
resources:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end -}}

View File

@@ -1,6 +0,0 @@
{{- define "tailscale.addon.persistence" -}}
enabled: true
mountPath: /var/lib/tailscale
size: 1Gi
noMount: true
{{- end -}}

View File

@@ -1,19 +0,0 @@
{{/* Define the secret */}}
{{- define "tailscale.secret" -}}
{{- $secretName := printf "%s-tailscale-secret" (include "tc.common.names.fullname" .) }}
---
{{/* This secrets are loaded on tailscale */}}
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: {{ $secretName }}
labels:
{{- include "tc.common.labels" . | nindent 4 }}
data:
{{- with .Values.addons.vpn.tailscale.authkey }}
TS_AUTH_KEY: {{ . | b64enc }}
{{- end }}
{{- end }}

View File

@@ -1,11 +0,0 @@
{{/*
Template to render Wireguard addon. It will add the container to the list of additionalContainers.
*/}}
*/}}
{{- define "tc.common.addon.wireguard" -}}
{{/* Append the Wireguard container to the additionalContainers */}}
{{- $container := fromYaml (include "tc.common.addon.wireguard.container" .) -}}
{{- if $container -}}
{{- $_ := set .Values.additionalContainers "addon-wireguard" $container -}}
{{- end -}}
{{- end -}}

View File

@@ -1,70 +0,0 @@
{{/*
The Wireguard sidecar container to be inserted.
*/}}
{{- define "tc.common.addon.wireguard.container" -}}
name: wireguard
image: "{{ .Values.wireguardImage.repository }}:{{ .Values.wireguardImage.tag }}"
imagePullPolicy: {{ .Values.wireguardImage.pullPolicy }}
securityContext:
runAsUser: 568
runAsGroup: 568
capabilities:
add:
- NET_ADMIN
- SYS_MODULE
env:
- name: SEPARATOR
value: ";"
- name: IPTABLES_BACKEND
value: "nft"
{{- range $envList := .Values.addons.vpn.envList }}
{{- if and $envList.name $envList.value }}
- name: {{ $envList.name }}
value: {{ $envList.value | quote }}
{{- else }}
{{- fail "Please specify name/value for VPN environment variable" }}
{{- end }}
{{- end}}
{{- with .Values.addons.vpn.env }}
{{- range $k, $v := . }}
- name: {{ $k }}
value: {{ $v | quote }}
{{- end }}
{{- end }}
{{- if .Values.addons.vpn.killSwitch }}
- name: KILLSWITCH
value: "true"
{{- $excludednetworksv4 := "172.16.0.0/12"}}
{{- range .Values.addons.vpn.excludedNetworks_IPv4 }}
{{- $excludednetworksv4 = ( printf "%v;%v" $excludednetworksv4 . ) }}
{{- end}}
- name: KILLSWITCH_EXCLUDEDNETWORKS_IPV4
value: {{ $excludednetworksv4 | quote }}
{{- if .Values.addons.vpn.excludedNetworks_IPv6 }}
{{- $excludednetworksv6 := ""}}
{{- range .Values.addons.vpn.excludedNetworks_IPv4 }}
{{- $excludednetworksv6 = ( printf "%v;%v" $excludednetworksv6 . ) }}
{{- end}}
- name: KILLSWITCH_EXCLUDEDNETWORKS_IPV6
value: {{ .Values.addons.vpn.excludedNetworks_IPv6 | quote }}
{{- end }}
{{- end }}
volumeMounts:
- mountPath: {{ .Values.persistence.shared.mountPath }}
name: shared
{{- if .Values.addons.vpn.configFile }}
- name: vpnconfig
mountPath: /etc/wireguard/wg0.conf
{{- end }}
{{- with .Values.addons.vpn.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 2 }}
{{- end -}}
{{- with .Values.addons.vpn.resources }}
resources:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end -}}

View File

@@ -1,47 +0,0 @@
{{/*
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 -}}

View File

@@ -1,35 +0,0 @@
{{/*
This template serves as a blueprint for all configMap objects that are created
within the common library.
*/}}
{{- define "tc.common.class.configmap" -}}
{{- $fullName := include "tc.common.names.fullname" . -}}
{{- $configMapName := $fullName -}}
{{- $values := .Values.configmap -}}
{{- if hasKey . "ObjectValues" -}}
{{- with .ObjectValues.configmap -}}
{{- $values = . -}}
{{- end -}}
{{ end -}}
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
{{- $configMapName = printf "%v-%v" $configMapName $values.nameOverride -}}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ $configMapName }}
{{- 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:
{{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
data:
{{- with $values.data }}
{{- tpl (toYaml .) $ | nindent 2 }}
{{- end }}
{{- end }}

View File

@@ -1,128 +0,0 @@
{{/*
This template serves as a blueprint for all Ingress objects that are created
within the common library.
*/}}
{{- define "tc.common.class.ingress" -}}
{{- $fullName := include "tc.common.names.fullname" . -}}
{{- $ingressName := $fullName -}}
{{- $values := .Values.ingress -}}
{{- if hasKey . "ObjectValues" -}}
{{- with .ObjectValues.ingress -}}
{{- $values = . -}}
{{- end -}}
{{ end -}}
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
{{- $ingressName = printf "%v-%v" $ingressName $values.nameOverride -}}
{{- end -}}
{{- $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 "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 -}}
{{- $defaultServiceName = $ingressName -}}
{{- $defaultServicePort = get $autoLinkService.ports $values.nameOverride -}}
{{- end -}}
{{- $isStable := include "tc.common.capabilities.ingress.isStable" . }}
{{- $mddwrNamespace := "default" }}
{{- if $values.ingressClassName }}
{{- $mddwrNamespace = ( printf "ix-%s" $values.ingressClassName ) }}
{{- end }}
{{- $fixedMiddlewares := "" }}
{{- if $values.enableFixedMiddlewares }}
{{ range $index, $fixedMiddleware := $values.fixedMiddlewares }}
{{- if $index }}
{{ $fixedMiddlewares = ( printf "%v, %v-%v@%v" $fixedMiddlewares $mddwrNamespace $fixedMiddleware "kubernetescrd" ) }}
{{- else }}
{{ $fixedMiddlewares = ( printf "%v-%v@%v" $mddwrNamespace $fixedMiddleware "kubernetescrd" ) }}
{{- end }}
{{ end }}
{{- end }}
{{- $middlewares := "" }}
{{ range $index, $middleware := $values.middlewares }}
{{- if $index }}
{{ $middlewares = ( printf "%v, %v-%v@%v" $middlewares $mddwrNamespace $middleware "kubernetescrd" ) }}
{{- else }}
{{ $middlewares = ( printf "%v-%v@%v" $mddwrNamespace $middleware "kubernetescrd" ) }}
{{- end }}
{{ end }}
{{- if and ( $fixedMiddlewares ) ( $middlewares ) }}
{{ $middlewares = ( printf "%v, %v" $fixedMiddlewares $middlewares ) }}
{{- else if $fixedMiddlewares }}
{{ $middlewares = ( printf "%s" $fixedMiddlewares ) }}
{{ end }}
---
apiVersion: {{ include "tc.common.capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ $ingressName }}
{{- 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 (merge ($values.annotations | default dict) (include "tc.common.annotations" $ | fromYaml)) }}
{{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
spec:
{{- if and $isStable $values.ingressClassName }}
ingressClassName: {{ $values.ingressClassName }}
{{- end }}
{{- if $values.tls }}
tls:
{{- range $index, $tlsValues := $values.tls }}
- hosts:
{{- range $tlsValues.hosts }}
- {{ tpl . $ | quote }}
{{- end }}
{{- if $tlsValues.scaleCert }}
secretName: {{ ( printf "%v-%v-%v-%v-%v-%v" $ingressName "tls" $index "ixcert" $tlsValues.scaleCert $.Release.Revision ) }}
{{- else if .secretName }}
secretName: {{ tpl .secretName $ | quote}}
{{- end }}
{{- end }}
{{- end }}
rules:
{{- range $values.hosts }}
- host: {{ tpl .host $ | quote }}
http:
paths:
{{- range .paths }}
{{- $service := $defaultServiceName -}}
{{- $port := $defaultServicePort.port -}}
{{- if .service -}}
{{- $service = default $service .service.name -}}
{{- $port = default $port .service.port -}}
{{- end }}
- path: {{ tpl .path $ | quote }}
{{- if $isStable }}
pathType: {{ default "Prefix" .pathType }}
{{- end }}
backend:
{{- if $isStable }}
service:
name: {{ $service }}
port:
number: {{ $port }}
{{- else }}
serviceName: {{ $service }}
servicePort: {{ $port }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -1,176 +0,0 @@
{{/*
Blueprint for the NetworkPolicy object that can be included in the addon.
*/}}
{{- 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:
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.podSelector }}
{{- with $values.podSelector }}
{{- . | toYaml | nindent 4 }}
{{- end -}}
{{- else }}
matchLabels:
{{- include "tc.common.labels.selectorLabels" . | nindent 6 }}
{{- end }}
{{- if $values.policyType }}
{{- if eq $values.policyType "ingress" }}
policyTypes: ["Ingress"]
{{- else if eq $values.policyType "egress" }}
policyTypes: ["Egress"]
{{- else if eq $values.policyType "ingress-egress" }}
policyTypes: ["Ingress", "Egress"]
{{- end -}}
{{- end -}}
{{- if $values.egress }}
egress:
{{- range $values.egress }}
- to:
{{- range .to }}
{{- $nss := false }}
{{- $ipb := false }}
{{- if .ipBlock }}
{{- if .ipBlock.cidr }}
{{- $ipb = true }}
- ipBlock:
cidr: {{ .ipBlock.cidr }}
{{- if .ipBlock.except }}
except:
{{- range .ipBlock.except }}
- {{ . }}
{{- end }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if and ( .namespaceSelector ) ( not $ipb ) }}
{{- if or ( .namespaceSelector.matchLabels ) ( .namespaceSelector.matchExpressions ) -}}
{{- $nss = true }}
- namespaceSelector:
{{- if .namespaceSelector.matchLabels }}
matchLabels:
{{- .namespaceSelector.matchLabels | toYaml | nindent 12 }}
{{- end -}}
{{- if .namespaceSelector.matchExpressions }}
matchExpressions:
{{- .namespaceSelector.matchExpressions | toYaml | nindent 12 }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if and ( .podSelector ) ( not $ipb ) }}
{{- if or ( .podSelector.matchLabels ) ( .podSelector.matchExpressions ) }}
{{- if $nss }}
podSelector:
{{- else }}
- podSelector:
{{- end }}
{{- if .podSelector.matchLabels }}
matchLabels:
{{- .podSelector.matchLabels | toYaml | nindent 12 }}
{{- end -}}
{{- if .podSelector.matchExpressions }}
matchExpressions:
{{- .podSelector.matchExpressions | toYaml | nindent 12 }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- with .ports }}
ports:
{{- . | toYaml | nindent 6 }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if $values.ingress }}
ingress:
{{- range $values.ingress }}
- from:
{{- range .from }}
{{- $nss := false }}
{{- $ipb := false }}
{{- if .ipBlock }}
{{- if .ipBlock.cidr }}
{{- $ipb = true }}
- ipBlock:
cidr: {{ .ipBlock.cidr }}
{{- if .ipBlock.except }}
except:
{{- range .ipBlock.except }}
- {{ . }}
{{- end }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if and ( .namespaceSelector ) ( not $ipb ) }}
{{- if or ( .namespaceSelector.matchLabels ) ( .namespaceSelector.matchExpressions ) -}}
{{- $nss = true }}
- namespaceSelector:
{{- if .namespaceSelector.matchLabels }}
matchLabels:
{{- .namespaceSelector.matchLabels | toYaml | nindent 12 }}
{{- end -}}
{{- if .namespaceSelector.matchExpressions }}
matchExpressions:
{{- .namespaceSelector.matchExpressions | toYaml | nindent 12 }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if and ( .podSelector ) ( not $ipb ) }}
{{- if or ( .podSelector.matchLabels ) ( .podSelector.matchExpressions ) }}
{{- if $nss }}
podSelector:
{{- else }}
- podSelector:
{{- end }}
{{- if .podSelector.matchLabels }}
matchLabels:
{{- .podSelector.matchLabels | toYaml | nindent 12 }}
{{- end -}}
{{- if .podSelector.matchExpressions }}
matchExpressions:
{{- .podSelector.matchExpressions | toYaml | nindent 12 }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- with .ports }}
ports:
{{- . | toYaml | nindent 6 }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}

View File

@@ -1,54 +0,0 @@
{{/*
This template serves as a blueprint for all PersistentVolumeClaim objects that are created
within the common library.
*/}}
{{- define "tc.common.class.pvc" -}}
{{- $values := .Values.persistence -}}
{{- if hasKey . "ObjectValues" -}}
{{- with .ObjectValues.persistence -}}
{{- $values = . -}}
{{- end -}}
{{ end -}}
{{- $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 -}}
{{ end -}}
{{ end }}
{{- if $values.forceName -}}
{{- $pvcName = $values.forceName -}}
{{ end }}
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ $pvcName }}
{{- if or $values.retain $values.annotations }}
annotations:
{{- if $values.retain }}
"helm.sh/resource-policy": keep
{{- end }}
{{- with (merge ($values.annotations | default dict) (include "tc.common.annotations" $ | fromYaml)) }}
{{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
{{- end }}
labels:
{{- include "tc.common.labels" . | nindent 4 }}
{{- with $values.labels }}
{{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
spec:
accessModes:
- {{ ( $values.accessMode | default "ReadWriteOnce" ) | quote }}
resources:
requests:
storage: {{ $values.size | default "999Gi" | quote }}
{{- with $values.spec }}
{{ tpl ( toYaml . ) $ | indent 2 }}
{{- end }}
{{ include "tc.common.storage.storageClassName" ( dict "persistence" $values "global" $ ) }}
{{- if $values.volumeName }}
volumeName: {{ $values.volumeName | quote }}
{{- end }}
{{- end -}}

View File

@@ -1,71 +0,0 @@
{{/*
This template serves as a blueprint for rbac objects that are created
using the common library.
*/}}
{{- define "tc.common.class.rbac" -}}
{{- $fullName := include "tc.common.names.fullname" . -}}
{{- $saName := $fullName -}}
{{- $rbacName := $fullName -}}
{{- $values := .Values.rbac -}}
{{- $saValues := .Values.serviceAccount -}}
{{- if hasKey . "ObjectValues" -}}
{{- with .ObjectValues.rbac -}}
{{- $values = . -}}
{{- end -}}
{{ end -}}
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
{{- $saName = printf "%v-%v" $saName $values.nameOverride -}}
{{- if not (hasKey $saValues $values.nameOverride) -}}
{{- $saName = "default" -}}
{{- 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: {{ $saName }}
namespace: {{ .Release.Namespace }}
{{- with $values.subjects }}
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end -}}

View File

@@ -1,35 +0,0 @@
{{/*
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 }}

View File

@@ -1,134 +0,0 @@
{{/*
This template serves as a blueprint for all Service objects that are created
within the common library.
*/}}
{{- define "tc.common.class.service" -}}
{{- $values := .Values.service -}}
{{- if hasKey . "ObjectValues" -}}
{{- with .ObjectValues.service -}}
{{- $values = . -}}
{{- end -}}
{{ end -}}
{{- $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 "tc.common.lib.util.service.ports.primary" (dict "values" $values)) }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ $serviceName }}
{{- 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 "tc.common.names.fullname" . }}
{{- end }}
{{- with (merge ($values.annotations | default dict) (include "tc.common.annotations" $ | fromYaml)) }}
{{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
spec:
{{- if (or (eq $svcType "ClusterIP") (empty $svcType)) }}
type: ClusterIP
{{- if $values.clusterIP }}
clusterIP: {{ $values.clusterIP }}
{{end}}
{{- else if eq $svcType "ExternalName" }}
type: {{ $svcType }}
externalName: {{ $values.externalName }}
{{- else if eq $svcType "ExternalIP" }}
{{- else if eq $svcType "LoadBalancer" }}
type: {{ $svcType }}
{{- if $values.loadBalancerIP }}
loadBalancerIP: {{ $values.loadBalancerIP }}
{{- end }}
{{- if $values.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml $values.loadBalancerSourceRanges | nindent 4 }}
{{- end -}}
{{- else }}
type: {{ $svcType }}
{{- end }}
{{- if $values.externalTrafficPolicy }}
externalTrafficPolicy: {{ $values.externalTrafficPolicy }}
{{- end }}
{{- if $values.sessionAffinity }}
sessionAffinity: {{ $values.sessionAffinity }}
{{- if $values.sessionAffinityConfig }}
sessionAffinityConfig:
{{ toYaml $values.sessionAffinityConfig | nindent 4 }}
{{- end -}}
{{- end }}
{{- with $values.externalIPs }}
externalIPs:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if $values.publishNotReadyAddresses }}
publishNotReadyAddresses: {{ $values.publishNotReadyAddresses }}
{{- end }}
{{- if (and ($values.ipFamilyPolicy) (ne $svcType "ExternalName")) }}
ipFamilyPolicy: {{ $values.ipFamilyPolicy }}
{{- end }}
{{ if ne $svcType "ExternalName" }}
{{- with $values.ipFamilies }}
ipFamilies:
{{ toYaml . | nindent 4 }}
{{- end }}
{{- end }}
ports:
{{- range $name, $port := $values.ports }}
{{- if $port.enabled }}
- port: {{ $port.port }}
targetPort: {{ $port.targetPort | default $name }}
{{- if $port.protocol }}
{{- if or ( eq $port.protocol "HTTP" ) ( eq $port.protocol "HTTPS" ) ( eq $port.protocol "TCP" ) }}
protocol: TCP
{{- else }}
protocol: {{ $port.protocol }}
{{- end }}
{{- else }}
protocol: TCP
{{- end }}
name: {{ $name }}
{{- if (and (eq $svcType "NodePort") (not (empty $port.nodePort))) }}
nodePort: {{ $port.nodePort }}
{{ end }}
{{- end }}
{{- end }}
{{- if and ( ne $svcType "ExternalName" ) ( ne $svcType "ExternalIP" )}}
selector:
{{- if $values.selector }}
{{- with $values.selector }}
{{- tpl (toYaml .) $ | nindent 4 }}
{{- end }}
{{- else }}
{{- include "tc.common.labels.selectorLabels" . | nindent 4 }}
{{- end }}
{{- end }}
{{- if eq $svcType "ExternalIP" }}
---
apiVersion: v1
kind: Endpoints
metadata:
name: {{ $serviceName }}
labels:
{{- include "tc.common.labels" $ | nindent 4 }}
subsets:
- addresses:
- ip: {{ $values.externalIP }}
ports:
{{- range $name, $port := $values.ports }}
{{- if $port.enabled }}
- port: {{ $port.port | default 80 }}
name: {{ $name }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -1,31 +0,0 @@
{{/*
This template serves as a blueprint for ServiceAccount objects that are created
using the common library.
*/}}
{{- define "tc.common.class.serviceAccount" -}}
{{- $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.annotations }}
annotations:
{{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
{{- end }}

View File

@@ -1,22 +0,0 @@
{{/* Common annotations shared across objects */}}
{{- 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 -}}
{{/* Annotations on all workload objects */}}
{{- define "tc.common.annotations.workload" -}}
rollme: {{ randAlphaNum 5 | quote }}
{{- end -}}

View File

@@ -1,19 +0,0 @@
{{/* Allow KubeVersion to be overridden. */}}
{{- define "tc.common.capabilities.ingress.kubeVersion" -}}
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride -}}
{{- end -}}
{{/* Return the appropriate apiVersion for Ingress objects */}}
{{- define "tc.common.capabilities.ingress.apiVersion" -}}
{{- print "networking.k8s.io/v1" -}}
{{- if semverCompare "<1.19" (include "tc.common.capabilities.ingress.kubeVersion" .) -}}
{{- print "beta1" -}}
{{- end -}}
{{- end -}}
{{/* Check Ingress stability */}}
{{- define "tc.common.capabilities.ingress.isStable" -}}
{{- if eq (include "tc.common.capabilities.ingress.apiVersion" .) "networking.k8s.io/v1" -}}
{{- true -}}
{{- end -}}
{{- end -}}

View File

@@ -1,23 +0,0 @@
{{/* Common labels shared across objects */}}
{{- 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 }}
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 "tc.common.labels.selectorLabels" -}}
app.kubernetes.io/name: {{ include "tc.common.names.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

View File

@@ -1,56 +0,0 @@
{{/* Expand the name of the chart */}}
{{- define "tc.common.names.name" -}}
{{- $globalNameOverride := "" -}}
{{- if hasKey .Values "global" -}}
{{- $globalNameOverride = (default $globalNameOverride .Values.global.nameOverride) -}}
{{- end -}}
{{- default .Chart.Name (default .Values.nameOverride $globalNameOverride) | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "tc.common.names.fullname" -}}
{{- $name := include "tc.common.names.name" . -}}
{{- $globalFullNameOverride := "" -}}
{{- if hasKey .Values "global" -}}
{{- $globalFullNameOverride = (default $globalFullNameOverride .Values.global.fullnameOverride) -}}
{{- end -}}
{{- if or .Values.fullnameOverride $globalFullNameOverride -}}
{{- $name = default .Values.fullnameOverride $globalFullNameOverride -}}
{{- else -}}
{{- if contains $name .Release.Name -}}
{{- $name = .Release.Name -}}
{{- else -}}
{{- $name = printf "%s-%s" .Release.Name $name -}}
{{- end -}}
{{- end -}}
{{- trunc 63 $name | trimSuffix "-" -}}
{{- end -}}
{{/* Create chart name and version as used by the chart label */}}
{{- define "tc.common.names.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/* Return the properly cased version of the controller type */}}
{{- define "tc.common.names.controllerType" -}}
{{- if eq .Values.controller.type "deployment" -}}
{{- print "Deployment" -}}
{{- else if eq .Values.controller.type "daemonset" -}}
{{- print "DaemonSet" -}}
{{- else if eq .Values.controller.type "statefulset" -}}
{{- print "StatefulSet" -}}
{{- else -}}
{{- fail (printf "Not a valid controller.type (%s)" .Values.controller.type) -}}
{{- end -}}
{{- end -}}
{{/*
Create the "name" + "." + "namespace" fqdn
*/}}
{{- define "tc.common.names.fqdn" -}}
{{- printf "%s.%s" (include "tc.common.names.fullname" .) .Release.Namespace | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

View File

@@ -1,150 +0,0 @@
{{/* The main container included in the controller */}}
{{- 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 }}
{{ tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
{{- end }}
{{- if or ( .Values.extraArgs ) ( .Values.args ) }}
args:
{{- with .Values.args }}
{{- if kindIs "string" . }}
- {{ tpl . $ }}
{{- else }}
{{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
{{- end }}
{{- with .Values.extraArgs }}
{{- if kindIs "string" . }}
- {{ tpl . $ }}
{{- else }}
{{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.tty }}
tty: {{ . }}
{{- end }}
{{- with .Values.stdin }}
stdin: {{ . }}
{{- end }}
{{- with .Values.securityContext }}
securityContext:
{{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
{{- with .Values.lifecycle }}
lifecycle:
{{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
{{- with .Values.termination.messagePath }}
terminationMessagePath: {{ tpl . $ }}
{{- end }}
{{- with .Values.termination.messagePolicy }}
terminationMessagePolicy: {{ tpl . $ }}
{{- end }}
env:
{{- if and ( not .Values.podSecurityContext.runAsUser) ( .Values.security.PUID ) }}
- name: PUID
value: {{ tpl ( toYaml .Values.security.PUID ) $ | quote }}
- name: USER_ID
value: {{ tpl ( toYaml .Values.security.PUID ) $ | quote }}
- name: UID
value: {{ tpl ( toYaml .Values.security.PUID ) $ | quote }}
{{- end }}
- name: UMASK
value: {{ tpl ( toYaml .Values.security.UMASK ) $ | quote }}
- name: UMASK_SET
value: {{ tpl ( toYaml .Values.security.UMASK ) $ | quote }}
{{- if and ( not .Values.podSecurityContext.runAsUser) ( .Values.security.PUID ) }}
- name: PGID
value: {{ tpl ( toYaml .Values.podSecurityContext.fsGroup ) $ | quote }}
- name: GROUP_ID
value: {{ tpl ( toYaml .Values.podSecurityContext.fsGroup ) $ | quote }}
- name: GID
value: {{ tpl ( toYaml .Values.podSecurityContext.fsGroup ) $ | quote }}
{{- end }}
{{- if or ( .Values.securityContext.readOnlyRootFilesystem ) ( .Values.securityContext.runAsNonRoot ) }}
- name: S6_READ_ONLY_ROOT
value: "1"
{{- end }}
{{- if not ( .Values.scaleGPU ) }}
- name: NVIDIA_VISIBLE_DEVICES
value: "void"
{{- else }}
- name: NVIDIA_DRIVER_CAPABILITIES
value: "all"
{{- end }}
- name: TZ
value: {{ tpl ( toYaml .Values.TZ ) $ | quote }}
{{- with .Values.env }}
{{- range $k, $v := . }}
{{- $name := $k }}
{{- $value := $v }}
{{- if kindIs "int" $name }}
{{- $name = required "environment variables as a list of maps require a name field" $value.name }}
{{- end }}
- name: {{ quote $name }}
{{- if kindIs "map" $value -}}
{{- if hasKey $value "value" }}
{{- $value = $value.value -}}
{{- else if hasKey $value "valueFrom" }}
valueFrom: {{- tpl ( toYaml $value.valueFrom ) $ | nindent 8 }}
{{- else }}
valueFrom: {{- tpl ( toYaml $value ) $ | nindent 8 }}
{{- end }}
{{- end }}
{{- if not (kindIs "map" $value) }}
{{- if kindIs "string" $value }}
{{- $value = tpl $value $ }}
{{- end }}
value: {{ quote $value }}
{{- end }}
{{- end }}
{{- end }}
{{- range $envList := .Values.envList }}
{{- if and $envList.name $envList.value }}
- name: {{ $envList.name }}
value: {{ $envList.value | quote }}
{{- else }}
{{- fail "Please specify name/value for environment variable" }}
{{- end }}
{{- end}}
envFrom:
{{- if .Values.secretEnv }}
- secretRef:
name: {{ include "tc.common.names.fullname" . }}
{{- end }}
{{- range .Values.envFrom }}
{{- if .secretRef }}
- secretRef:
name: {{ tpl .secretRef.name $ | quote }}
{{- else if .configMapRef }}
- configMapRef:
name: {{ tpl .configMapRef.name $ | quote }}
{{- else }}
{{- end }}
{{- end }}
ports:
{{- include "tc.common.controller.ports" . | trim | nindent 4 }}
{{- with (include "tc.common.controller.volumeMounts" . | trim) }}
volumeMounts:
{{ nindent 4 . }}
{{- end }}
{{- include "tc.common.controller.probes" . | trim | nindent 2 }}
{{/*
Merges the TrueNAS SCALE generated GPU info with the .Values.resources dict
*/}}
{{- $resources := dict "limits" ( .Values.scaleGPU | default dict ) }}
{{- $resources = merge $resources .Values.resources }}
resources:
{{- with $resources }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end -}}

View File

@@ -1,128 +0,0 @@
{{/*
The pod definition included in the controller.
*/}}
{{- define "tc.common.controller.pod" -}}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{ tpl ( toYaml . ) $ | nindent 2 }}
{{- end }}
{{- $saName := include "tc.common.names.fullname" . -}}
{{- if not .Values.serviceAccount.main.enabled }}
{{ $saName = "default" }}
{{- end }}
serviceAccountName: {{ $saName }}
{{- with .Values.podSecurityContext }}
securityContext:
{{ tpl ( toYaml . ) $ | nindent 2 }}
{{- end }}
{{- with .Values.priorityClassName }}
priorityClassName: {{ tpl . $ }}
{{- end }}
{{- with .Values.schedulerName }}
schedulerName: {{ tpl . $ }}
{{- end }}
{{- with .Values.hostNetwork }}
hostNetwork: {{ . }}
{{- end }}
{{- with .Values.hostname }}
hostname: {{ tpl . $ }}
{{- end }}
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- else if .Values.hostNetwork }}
dnsPolicy: ClusterFirstWithHostNet
{{- else }}
dnsPolicy: ClusterFirst
{{- end }}
{{- if or .Values.dnsConfig.options .Values.dnsConfig.nameservers .Values.dnsConfig.searches }}
dnsConfig:
{{- with .Values.dnsConfig.options }}
options:
{{ tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
{{- with .Values.dnsConfig.nameservers }}
nameservers:
{{ tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
{{- with .Values.dnsConfig.searches }}
searches:
{{ tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
{{- end }}
enableServiceLinks: {{ .Values.enableServiceLinks }}
{{- with .Values.termination.gracePeriodSeconds }}
terminationGracePeriodSeconds: {{ . }}
{{- end }}
initContainers:
{{- include "tc.common.controller.prepare" . | 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 }}
{{- if not $container.name -}}
{{- $_ := set $container "name" $key }}
{{- end }}
{{- $installContainers = append $installContainers $container }}
{{- end }}
{{- tpl (toYaml $installContainers) $ | nindent 2 }}
{{- end }}
{{- 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 }}
{{- if not $container.name -}}
{{- $_ := set $container "name" $key }}
{{- end }}
{{- $upgradeContainers = append $upgradeContainers $container }}
{{- end }}
{{- tpl (toYaml $upgradeContainers) $ | nindent 2 }}
{{- end }}
{{- if .Values.initContainers }}
{{- $initContainers := list }}
{{- range $index, $key := (keys .Values.initContainers | uniq | sortAlpha) }}
{{- $container := get $.Values.initContainers $key }}
{{- if not $container.name -}}
{{- $_ := set $container "name" $key }}
{{- end }}
{{- $initContainers = append $initContainers $container }}
{{- end }}
{{- tpl (toYaml $initContainers) $ | nindent 2 }}
{{- end }}
containers:
{{- include "tc.common.controller.mainContainer" . | nindent 2 }}
{{- with .Values.additionalContainers }}
{{- $additionalContainers := list }}
{{- range $name, $container := . }}
{{- if not $container.name -}}
{{- $_ := set $container "name" $name }}
{{- end }}
{{- $additionalContainers = append $additionalContainers $container }}
{{- end }}
{{- tpl (toYaml $additionalContainers) $ | nindent 2 }}
{{- end }}
{{- with (include "tc.common.controller.volumes" . | trim) }}
volumes:
{{- nindent 2 . }}
{{- end }}
{{- with .Values.hostAliases }}
hostAliases:
{{ tpl ( toYaml . ) $ | nindent 2 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ tpl ( toYaml . ) $ | nindent 2 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ tpl ( toYaml . ) $ | nindent 2 }}
{{- end }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{ tpl ( toYaml . ) $ | nindent 2 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ tpl ( toYaml . ) $ | nindent 2 }}
{{- end }}
{{- end -}}

View File

@@ -1,36 +0,0 @@
{{/*
Ports included by the controller.
*/}}
{{- define "tc.common.controller.ports" -}}
{{- $ports := list -}}
{{- range .Values.service -}}
{{- if .enabled -}}
{{- range $name, $port := .ports -}}
{{- $_ := set $port "name" $name -}}
{{- $ports = mustAppend $ports $port -}}
{{- end }}
{{- end }}
{{- end }}
{{/* export/render the list of ports */}}
{{- if $ports -}}
{{- range $_ := $ports }}
{{- if .enabled }}
- 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 }}
containerPort: {{ .targetPort | default .port }}
{{- if .protocol }}
{{- if or ( eq .protocol "HTTP" ) ( eq .protocol "HTTPS" ) ( eq .protocol "TCP" ) }}
protocol: TCP
{{- else }}
protocol: {{ tpl .protocol $ }}
{{- end }}
{{- else }}
protocol: TCP
{{- end }}
{{- end}}
{{- end -}}
{{- end -}}
{{- end -}}

View File

@@ -1,213 +0,0 @@
{{/*
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 -}}
{{- $autoperms := false -}}
{{- range $name, $mount := .Values.persistence -}}
{{- if and $mount.enabled $mount.setPermissions -}}
{{- $name = default ( $name| toString ) $mount.name -}}
{{- $_ := set $hostPathMounts $name $mount -}}
{{- $autoperms = true -}}
{{- end -}}
{{- end }}
{{- if or $autoperms ( and ( .Values.addons.vpn.configFile.enabled ) ( ne .Values.addons.vpn.type "disabled" ) ( ne .Values.addons.vpn.type "tailscale" ) ) }}
- name: auto-permissions
image: {{ .Values.alpineImage.repository }}:{{ .Values.alpineImage.tag }}
securityContext:
runAsUser: 0
runAsNonRoot: false
resources:
{{- with .Values.resources }}
{{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
command:
- "/bin/sh"
- "-c"
- |
/bin/sh <<'EOF'
echo "Automatically correcting permissions..."
{{- if and ( .Values.addons.vpn.configFile.enabled ) ( ne .Values.addons.vpn.type "disabled" ) ( ne .Values.addons.vpn.type "tailscale" ) }}
echo "Automatically correcting permissions for vpn config file..."
/usr/bin/nfs4xdr_winacl -a chown -O 568 -G 568 -c /vpn/vpn.conf -p /vpn/vpn.conf || echo "Failed setting permissions..."
{{- end }}
{{- range $_, $hpm := $hostPathMounts }}
echo "Automatically correcting permissions for {{ $hpm.mountPath }}..."
/usr/bin/nfs4xdr_winacl -a chown -G {{ $group }} -r -c {{ tpl $hpm.mountPath $ | squote }} -p {{ tpl $hpm.mountPath $ | squote }} || echo "Failed setting permissions..."
{{- 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 ) ( ne .Values.addons.vpn.type "disabled" ) ( ne .Values.addons.vpn.type "tailscale" ) }}
- name: vpnconfig
mountPath: /vpn/vpn.conf
{{- end }}
{{- end }}
{{- if or .Values.mariadb.enabled .Values.redis.enabled .Values.mongodb.enabled .Values.clickhouse.enabled .Values.solr.enabled .Values.postgresql.enabled .Values.cnpg.enabled }}
- name: db-wait
image: {{ .Values.ubuntuImage.repository }}:{{ .Values.ubuntuImage.tag }}
securityContext:
runAsUser: 568
runAsGroup: 568
readOnlyRootFilesystem: true
runAsNonRoot: true
resources:
{{- with .Values.resources }}
{{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
env:
{{- if .Values.mariadb.enabled }}
- name: MARIADB_HOST
valueFrom:
secretKeyRef:
name: mariadbcreds
key: plainhost
- name: MARIADB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mariadbcreds
key: mariadb-root-password
{{- end }}
{{- if .Values.redis.enabled }}
- name: REDIS_HOST
valueFrom:
secretKeyRef:
name: rediscreds
key: plainhost
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: rediscreds
key: redis-password
- name: REDIS_PORT
value: "6379"
{{- end }}
{{- if .Values.mongodb.enabled }}
- name: MONGODB_HOST
valueFrom:
secretKeyRef:
name: mongodbcreds
key: plainhost
- name: MONGODB_DATABASE
value: "{{ .Values.mongodb.mongodbDatabase }}"
{{- end }}
{{- if .Values.clickhouse.enabled }}
- name: CLICKHOUSE_PING
valueFrom:
secretKeyRef:
name: clickhousecreds
key: ping
{{- end }}
{{- if .Values.solr.enabled }}
- name: SOLR_HOST
valueFrom:
secretKeyRef:
name: solrcreds
key: plainhost
- name: SOLR_CORES
value: "{{ .Values.solr.solrCores }}"
- name: SOLR_ENABLE_AUTHENTICATION
value: "{{ .Values.solr.solrEnableAuthentication }}"
{{- if eq .Values.solr.solrEnableAuthentication "yes" }}
- name: SOLR_ADMIN_USERNAME
value: "{{ .Values.solr.solrUsername }}"
- name: SOLR_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: solrcreds
key: solr-password
{{- end }}
{{- end }}
command:
- "/bin/sh"
- "-c"
- |
/bin/bash <<'EOF'
echo "Executing DB waits..."
{{- if .Values.postgresql.enabled }}
{{- $pghost := printf "%v-%v" .Release.Name "postgresql" }}
until
pg_isready -U {{ .Values.postgresql.postgresqlUsername }} -h {{ $pghost }}
do sleep 2
done
{{- end }}
{{- if .Values.mongodb.enabled }}
until
HOME=/config && echo "db.runCommand(\"ping\")" | mongosh --host ${MONGODB_HOST} --port 27017 ${MONGODB_DATABASE} --quiet;
do sleep 2;
done
{{- end }}
{{- if .Values.cnpg.enabled }}
{{- $cnpgName := include "tc.common.names.fullname" . -}}
{{- $cnpgName = printf "%v-%v" $cnpgName "cnpg" -}}
{{- $pghost := printf "%s-rw" $cnpgName }}
until
pg_isready -U {{ .Values.cnpg.user }} -h {{ $pghost }}
do sleep 2
done
until
pg_isready -U {{ .Values.cnpg.user }} -h pooler-{{ $pghost }}
do sleep 2
done
{{- end }}
{{- if .Values.mariadb.enabled }}
until
mysqladmin -uroot -h"${MARIADB_HOST}" -p"${MARIADB_ROOT_PASSWORD}" ping \
&& mysqladmin -uroot -h"${MARIADB_HOST}" -p"${MARIADB_ROOT_PASSWORD}" status;
do sleep 2;
done
{{- end }}
{{- if .Values.redis.enabled }}
[[ -n "$REDIS_PASSWORD" ]] && export REDISCLI_AUTH="$REDIS_PASSWORD";
export LIVE=false;
until "$LIVE";
do
response=$(
timeout -s 3 2 \
redis-cli \
-h "$REDIS_HOST" \
-p "$REDIS_PORT" \
ping
)
if [ "$response" == "PONG" ] || [ "$response" == "LOADING Redis is loading the dataset in memory" ]; then
LIVE=true
echo "$response"
echo "Redis Responded, ending initcontainer and starting main container(s)..."
else
echo "$response"
echo "Redis not responding... Sleeping for 10 sec..."
sleep 10
fi;
done
{{- end }}
{{- if .Values.clickhouse.enabled }}
until wget --quiet --tries=1 --spider "${CLICKHOUSE_PING}"; do
echo "ClickHouse - no response. Sleeping 2 seconds..."
sleep 2
done
echo "ClickHouse - accepting connections"
{{- end }}
{{- if .Values.solr.enabled }}
if [ "$SOLR_ENABLE_AUTHENTICATION" == "yes" ]; then
until curl --fail --user "${SOLR_ADMIN_USERNAME}":"${SOLR_ADMIN_PASSWORD}" "${SOLR_HOST}":8983/solr/"${SOLR_CORES}"/admin/ping; do
echo "Solr is not responding... Sleeping 2 seconds..."
sleep 2
done
else
until curl --fail "${SOLR_HOST}":8983/solr/"${SOLR_CORES}"/admin/ping; do
echo "Solr is not responding... Sleeping 2 seconds..."
sleep 2
done
fi;
{{- end }}
EOF
{{- end }}
{{- end -}}

View File

@@ -1,51 +0,0 @@
{{/*
Probes selection logic.
*/}}
{{- define "tc.common.controller.probes" -}}
{{- $primaryService := get .Values.service (include "tc.common.lib.util.service.primary" .) -}}
{{- $primaryPort := "" -}}
{{- if $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" -}}
{{- range $probeName, $probe := .Values.probes }}
{{- if $probe.enabled -}}
{{- "" | nindent 0 }}
{{- $probeName }}Probe:
{{- if $probe.custom -}}
{{- $probe.spec | toYaml | nindent 2 }}
{{- else }}
{{- if and $primaryService $primaryPort -}}
{{- if $probe.type -}}
{{- if eq $probe.type "AUTO" -}}
{{- $probeType = $primaryPort.protocol -}}
{{- else -}}
{{- $probeType = $probe.type -}}
{{- end }}
{{- end }}
{{- if or ( eq $probeType "HTTPS" ) ( eq $probeType "HTTP" ) -}}
{{- "httpGet:" | nindent 2 }}
{{- printf "path: %v" $probe.path | nindent 4 }}
{{- printf "scheme: %v" $probeType | nindent 4 }}
{{- else -}}
{{- "tcpSocket:" | nindent 2 }}
{{- end }}
{{- if $probe.port }}
{{- printf "port: %v" ( tpl ( $probe.port | toString ) $ ) | nindent 4 }}
{{- else if $primaryPort.targetPort }}
{{- printf "port: %v" $primaryPort.targetPort | nindent 4 }}
{{- else}}
{{- printf "port: %v" $primaryPort.port | nindent 4 }}
{{- end }}
{{- printf "initialDelaySeconds: %v" $probe.spec.initialDelaySeconds | nindent 2 }}
{{- printf "failureThreshold: %v" $probe.spec.failureThreshold | nindent 2 }}
{{- printf "timeoutSeconds: %v" $probe.spec.timeoutSeconds | nindent 2 }}
{{- printf "periodSeconds: %v" $probe.spec.periodSeconds | nindent 2 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -1,37 +0,0 @@
{{/* Volumes included by the controller */}}
{{- define "tc.common.controller.volumeMounts" -}}
{{- range $index, $item := .Values.persistence }}
{{- if not $item.noMount }}
{{- $mountPath := (printf "/%v" $index) -}}
{{- if eq "hostPath" (default "pvc" $item.type) -}}
{{- $mountPath = $item.hostPath -}}
{{- end -}}
{{- with $item.mountPath -}}
{{- $mountPath = . -}}
{{- end }}
{{- if and $item.enabled (ne $mountPath "-") }}
- mountPath: {{ tpl $mountPath $ }}
name: {{ tpl $index $ }}
{{- with $item.subPath }}
subPath: {{ tpl . $ }}
{{- end }}
{{- with $item.readOnly }}
readOnly: {{ . }}
{{- end }}
{{- with $item.mountPropagation }}
mountPropagation: {{ tpl . $ }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if eq .Values.controller.type "statefulset" }}
{{- range $index, $vct := .Values.volumeClaimTemplates }}
- mountPath: {{ $vct.mountPath }}
name: {{ tpl ( toString $index ) $ }}
{{- if $vct.subPath }}
subPath: {{ $vct.subPath }}
{{- end }}
{{- end }}
{{- end }}
{{- end -}}

View File

@@ -1,71 +0,0 @@
{{/*
Volumes included by the controller.
*/}}
{{- define "tc.common.controller.volumes" -}}
{{- range $index, $persistence := .Values.persistence }}
{{- if $persistence.enabled }}
- name: {{ tpl ( toString $index ) $ }}
{{- if eq (default "pvc" $persistence.type) "pvc" }}
{{- $pvcName := (include "tc.common.names.fullname" $) -}}
{{- if $persistence.existingClaim }}
{{/* Always prefer an existingClaim if that is set */}}
{{- $pvcName = $persistence.existingClaim -}}
{{- else -}}
{{/* Otherwise refer to the PVC name */}}
{{- if $persistence.nameOverride -}}
{{- if not (eq $persistence.nameOverride "-") -}}
{{- $pvcName = (printf "%s-%s" (include "tc.common.names.fullname" $) $persistence.nameOverride) -}}
{{- end -}}
{{- else -}}
{{- $pvcName = (printf "%s-%s" (include "tc.common.names.fullname" $) $index) -}}
{{- end -}}
{{- if $persistence.forceName -}}
{{- $pvcName = $persistence.forceName -}}
{{- end -}}
{{- end }}
persistentVolumeClaim:
claimName: {{ tpl $pvcName $ }}
{{- else if eq $persistence.type "emptyDir" }}
{{- $emptyDir := dict -}}
{{- with $persistence.medium -}}
{{- $_ := set $emptyDir "medium" . -}}
{{- end -}}
{{- with $persistence.sizeLimit -}}
{{- $_ := set $emptyDir "sizeLimit" . -}}
{{- end }}
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 $ }}
{{- if eq $persistence.type "configMap" }}
configMap:
name: {{ $objectName }}
{{- else }}
secret:
secretName: {{ $objectName }}
{{- end }}
{{- with $persistence.defaultMode }}
defaultMode: {{ tpl . $ }}
{{- end }}
{{- with $persistence.items }}
items:
{{- tpl ( toYaml . ) $ | nindent 6 }}
{{- end }}
{{- else if eq $persistence.type "hostPath" }}
hostPath:
path: {{ required "hostPath not set" $persistence.hostPath }}
{{- with $persistence.hostPathType }}
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" }}
{{- tpl ( toYaml $persistence.volumeSpec ) $ | nindent 2 }}
{{- else }}
{{- fail (printf "Not a valid persistence.type (%s)" $persistence.type) }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -1,46 +0,0 @@
{{/*
This template generates a random password and ensures it persists across updates/edits to the chart
*/}}
{{- define "tc.common.dependencies.clickhouse.injector" -}}
{{- if .Values.clickhouse.enabled }}
{{- $secretName := "clickhousecreds" }}
{{- $dbPass := "" }}
{{- with (lookup "v1" "Secret" .Release.Namespace $secretName) }}
{{- $dbPass = (index .data "clickhouse-password") | b64dec }}
{{- else }}
{{- $dbPass = randAlphaNum 50 }}
{{- end }}
{{- $host := printf "%v-clickhouse" .Release.Name }}
{{- $portHost := printf "%v-clickhouse:8123" .Release.Name }}
{{- $ping := printf "http://%v-clickhouse:8123/ping" .Release.Name }}
{{- $url := printf "http://%v:%v@%v-clickhouse:8123/%v" .Values.clickhouse.clickhouseUsername $dbPass .Release.Name .Values.clickhouse.clickhouseDatabase }}
{{- $jdbc := printf "jdbc:ch://%v-clickhouse:8123/%v" .Release.Name }}
---
apiVersion: v1
kind: Secret
metadata:
labels:
{{- include "tc.common.labels" . | nindent 4 }}
name: {{ $secretName }}
data:
clickhouse-password: {{ $dbPass | b64enc | quote }}
plainhost: {{ $host | b64enc | quote }}
plainporthost: {{ $portHost | b64enc | quote }}
ping: {{ $ping | b64enc | quote }}
url: {{ $url | b64enc | quote }}
jdbc: {{ $jdbc | b64enc | quote }}
{{- $_ := set .Values.clickhouse "clickhousePassword" ($dbPass | quote) }}
{{- $_ := set .Values.clickhouse.url "plain" ($host | quote) }}
{{- $_ := set .Values.clickhouse.url "plainhost" ($host | quote) }}
{{- $_ := set .Values.clickhouse.url "plainport" ($portHost | quote) }}
{{- $_ := set .Values.clickhouse.url "plainporthost" ($portHost | quote) }}
{{- $_ := set .Values.clickhouse.url "ping" ($ping | quote) }}
{{- $_ := set .Values.clickhouse.url "complete" ($url | quote) }}
{{- $_ := set .Values.clickhouse.url "jdbc" ($jdbc | quote) }}
{{- end }}
{{- end -}}

View File

@@ -1,183 +0,0 @@
{{/*
This template serves as a blueprint for all cnpg objects that are created
within the common library.
*/}}
{{- define "tc.common.dependencies.cnpg.main" -}}
{{- if .Values.cnpg.enabled }}
{{- $cnpgName := include "tc.common.names.fullname" . }}
{{- $cnpgName = printf "%v-%v" $cnpgName "cnpg" }}
---
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: {{ $cnpgName }}
{{- with (merge (.Values.cnpg.labels | default dict) (include "tc.common.labels" $ | fromYaml)) }}
labels: {{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
annotations:
{{- with (merge (.Values.cnpg.annotations | default dict) (include "tc.common.annotations" $ | fromYaml)) }}
{{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
spec:
instances: {{ .Values.cnpg.instances | default 2 }}
bootstrap:
initdb:
database: {{ .Values.cnpg.database | default "app" }}
owner: {{ .Values.cnpg.user | default "app" }}
secret:
name: cnpg-user
superuserSecret:
name: cnpg-superuser
primaryUpdateStrategy: {{ .Values.cnpg.primaryUpdateStrategy | default "unsupervised" }}
storage:
pvcTemplate:
{{ include "tc.common.storage.storageClassName" ( dict "persistence" .Values.cnpg.storage "global" $) }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.cnpg.storage.size | default "256Gi" | quote }}
walStorage:
pvcTemplate:
{{ include "tc.common.storage.storageClassName" ( dict "persistence" .Values.cnpg.storage "global" $) }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.cnpg.storage.walsize | default "256Gi" | quote }}
monitoring:
enablePodMonitor: {{ .Values.cnpg.monitoring.enablePodMonitor | default true }}
nodeMaintenanceWindow:
inProgress: false
reusePVC: on
---
apiVersion: postgresql.cnpg.io/v1
kind: Pooler
metadata:
{{ $poolerrwname := printf "pooler-%s-rw" $cnpgName }}
name: {{ $poolerrwname }}
spec:
cluster:
name: {{ $cnpgName }}
instances: {{ .Values.cnpg.instances | default 2 }}
type: rw
pgbouncer:
poolMode: session
parameters:
max_client_conn: "1000"
default_pool_size: "10"
{{ if ( .Values.cnpg.monitoring.enablePodMonitor | default true ) }}
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ $cnpgName }}-rw
spec:
selector:
matchLabels:
cnpg.io/poolerName: {{ $poolerrwname }}
podMetricsEndpoints:
- port: metrics
{{ end }}
{{ if ( .Values.cnpg.acceptRO | default true ) }}
---
apiVersion: postgresql.cnpg.io/v1
kind: Pooler
metadata:
{{ $poolerroname := printf "pooler-%s-ro" $cnpgName }}
name: {{ $poolerroname }}
spec:
cluster:
name: {{ $cnpgName }}
instances: {{ .Values.cnpg.instances | default 2 }}
type: ro
pgbouncer:
poolMode: session
parameters:
max_client_conn: "1000"
default_pool_size: "10"
{{ if ( .Values.cnpg.monitoring.enablePodMonitor | default true ) }}
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ $cnpgName }}-ro
spec:
selector:
matchLabels:
cnpg.io/poolerName: {{ $poolerroname }}
podMetricsEndpoints:
- port: metrics
{{ end }}
{{ end }}
---
apiVersion: v1
kind: Secret
metadata:
labels:
{{- include "tc.common.labels" . | nindent 4 }}
name: cnpgcreds
{{- $dbprevious := lookup "v1" "Secret" .Release.Namespace "cnpgcreds" }}
{{- $dbPass := "" }}
{{- $pgPass := "" }}
data:
{{- if $dbprevious }}
{{- $dbPass = ( index $dbprevious.data "user-password" ) | b64dec }}
{{- $pgPass = ( index $dbprevious.data "superuser-password" ) | b64dec }}
user-password: {{ ( index $dbprevious.data "user-password" ) }}
superuser-password: {{ ( index $dbprevious.data "superuser-password" ) }}
{{- else }}
{{- $dbPass = .Values.cnpg.password | default ( randAlphaNum 62 ) }}
{{- $pgPass = .Values.cnpg.superUserPassword | default ( randAlphaNum 62 ) }}
user-password: {{ $dbPass | b64enc | quote }}
superuser-password: {{ $pgPass | b64enc | quote }}
{{- end }}
{{- $std := ( ( printf "postgresql://%v:%v@%v:5432/%v" .Values.cnpg.user $dbPass $poolerrwname .Values.cnpg.database ) | b64enc | quote ) }}
{{- $nossl := ( ( printf "postgresql://%v:%v@%v:5432/%v?sslmode=disable" .Values.cnpg.user $dbPass $poolerrwname .Values.cnpg.database ) | b64enc | quote ) }}
{{- $porthost := ( ( printf "%s:5432" $poolerrwname ) | b64enc | quote ) }}
{{- $host := ( ( printf "%s" $poolerrwname ) | b64enc | quote ) }}
{{- $jdbc := ( ( printf "jdbc:postgresql://%v:5432/%v" $poolerrwname .Values.cnpg.database ) | b64enc | quote ) }}
std: {{ $std }}
nossl: {{ $nossl }}
porthost: {{ $porthost }}
host: {{ $host }}
jdbc: {{ $jdbc }}
type: Opaque
{{- $_ := set .Values.cnpg.creds "password" ( $dbPass | quote ) }}
{{- $_ := set .Values.cnpg.creds "superUserPassword" ( $pgPass | quote ) }}
{{- $_ := set .Values.cnpg.creds "std" $std }}
{{- $_ := set .Values.cnpg.creds "nossl" $nossl }}
{{- $_ := set .Values.cnpg.creds "porthost" $porthost }}
{{- $_ := set .Values.cnpg.creds "host" $host }}
{{- $_ := set .Values.cnpg.creds "jdbc" $jdbc }}
---
apiVersion: v1
data:
username: {{ "postgres" | b64enc | quote }}
password: {{ $pgPass | b64enc | quote }}
kind: Secret
metadata:
name: cnpg-superuser
type: kubernetes.io/basic-auth
---
apiVersion: v1
data:
username: {{ .Values.cnpg.user | b64enc | quote }}
password: {{ $dbPass | b64enc | quote }}
kind: Secret
metadata:
name: cnpg-user
type: kubernetes.io/basic-auth
{{- end }}
{{- end -}}

View File

@@ -1,48 +0,0 @@
{{/*
This template generates a random password and ensures it persists across updates/edits to the chart
*/}}
{{- define "tc.common.dependencies.mariadb.injector" -}}
{{- $pghost := printf "%v-%v" .Release.Name "mariadb" }}
{{- if .Values.mariadb.enabled }}
---
apiVersion: v1
kind: Secret
metadata:
labels:
{{- include "tc.common.labels" . | nindent 4 }}
name: mariadbcreds
{{- $dbprevious := lookup "v1" "Secret" .Release.Namespace "mariadbcreds" }}
{{- $dbPass := "" }}
{{- $rootPass := "" }}
data:
{{- if $dbprevious }}
{{- $dbPass = ( index $dbprevious.data "mariadb-password" ) | b64dec }}
{{- $rootPass = ( index $dbprevious.data "mariadb-root-password" ) | b64dec }}
mariadb-password: {{ ( index $dbprevious.data "mariadb-password" ) }}
mariadb-root-password: {{ ( index $dbprevious.data "mariadb-root-password" ) }}
{{- else }}
{{- $dbPass = randAlphaNum 50 }}
{{- $rootPass = randAlphaNum 50 }}
mariadb-password: {{ $dbPass | b64enc | quote }}
mariadb-root-password: {{ $rootPass | b64enc | quote }}
{{- end }}
url: {{ ( printf "sql://%v:%v@%v-mariadb:3306/%v" .Values.mariadb.mariadbUsername $dbPass .Release.Name .Values.mariadb.mariadbDatabase ) | b64enc | quote }}
urlnossl: {{ ( printf "sql://%v:%v@%v-mariadb:3306/%v?sslmode=disable" .Values.mariadb.mariadbUsername $dbPass .Release.Name .Values.mariadb.mariadbDatabase ) | b64enc | quote }}
plainporthost: {{ ( printf "%v-%v:3306" .Release.Name "mariadb" ) | b64enc | quote }}
plainhost: {{ ( printf "%v-%v" .Release.Name "mariadb" ) | b64enc | quote }}
jdbc: {{ ( printf "jdbc:sqlserver://%v-mariadb:3306/%v" .Release.Name .Values.mariadb.mariadbDatabase ) | b64enc | quote }}
jdbc-mysql: {{ ( printf "jdbc:mysql://%v-mariadb:3306/%v" .Release.Name .Values.mariadb.mariadbDatabase ) | b64enc | quote }}
jdbc-mariadb: {{ ( printf "jdbc:mariadb://%v-mariadb:3306/%v" .Release.Name .Values.mariadb.mariadbDatabase ) | b64enc | quote }}
type: Opaque
{{- $_ := set .Values.mariadb "mariadbPassword" ( $dbPass | quote ) }}
{{- $_ := set .Values.mariadb "mariadbRootPassword" ( $rootPass | quote ) }}
{{- $_ := set .Values.mariadb.url "plain" ( ( printf "%v-%v" .Release.Name "mariadb" ) | quote ) }}
{{- $_ := set .Values.mariadb.url "plainhost" ( ( printf "%v-%v" .Release.Name "mariadb" ) | quote ) }}
{{- $_ := set .Values.mariadb.url "plainport" ( ( printf "%v-%v:3306" .Release.Name "mariadb" ) | quote ) }}
{{- $_ := set .Values.mariadb.url "plainporthost" ( ( printf "%v-%v:3306" .Release.Name "mariadb" ) | quote ) }}
{{- $_ := set .Values.mariadb.url "complete" ( ( printf "sql://%v:%v@%v-mariadb:3306/%v" .Values.mariadb.mariadbUsername $dbPass .Release.Name .Values.mariadb.mariadbDatabase ) | quote ) }}
{{- $_ := set .Values.mariadb.url "jdbc" ( ( printf "jdbc:sqlserver://%v-mariadb:3306/%v" .Release.Name .Values.mariadb.mariadbDatabase ) | quote ) }}
{{- end }}
{{- end -}}

View File

@@ -1,47 +0,0 @@
{{/*
This template generates a random password and ensures it persists across updates/edits to the chart
*/}}
{{- define "tc.common.dependencies.mongodb.injector" -}}
{{- $pghost := printf "%v-%v" .Release.Name "mongodb" }}
{{- if .Values.mongodb.enabled }}
---
apiVersion: v1
kind: Secret
metadata:
labels:
{{- include "tc.common.labels" . | nindent 4 }}
name: mongodbcreds
{{- $dbprevious := lookup "v1" "Secret" .Release.Namespace "mongodbcreds" }}
{{- $dbPass := "" }}
{{- $rootPass := "" }}
data:
{{- if $dbprevious }}
{{- $dbPass = ( index $dbprevious.data "mongodb-password" ) | b64dec }}
{{- $rootPass = ( index $dbprevious.data "mongodb-root-password" ) | b64dec }}
mongodb-password: {{ ( index $dbprevious.data "mongodb-password" ) }}
mongodb-root-password: {{ ( index $dbprevious.data "mongodb-root-password" ) }}
{{- else }}
{{- $dbPass = randAlphaNum 50 }}
{{- $rootPass = randAlphaNum 50 }}
mongodb-password: {{ $dbPass | b64enc | quote }}
mongodb-root-password: {{ $rootPass | b64enc | quote }}
{{- end }}
url: {{ ( printf "mongodb://%v:%v@%v-mongodb:27017/%v" .Values.mongodb.mongodbUsername $dbPass .Release.Name .Values.mongodb.mongodbDatabase ) | b64enc | quote }}
urlssl: {{ ( printf "mongodb://%v:%v@%v-mongodb:27017/%v?ssl=true" .Values.mongodb.mongodbUsername $dbPass .Release.Name .Values.mongodb.mongodbDatabase ) | b64enc | quote }}
urltls: {{ ( printf "mongodb://%v:%v@%v-mongodb:27017/%v?tls=true" .Values.mongodb.mongodbUsername $dbPass .Release.Name .Values.mongodb.mongodbDatabase ) | b64enc | quote }}
jdbc: {{ ( printf "jdbc:mongodb://%v-mongodb:27017/%v" .Release.Name .Values.mongodb.mongodbDatabase ) | b64enc | quote }}
plainhost: {{ ( printf "%v-%v" .Release.Name "mongodb" ) | b64enc | quote }}
plainporthost: {{ ( printf "%v-%v:27017" .Release.Name "mongodb" ) | b64enc | quote }}
type: Opaque
{{- $_ := set .Values.mongodb "mongodbPassword" ( $dbPass | quote ) }}
{{- $_ := set .Values.mongodb "mongodbRootPassword" ( $rootPass | quote ) }}
{{- $_ := set .Values.mongodb.url "plain" ( ( printf "%v-%v" .Release.Name "mongodb" ) | quote ) }}
{{- $_ := set .Values.mongodb.url "plainhost" ( ( printf "%v-%v" .Release.Name "mongodb" ) | quote ) }}
{{- $_ := set .Values.mongodb.url "plainport" ( ( printf "%v-%v:27017" .Release.Name "mongodb" ) | quote ) }}
{{- $_ := set .Values.mongodb.url "plainporthost" ( ( printf "%v-%v:27017" .Release.Name "mongodb" ) | quote ) }}
{{- $_ := set .Values.mongodb.url "complete" ( ( printf "mongodb://%v:%v@%v-mongodb:27017/%v" .Values.mongodb.mongodbUsername $dbPass .Release.Name .Values.mongodb.mongodbDatabase ) | quote ) }}
{{- $_ := set .Values.mongodb.url "jdbc" ( ( printf "jdbc:mongodb://%v-mongodb:27017/%v" .Release.Name .Values.mongodb.mongodbDatabase ) | quote ) }}
{{- end }}
{{- end -}}

View File

@@ -1,48 +0,0 @@
{{/*
This template generates a random password and ensures it persists across updates/edits to the chart
*/}}
{{- define "tc.common.dependencies.postgresql.injector" -}}
{{- $pghost := printf "%v-%v" .Release.Name "postgresql" }}
{{- if .Values.postgresql.enabled }}
---
apiVersion: v1
kind: Secret
metadata:
labels:
{{- include "tc.common.labels" . | nindent 4 }}
name: dbcreds
{{- $dbprevious := lookup "v1" "Secret" .Release.Namespace "dbcreds" }}
{{- $dbPass := "" }}
{{- $pgPass := "" }}
data:
{{- if $dbprevious }}
{{- $dbPass = ( index $dbprevious.data "postgresql-password" ) | b64dec }}
{{- $pgPass = ( index $dbprevious.data "postgresql-postgres-password" ) | b64dec }}
postgresql-password: {{ ( index $dbprevious.data "postgresql-password" ) }}
postgresql-postgres-password: {{ ( index $dbprevious.data "postgresql-postgres-password" ) }}
{{- else }}
{{- $dbPass = randAlphaNum 50 }}
{{- $pgPass = randAlphaNum 50 }}
postgresql-password: {{ $dbPass | b64enc | quote }}
postgresql-postgres-password: {{ $pgPass | b64enc | quote }}
{{- end }}
url: {{ ( printf "postgresql://%v:%v@%v-postgresql:5432/%v" .Values.postgresql.postgresqlUsername $dbPass .Release.Name .Values.postgresql.postgresqlDatabase ) | b64enc | quote }}
url-noql: {{ ( printf "postgres://%v:%v@%v-postgresql:5432/%v" .Values.postgresql.postgresqlUsername $dbPass .Release.Name .Values.postgresql.postgresqlDatabase ) | b64enc | quote }}
urlnossl: {{ ( printf "postgresql://%v:%v@%v-postgresql:5432/%v?sslmode=disable" .Values.postgresql.postgresqlUsername $dbPass .Release.Name .Values.postgresql.postgresqlDatabase ) | b64enc | quote }}
plainporthost: {{ ( printf "%v-%v" .Release.Name "postgresql" ) | b64enc | quote }}
plainhost: {{ ( printf "%v-%v" .Release.Name "postgresql" ) | b64enc | quote }}
jdbc: {{ ( printf "jdbc:postgresql://%v-postgresql:5432/%v" .Release.Name .Values.postgresql.postgresqlDatabase ) | b64enc | quote }}
type: Opaque
{{- $_ := set .Values.postgresql "postgresqlPassword" ( $dbPass | quote ) }}
{{- $_ := set .Values.postgresql "postgrespassword" ( $pgPass | quote ) }}
{{- $_ := set .Values.postgresql.url "plain" ( ( printf "%v-%v" .Release.Name "postgresql" ) | quote ) }}
{{- $_ := set .Values.postgresql.url "plainhost" ( ( printf "%v-%v" .Release.Name "postgresql" ) | quote ) }}
{{- $_ := set .Values.postgresql.url "plainport" ( ( printf "%v-%v:5432" .Release.Name "postgresql" ) | quote ) }}
{{- $_ := set .Values.postgresql.url "plainporthost" ( ( printf "%v-%v:5432" .Release.Name "postgresql" ) | quote ) }}
{{- $_ := set .Values.postgresql.url "complete" ( ( printf "postgresql://%v:%v@%v-postgresql:5432/%v" .Values.postgresql.postgresqlUsername $dbPass .Release.Name .Values.postgresql.postgresqlDatabase ) | quote ) }}
{{- $_ := set .Values.postgresql.url "complete-noql" ( ( printf "postgres://%v:%v@%v-postgresql:5432/%v" .Values.postgresql.postgresqlUsername $dbPass .Release.Name .Values.postgresql.postgresqlDatabase ) | quote ) }}
{{- $_ := set .Values.postgresql.url "jdbc" ( ( printf "jdbc:postgresql://%v-postgresql:5432/%v" .Release.Name .Values.postgresql.postgresqlDatabase ) | quote ) }}
{{- end }}
{{- end -}}

View File

@@ -1,38 +0,0 @@
{{/*
This template generates a random password and ensures it persists across updates/edits to the chart
*/}}
{{- define "tc.common.dependencies.redis.injector" -}}
{{- $pghost := printf "%v-%v" .Release.Name "redis" }}
{{- if .Values.redis.enabled }}
---
apiVersion: v1
kind: Secret
metadata:
labels:
{{- include "tc.common.labels" . | nindent 4 }}
name: rediscreds
{{- $dbprevious := lookup "v1" "Secret" .Release.Namespace "rediscreds" }}
{{- $dbPass := "" }}
{{- $dbIndex := default "0" .Values.redis.redisDatabase }}
data:
{{- if $dbprevious }}
{{- $dbPass = ( index $dbprevious.data "redis-password" ) | b64dec }}
redis-password: {{ ( index $dbprevious.data "redis-password" ) }}
{{- else }}
{{- $dbPass = randAlphaNum 50 }}
redis-password: {{ $dbPass | b64enc | quote }}
{{- end }}
url: {{ ( printf "redis://%v:%v@%v-redis:6379/%v" .Values.redis.redisUsername $dbPass .Release.Name $dbIndex ) | b64enc | quote }}
plainhostpass: {{ ( printf "%v:%v@%v-redis" .Values.redis.redisUsername $dbPass .Release.Name ) | b64enc | quote }}
plainporthost: {{ ( printf "%v-%v:6379" .Release.Name "redis" ) | b64enc | quote }}
plainhost: {{ ( printf "%v-%v" .Release.Name "redis" ) | b64enc | quote }}
type: Opaque
{{- $_ := set .Values.redis "redisPassword" ( $dbPass | quote ) }}
{{- $_ := set .Values.redis.url "plain" ( ( printf "%v-%v" .Release.Name "redis" ) | quote ) }}
{{- $_ := set .Values.redis.url "plainhost" ( ( printf "%v-%v" .Release.Name "redis" ) | quote ) }}
{{- $_ := set .Values.redis.url "plainport" ( ( printf "%v-%v:6379" .Release.Name "redis" ) | quote ) }}
{{- $_ := set .Values.redis.url "plainporthost" ( ( printf "%v-%v:6379" .Release.Name "redis" ) | quote ) }}
{{- end }}
{{- end -}}

View File

@@ -1,33 +0,0 @@
{{/*
This template generates a random password and ensures it persists across updates/edits to the chart
*/}}
{{- define "tc.common.dependencies.solr.injector" -}}
{{- $host := printf "%v-%v" .Release.Name "solr" }}
{{- if .Values.solr.enabled }}
---
apiVersion: v1
kind: Secret
metadata:
labels:
{{- include "tc.common.labels" . | nindent 4 }}
name: solrcreds
{{- $solrprevious := lookup "v1" "Secret" .Release.Namespace "solrcreds" }}
{{- $solrPass := "" }}
data:
{{- if $solrprevious }}
{{- $solrPass = ( index $solrprevious.data "solr-password" ) | b64dec }}
solr-password: {{ ( index $solrprevious.data "solr-password" ) }}
{{- else }}
{{- $solrPass = randAlphaNum 50 }}
solr-password: {{ $solrPass | b64enc | quote }}
{{- end }}
url: {{ ( printf "http://%v:%v@%v-solr:8983/url/%v" .Values.solr.solrUsername $solrPass .Release.Name .Values.solr.solrCores ) | b64enc | quote }}
plainhost: {{ ( ( printf "%v-%v" .Release.Name "solr" ) ) | b64enc | quote }}
type: Opaque
{{- $_ := set .Values.solr "solrPassword" ( $solrPass | quote ) }}
{{- $_ := set .Values.solr.url "plain" ( ( printf "%v-%v" .Release.Name "solr" ) | quote ) }}
{{- $_ := set .Values.solr.url "plainhost" ( ( printf "%v-%v" .Release.Name "solr" ) | quote ) }}
{{- end }}
{{- end -}}

View File

@@ -1,102 +0,0 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Return a soft nodeAffinity definition
{{ include "tc.common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
*/}}
{{- define "tc.common.affinities.nodes.soft" -}}
preferredDuringSchedulingIgnoredDuringExecution:
- preference:
matchExpressions:
- key: {{ .key }}
operator: In
values:
{{- range .values }}
- {{ . | quote }}
{{- end }}
weight: 1
{{- end -}}
{{/*
Return a hard nodeAffinity definition
{{ include "tc.common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
*/}}
{{- define "tc.common.affinities.nodes.hard" -}}
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: {{ .key }}
operator: In
values:
{{- range .values }}
- {{ . | quote }}
{{- end }}
{{- end -}}
{{/*
Return a nodeAffinity definition
{{ include "tc.common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
*/}}
{{- define "tc.common.affinities.nodes" -}}
{{- if eq .type "soft" }}
{{- include "tc.common.affinities.nodes.soft" . -}}
{{- else if eq .type "hard" }}
{{- include "tc.common.affinities.nodes.hard" . -}}
{{- end -}}
{{- end -}}
{{/*
Return a soft podAffinity/podAntiAffinity definition
{{ include "tc.common.affinities.pods.soft" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}}
*/}}
{{- define "tc.common.affinities.pods.soft" -}}
{{- $component := default "" .component -}}
{{- $extraMatchLabels := default (dict) .extraMatchLabels -}}
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels: {{- (include "tc.common.labels.matchLabels" .context) | nindent 10 }}
{{- if not (empty $component) }}
{{ printf "app.kubernetes.io/component: %s" $component }}
{{- end }}
{{- range $key, $value := $extraMatchLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
namespaces:
- {{ .context.Release.Namespace | quote }}
topologyKey: kubernetes.io/hostname
weight: 1
{{- end -}}
{{/*
Return a hard podAffinity/podAntiAffinity definition
{{ include "tc.common.affinities.pods.hard" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}}
*/}}
{{- define "tc.common.affinities.pods.hard" -}}
{{- $component := default "" .component -}}
{{- $extraMatchLabels := default (dict) .extraMatchLabels -}}
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels: {{- (include "tc.common.labels.matchLabels" .context) | nindent 8 }}
{{- if not (empty $component) }}
{{ printf "app.kubernetes.io/component: %s" $component }}
{{- end }}
{{- range $key, $value := $extraMatchLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
namespaces:
- {{ .context.Release.Namespace | quote }}
topologyKey: kubernetes.io/hostname
{{- end -}}
{{/*
Return a podAffinity/podAntiAffinity definition
{{ include "tc.common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
*/}}
{{- define "tc.common.affinities.pods" -}}
{{- if eq .type "soft" }}
{{- include "tc.common.affinities.pods.soft" . -}}
{{- else if eq .type "hard" }}
{{- include "tc.common.affinities.pods.hard" . -}}
{{- end -}}
{{- end -}}

View File

@@ -1,39 +0,0 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Return the proper image name
{{ include "tc.common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" $) }}
*/}}
{{- define "tc.common.images.image" -}}
{{- $repositoryName := .imageRoot.repository -}}
{{- $tag := .imageRoot.tag | toString -}}
{{- printf "%s:%s" $repositoryName $tag -}}
{{- end -}}
{{/*
Return the image name using the selector
{{ include "tc.common.images.selector" . }}
*/}}
{{- define "tc.common.images.selector" -}}
{{- $imageDict := get .Values "image" }}
{{- $selected := .Values.imageSelector }}
{{- if hasKey .Values $selected }}
{{- $imageDict = get .Values $selected }}
{{- end }}
{{- $repositoryName := $imageDict.repository -}}
{{- $tag :=$imageDict.tag | toString -}}
{{- printf "%s:%s" $repositoryName $tag -}}
{{- end -}}
{{/*
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 "tc.common.images.pullSecrets" -}}
{{- end -}}
{{/*
Return the proper Docker Image Registry Secret Names evaluating values as templates
{{ include "tc.common.images.renderPullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }}
*/}}
{{- define "tc.common.images.renderPullSecrets" -}}
{{- end -}}

View File

@@ -1,14 +0,0 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Kubernetes standard labels
*/}}
{{- define "tc.common.labels.standard" -}}
{{- include "tc.common.labels" . }}
{{- end -}}
{{/*
Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector
*/}}
{{- define "tc.common.labels.matchLabels" -}}
{{- include "tc.common.labels.selectorLabels" . }}
{{- end -}}

View File

@@ -1,82 +0,0 @@
{{- define "tc.common.lib.util.manifest.update" -}}
{{- if .Values.manifests.enabled }}
{{- $fullName := include "tc.common.names.fullname" . }}
---
apiVersion: batch/v1
kind: Job
metadata:
namespace: {{ .Release.Namespace }}
name: {{ $fullName }}-manifests
annotations:
"helm.sh/hook": pre-install, pre-upgrade
"helm.sh/hook-weight": "-6"
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
spec:
template:
spec:
serviceAccountName: {{ $fullName }}-manifests
containers:
- name: {{ $fullName }}-manifests
image: {{ .Values.kubectlImage.repository }}:{{ .Values.kubectlImage.tag }}
securityContext:
runAsUser: 568
runAsGroup: 568
readOnlyRootFilesystem: true
runAsNonRoot: true
command:
- "/bin/sh"
- "-c"
- |
/bin/sh <<'EOF'
echo "installing manifests..."
kubectl apply --server-side --force-conflicts -k https://github.com/truecharts/manifests/{{ if .Values.manifests.staging }}staging{{ else }}manifests{{ end }} {{ if .Values.manifests.nonBlocking }} || echo "Manifest application failed..."{{ end }}
EOF
volumeMounts:
- name: {{ $fullName }}-manifests-temp
mountPath: /tmp
restartPolicy: Never
volumes:
- name: {{ $fullName }}-manifests-temp
emptyDir: {}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ $fullName }}-manifests
annotations:
"helm.sh/hook": pre-install, pre-upgrade
"helm.sh/hook-weight": "-7"
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ $fullName }}-manifests
annotations:
"helm.sh/hook": pre-install, pre-upgrade
"helm.sh/hook-weight": "-7"
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ $fullName }}-manifests
subjects:
- kind: ServiceAccount
name: {{ $fullName }}-manifests
namespace: {{ .Release.Namespace }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ $fullName }}-manifests
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook": pre-install, pre-upgrade
"helm.sh/hook-weight": "-7"
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
{{- end }}
{{- end -}}

View File

@@ -1,21 +0,0 @@
{{/* 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 -}}

View File

@@ -1,23 +0,0 @@
{{/*
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 -}}

View File

@@ -1,23 +0,0 @@
{{/*
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 -}}

View File

@@ -1,23 +0,0 @@
{{/*
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 -}}

View File

@@ -1,27 +0,0 @@
{{/*
Return the primary port for a given Service object.
*/}}
{{- define "tc.common.lib.util.service.ports.primary" -}}
{{- $enabledPorts := dict -}}
{{- range $name, $port := .values.ports -}}
{{- if $port.enabled -}}
{{- $_ := set $enabledPorts $name . -}}
{{- end -}}
{{- end -}}
{{- if eq 0 (len $enabledPorts) }}
{{- fail (printf "No ports are enabled for service \"%s\"!" .serviceName) }}
{{- end }}
{{- $result := "" -}}
{{- range $name, $port := $enabledPorts -}}
{{- if and (hasKey $port "primary") $port.primary -}}
{{- $result = $name -}}
{{- end -}}
{{- end -}}
{{- if not $result -}}
{{- $result = keys $enabledPorts | first -}}
{{- end -}}
{{- $result -}}
{{- end -}}

View File

@@ -1,52 +0,0 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Return the proper Storage Class
{{ include "tc.common.storage.classname" ( dict "persistence" .Values.path.to.the.persistence "global" $ ) }}
*/}}
{{- define "tc.common.storage.storageClassName" -}}
{{- 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 -}}
{{- define "tc.common.storage.storageClass" -}}
{{- if .persistence.storageClass -}}
{{- if (eq "-" .persistence.storageClass) -}}
{{- printf "storageClass: \"\"" -}}
{{- else if and (eq "SCALE-ZFS" .persistence.storageClass ) -}}
{{- printf "storageClass: %s" .global.Values.global.ixChartContext.storageClassName -}}
{{- else -}}
{{- printf "storageClass: %s" .persistence.storageClass -}}
{{- end -}}
{{- else if .global.Values.global.ixChartContext -}}
{{- printf "storageClass: %s" .global.Values.global.ixChartContext.storageClassName -}}
{{- end -}}
{{- end -}}
{{- define "tc.common.storage.class" -}}
{{- if .persistence.storageClass -}}
{{- if (eq "-" .persistence.storageClass) -}}
{{- printf "\"\"" -}}
{{- else if and (eq "SCALE-ZFS" .persistence.storageClass ) -}}
{{- printf "%s" .global.Values.global.ixChartContext.storageClassName -}}
{{- else -}}
{{- printf "%s" .persistence.storageClass -}}
{{- end -}}
{{- else if .global.Values.global.ixChartContext -}}
{{- printf "%s" .global.Values.global.ixChartContext.storageClassName -}}
{{- end -}}
{{- end -}}

View File

@@ -1,13 +0,0 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Renders a value that contains template.
Usage:
{{ include "tc.common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "tc.common.tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}

View File

@@ -1,14 +0,0 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Warning about using rolling tag.
Usage:
{{ include "tc.common.warnings.rollingTag" .Values.path.to.the.imageRoot }}
*/}}
{{- 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.
+info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/
{{- end }}
{{- end -}}

View File

@@ -1,52 +0,0 @@
{{/* 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 -}}

View File

@@ -1,19 +0,0 @@
{{/* 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 -}}

View File

@@ -1,8 +0,0 @@
{{/* 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 -}}

View File

@@ -1,10 +0,0 @@
{{/* 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 -}}

View File

@@ -1,28 +0,0 @@
{{/* 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 -}}

View File

@@ -1,9 +0,0 @@
{{/* 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 -}}

View File

@@ -1,10 +0,0 @@
{{/* 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 -}}

View File

@@ -1,9 +0,0 @@
{{/* 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 -}}

View File

@@ -1,9 +0,0 @@
{{/* 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 -}}

View File

@@ -1,14 +0,0 @@
{{/* 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 -}}

View File

@@ -1,14 +0,0 @@
{{/* 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 -}}

View File

@@ -1,13 +0,0 @@
{{/* 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 -}}

View File

@@ -1,14 +0,0 @@
{{/* 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 -}}

View File

@@ -1,14 +0,0 @@
{{/* 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 -}}

View File

@@ -1,21 +0,0 @@
{{/* 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 -}}

View File

@@ -1,9 +0,0 @@
{{/* 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 -}}

View File

@@ -1,9 +0,0 @@
{{/* 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 -}}

View File

@@ -1,20 +0,0 @@
{{/* 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 -}}

View File

@@ -1,15 +0,0 @@
{{/* 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 -}}

View File

@@ -1,11 +0,0 @@
{{/*
Main entrypoint for the common library chart. It will render all underlying templates based on the provided values.
*/}}
{{- define "tc.common.loader.all" -}}
{{/* Generate chart and dependency values */}}
{{- include "tc.common.loader.init" . }}
{{/* Generate remaining objects */}}
{{- include "tc.common.loader.apply" . }}
{{- end -}}

View File

@@ -1,54 +0,0 @@
{{/*
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 -}}
{{/* 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 -}}

View File

@@ -1,41 +0,0 @@
{{- 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" . }}
{{ include "tc.common.lib.util.manifest.update" . | nindent 0 }}
{{/* Autogenerate cnpg objects if needed */}}
{{- include "tc.common.dependencies.cnpg.main" . }}
{{/* 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" . }}
{{/* Autogenerate clickhouse passwords if needed */}}
{{- include "tc.common.dependencies.clickhouse.injector" . }}
{{/* Autogenerate solr passwords if needed */}}
{{- include "tc.common.dependencies.solr.injector" . }}
{{- end -}}

View File

@@ -1,21 +0,0 @@
{{/* 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.ports.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 -}}

View File

@@ -1,36 +0,0 @@
{{/*
This template serves as the blueprint for the DaemonSet objects that are created
within the common library.
*/}}
{{- define "tc.common.daemonset" }}
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ include "tc.common.names.fullname" . }}
{{- with (merge (.Values.controller.labels | default dict) (include "tc.common.labels" $ | fromYaml)) }}
labels: {{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
{{- with (merge (.Values.controller.annotations | default dict) (include "tc.common.annotations" $ | fromYaml) (include "tc.common.annotations.workload" $ | fromYaml)) }}
annotations: {{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
spec:
revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }}
selector:
matchLabels:
{{- include "tc.common.labels.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
{{- include "tc.common.annotations.workload.spec" . | nindent 8 }}
{{- with .Values.podAnnotations }}
{{- tpl ( toYaml . ) $ | nindent 8 }}
{{- end }}
labels:
{{- include "tc.common.labels.selectorLabels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- tpl ( toYaml . ) $ | nindent 8 }}
{{- end }}
spec:
{{- include "tc.common.controller.pod" . | nindent 6 }}
{{- end }}

View File

@@ -1,54 +0,0 @@
{{/*
This template serves as the blueprint for the Deployment objects that are created
within the common library.
*/}}
{{- define "tc.common.deployment" }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "tc.common.names.fullname" . }}
{{- with (merge (.Values.controller.labels | default dict) (include "tc.common.labels" $ | fromYaml)) }}
labels: {{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
{{- with (merge (.Values.controller.annotations | default dict) (include "tc.common.annotations" $ | fromYaml) (include "tc.common.annotations.workload" $ | fromYaml)) }}
annotations: {{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
spec:
revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }}
replicas: {{ .Values.controller.replicas }}
{{- $strategy := default "Recreate" .Values.controller.strategy }}
{{- if and (ne $strategy "Recreate") (ne $strategy "RollingUpdate") }}
{{- fail (printf "Not a valid strategy type for Deployment (%s)" $strategy) }}
{{- end }}
strategy:
type: {{ $strategy }}
{{- with .Values.controller.rollingUpdate }}
{{- if and (eq $strategy "RollingUpdate") (or .surge .unavailable) }}
rollingUpdate:
{{- with .unavailable }}
maxUnavailable: {{ . }}
{{- end }}
{{- with .surge }}
maxSurge: {{ . }}
{{- end }}
{{- end }}
{{- end }}
selector:
matchLabels:
{{- include "tc.common.labels.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
{{- include "tc.common.annotations.workload.spec" . | nindent 8 }}
{{- with .Values.podAnnotations }}
{{- tpl ( toYaml . ) $ | nindent 8 }}
{{- end }}
labels:
{{- include "tc.common.labels.selectorLabels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- tpl ( toYaml . ) $ | nindent 8 }}
{{- end }}
spec:
{{- include "tc.common.controller.pod" . | nindent 6 }}
{{- end }}

View File

@@ -1,61 +0,0 @@
{{/*
This template serves as the blueprint for the StatefulSet objects that are created
within the common library.
*/}}
{{- define "tc.common.statefulset" }}
{{- $values := .Values }}
{{- $releaseName := .Release.Name }}
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "tc.common.names.fullname" . }}
{{- with (merge (.Values.controller.labels | default dict) (include "tc.common.labels" $ | fromYaml)) }}
labels: {{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
{{- with (merge (.Values.controller.annotations | default dict) (include "tc.common.annotations" $ | fromYaml) (include "tc.common.annotations.workload" $ | fromYaml)) }}
annotations: {{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
spec:
revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }}
replicas: {{ .Values.controller.replicas }}
{{- $strategy := default "RollingUpdate" .Values.controller.strategy }}
{{- if and (ne $strategy "OnDelete") (ne $strategy "RollingUpdate") }}
{{- fail (printf "Not a valid strategy type for StatefulSet (%s)" $strategy) }}
{{- end }}
updateStrategy:
type: {{ $strategy }}
{{- if and (eq $strategy "RollingUpdate") .Values.controller.rollingUpdate.partition }}
rollingUpdate:
partition: {{ .Values.controller.rollingUpdate.partition }}
{{- end }}
selector:
matchLabels:
{{- include "tc.common.labels.selectorLabels" . | nindent 6 }}
serviceName: {{ include "tc.common.names.fullname" . }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- tpl ( toYaml . ) $ | nindent 8 }}
{{- end }}
labels:
{{- include "tc.common.labels.selectorLabels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- tpl ( toYaml . ) $ | nindent 8 }}
{{- end }}
spec:
{{- include "tc.common.controller.pod" . | nindent 6 }}
volumeClaimTemplates:
{{- range $index, $vct := .Values.volumeClaimTemplates }}
- metadata:
name: {{ tpl ( toString $index ) $ }}
spec:
accessModes:
- {{ tpl ( $vct.accessMode | default "ReadWriteOnce" ) $ | quote }}
resources:
requests:
storage: {{ tpl ( $vct.size | default "999Gi" ) $ | quote }}
{{ include "tc.common.storage.storageClassName" ( dict "persistence" $vct "global" $) }}
{{- end }}
{{- end }}

View File

@@ -1,19 +0,0 @@
{{/*
Renders the configMap objects required by the chart.
*/}}
{{- define "tc.common.spawner.configmap" -}}
{{/* Generate named configMaps as required */}}
{{- range $name, $configmap := .Values.configmap }}
{{- if $configmap.enabled -}}
{{- $configmapValues := $configmap -}}
{{/* set the default nameOverride to the configMap name */}}
{{- if not $configmapValues.nameOverride -}}
{{- $_ := set $configmapValues "nameOverride" $name -}}
{{ end -}}
{{- $_ := set $ "ObjectValues" (dict "configmap" $configmapValues) -}}
{{- include "tc.common.class.configmap" $ }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -1,19 +0,0 @@
{{/*
Renders the configMap objects required by the chart.
*/}}
{{- define "tc.common.spawner.hpa" -}}
{{/* Generate named configMaps as required */}}
{{- range $name, $hpa := .Values.horizontalPodAutoscaler }}
{{- if $hpa.enabled -}}
{{- $hpaValues := $hpa -}}
{{/* set the default nameOverride to the hpa name */}}
{{- if not $hpaValues.nameOverride -}}
{{- $_ := set $hpaValues "nameOverride" $name -}}
{{ end -}}
{{- $_ := set $ "ObjectValues" (dict "hpa" $hpaValues) -}}
{{- include "tc.common.class.hpa" $ }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -1,29 +0,0 @@
{{/* Renders the Ingress objects required by the chart */}}
{{- define "tc.common.spawner.ingress" -}}
{{/* Generate named ingresses as required */}}
{{- range $name, $ingress := .Values.ingress }}
{{- if $ingress.enabled -}}
{{- $ingressValues := $ingress -}}
{{/* set defaults */}}
{{- if and (not $ingressValues.nameOverride) (ne $name (include "tc.common.lib.util.ingress.primary" $)) -}}
{{- $_ := set $ingressValues "nameOverride" $name -}}
{{- end -}}
{{- $_ := set $ "ObjectValues" (dict "ingress" $ingressValues) -}}
{{- include "tc.common.class.ingress" $ }}
{{- range $index, $tlsValues := $ingressValues.tls }}
{{- if and ( .scaleCert ) ( $.Values.global.ixChartContext ) }}
{{- $nameOverride := ( printf "%v-%v" "tls" $index ) -}}
{{- if $ingressValues.nameOverride -}}
{{- $nameOverride = ( printf "%v-%v-%v" $ingressValues.nameOverride "tls" $index ) -}}
{{- end }}
{{- $_ := set $tlsValues "nameOverride" $nameOverride -}}
{{- $_ := set $ "ObjectValues" (dict "certHolder" $tlsValues) -}}
{{- include "tc.common.scale.cert.secret" $ }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -1,19 +0,0 @@
{{/*
Renders the networkPolicy objects required by the chart.
*/}}
{{- define "tc.common.spawner.networkpolicy" -}}
{{/* Generate named networkpolicy as required */}}
{{- range $name, $networkPolicy := .Values.networkPolicy }}
{{- if $networkPolicy.enabled -}}
{{- $networkPolicyValues := $networkPolicy -}}
{{/* set the default nameOverride to the networkpolicy name */}}
{{- if not $networkPolicyValues.nameOverride -}}
{{- $_ := set $networkPolicyValues "nameOverride" $name -}}
{{ end -}}
{{- $_ := set $ "ObjectValues" (dict "networkPolicy" $networkPolicyValues) -}}
{{- include "tc.common.class.networkpolicy" $ }}
{{- end }}
{{- end }}
{{- end }}

Some files were not shown because too many files have changed in this diff Show More