This commit is contained in:
2026-10-23 18:47:41 -04:00
parent 935b3e9f4c
commit 10e0185e19
2 changed files with 16 additions and 7 deletions
+9 -4
View File
@@ -83,8 +83,12 @@ config:
{% for connector in dex_additional_connectors %}
- {{ connector | to_json }}
{% endfor %}
volumes:{% if not dex_theme_enabled and not dex_ca_secret_name and not dex_extra_volumes %} []{% endif %}
volumes:
# The official entrypoint renders its config into /tmp before starting Dex.
- name: dex-tmp
emptyDir:
medium: Memory
sizeLimit: 16Mi
{% if dex_theme_enabled %}
- name: theme
configMap:
@@ -98,8 +102,9 @@ volumes:{% if not dex_theme_enabled and not dex_ca_secret_name and not dex_extra
{% for volume in dex_extra_volumes %}
- {{ volume | to_json }}
{% endfor %}
volumeMounts:{% if not dex_theme_enabled and not dex_ca_secret_name and not dex_extra_volume_mounts %} []{% endif %}
volumeMounts:
- name: dex-tmp
mountPath: /tmp
{% if dex_theme_enabled %}
- name: theme
mountPath: /srv/dex/web/themes/light/styles.css
+7 -3
View File
@@ -48,8 +48,9 @@ assert ldap['config']['groupSearch']['userMatchers'][0]['userAttr'] == 'DN'
assert config['staticClients'][0]['id'] == 'matrix-fixture'
assert config['frontend']['logoURL'] == 'theme/logo.svg'
assert config['frontend']['dir'] == '/srv/dex/web'
assert len(values['volumeMounts']) == 2
assert all(mount['readOnly'] for mount in values['volumeMounts'])
assert len(values['volumeMounts']) == 3
assert all(mount['readOnly'] for mount in values['volumeMounts'] if mount['name'] != 'dex-tmp')
assert next(volume for volume in values['volumes'] if volume['name'] == 'dex-tmp')['emptyDir'] == {'medium': 'Memory', 'sizeLimit': '16Mi'}
optional = yaml.safe_load(Path('/tmp/dex-values-optional.yml').read_text())
assert 'frontend' not in optional['config']
assert optional['config']['connectors'][0]['config']['startTLS'] is True
@@ -57,13 +58,16 @@ assert optional['config']['staticClients'][0]['secretEnv'] == 'WWW_DEX_CLIENT_SE
assert optional['envFrom'][0]['secretRef']['name'] == 'dex-client-secrets'
minimal = yaml.safe_load(Path('/tmp/dex-values-minimal.yml').read_text())
assert minimal['config']['staticClients'] == []
assert minimal['volumes'] == [] and minimal['volumeMounts'] == []
assert minimal['volumes'] == [{'name': 'dex-tmp', 'emptyDir': {'medium': 'Memory', 'sizeLimit': '16Mi'}}]
assert minimal['volumeMounts'] == [{'name': 'dex-tmp', 'mountPath': '/tmp'}]
objects = [obj for obj in yaml.safe_load_all(Path('/tmp/dex-manifests.yml').read_text()) if obj]
for obj in objects:
validate(obj, desired_version='1.31.0', strict=True)
deployment = next(obj for obj in objects if obj['kind'] == 'Deployment')
assert deployment['metadata']['name'] == 'dex'
mounts = deployment['spec']['template']['spec']['containers'][0]['volumeMounts']
assert {'name': 'dex-tmp', 'mountPath': '/tmp'} in mounts
assert deployment['spec']['template']['spec']['containers'][0]['securityContext']['readOnlyRootFilesystem'] is True
assert any(mount['mountPath'].endswith('/light/styles.css') for mount in mounts)
secret = next(obj for obj in objects if obj['kind'] == 'Secret')
stored = yaml.safe_load(base64.b64decode(secret['data']['config.yaml']))