34 lines
1.7 KiB
Bash
Executable File
34 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
sh -n install.sh bootstrap-homelab-secrets.sh scripts/chart-version.sh
|
|
helm repo add bitnami https://charts.bitnami.com/bitnami --force-update >/dev/null
|
|
helm dependency build chart/mumble >/dev/null
|
|
helm lint chart/mumble
|
|
helm lint chart/mumble --set postgresql.enabled=true
|
|
python3 - <<'PY'
|
|
import subprocess
|
|
import yaml
|
|
|
|
def render(*extra):
|
|
output = subprocess.check_output(['helm', 'template', 'mumble', 'chart/mumble',
|
|
'--namespace', 'default', '--set', 'postgresql.enabled=true',
|
|
*extra], text=True)
|
|
return [doc for doc in yaml.safe_load_all(output) if doc]
|
|
|
|
staged = render('--set', 'mumble.enabled=false')
|
|
assert not any(doc['kind'] == 'Deployment' for doc in staged)
|
|
assert any(doc['kind'] == 'StatefulSet' and doc['metadata']['name'] == 'mumble-postgresql' for doc in staged)
|
|
active = render()
|
|
deployment = next(doc for doc in active if doc['kind'] == 'Deployment' and doc['metadata']['name'] == 'mumble')
|
|
service = next(doc for doc in active if doc['kind'] == 'Service' and doc['metadata']['name'] == 'mumble')
|
|
assert not service['spec'].get('loadBalancerIP')
|
|
assert {port['protocol'] for port in service['spec']['ports']} == {'TCP', 'UDP'}
|
|
assert deployment['spec']['strategy']['type'] == 'Recreate'
|
|
pod = deployment['spec']['template']['spec']
|
|
assert [container['name'] for container in pod['initContainers']] == ['render-config']
|
|
assert pod['containers'][0]['image'].endswith('v1.5.939')
|
|
assert any(volume.get('secret', {}).get('secretName') == 'mumble-tls' for volume in pod['volumes'])
|
|
print('Mumble chart renders staged PostgreSQL and active Mumble without cleartext credentials.')
|
|
PY
|