mirror of
https://github.com/element-hq/ess-helm.git
synced 2026-12-04 15:52:31 -08:00
Merge pull request #1400 from element-hq/gaelg/add-support-for-pvc-volume-name
Add support for PVC volumeName property
This commit is contained in:
9 files changed
+68
No files matched your search
@@ -19,6 +19,9 @@
|
||||
},
|
||||
"selector": {
|
||||
"$ref": "file://common/labelSelector.json"
|
||||
},
|
||||
"volumeName": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -228,6 +228,9 @@ networking:
|
||||
|
||||
## The PersistentVolumeClaim PV selector
|
||||
# selector: {}
|
||||
|
||||
## The PersistentVolumeClaim PV name
|
||||
# volumeName:
|
||||
{%- endif %}
|
||||
|
||||
## The StorageClass to be used by {{ 'all constructed PersistentVolumeClaims by default' if global else 'the constructed PersistentVolumeClaim' }}.
|
||||
|
||||
@@ -26,6 +26,9 @@ spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .storage.size }}
|
||||
{{- with .storage.volumeName }}
|
||||
volumeName: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .storage.selector }}
|
||||
selector:
|
||||
{{ toYaml . | nindent 4 }}
|
||||
|
||||
@@ -26,6 +26,9 @@ spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .storage.size }}
|
||||
{{- with .storage.volumeName }}
|
||||
volumeName: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .storage.selector }}
|
||||
selector:
|
||||
{{ toYaml . | nindent 4 }}
|
||||
|
||||
@@ -26,6 +26,9 @@ spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .media.storage.size }}
|
||||
{{- with .media.storage.volumeName }}
|
||||
volumeName: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .media.storage.selector }}
|
||||
selector:
|
||||
{{ toYaml . | nindent 4 }}
|
||||
|
||||
@@ -5586,6 +5586,9 @@
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"volumeName": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
@@ -8354,6 +8357,9 @@
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"volumeName": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
@@ -10199,6 +10205,9 @@
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"volumeName": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
||||
@@ -2023,6 +2023,9 @@ hookshot:
|
||||
## The PersistentVolumeClaim PV selector
|
||||
# selector: {}
|
||||
|
||||
## The PersistentVolumeClaim PV name
|
||||
# volumeName:
|
||||
|
||||
## The StorageClass to be used by the constructed PersistentVolumeClaim.
|
||||
## The top-level storage.storageClassName value is used, if not provided (or the cluster default if neither are provided).
|
||||
## If changed after initial usage the PersistentVolumeClaim could be recreated causing data-loss.
|
||||
@@ -3036,6 +3039,9 @@ postgres:
|
||||
## The PersistentVolumeClaim PV selector
|
||||
# selector: {}
|
||||
|
||||
## The PersistentVolumeClaim PV name
|
||||
# volumeName:
|
||||
|
||||
## The StorageClass to be used by the constructed PersistentVolumeClaim.
|
||||
## The top-level storage.storageClassName value is used, if not provided (or the cluster default if neither are provided).
|
||||
## If changed after initial usage the PersistentVolumeClaim could be recreated causing data-loss.
|
||||
@@ -3687,6 +3693,9 @@ synapse:
|
||||
## The PersistentVolumeClaim PV selector
|
||||
# selector: {}
|
||||
|
||||
## The PersistentVolumeClaim PV name
|
||||
# volumeName:
|
||||
|
||||
## The StorageClass to be used by the constructed PersistentVolumeClaim.
|
||||
## The top-level storage.storageClassName value is used, if not provided (or the cluster default if neither are provided).
|
||||
## If changed after initial usage the PersistentVolumeClaim could be recreated causing data-loss.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Add support for configuring `PersistentVolumeClaim` `volumeName` property.
|
||||
@@ -193,3 +193,37 @@ async def test_pvc_gets_configured_selector(values, make_templates, release_name
|
||||
deployable_details = template_to_deployable_details(template)
|
||||
expected_selector = deployable_details.get_helm_values(values, PropertyType.Storage)["selector"]
|
||||
assert pvc_spec["selector"] == expected_selector, f"{template_id(template)} has an unexpected selector"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("values_file", values_files_to_test)
|
||||
@pytest.mark.asyncio_cooperative
|
||||
async def test_pvc_has_no_volumeName_by_default(templates):
|
||||
for template in templates:
|
||||
if template["kind"] in ["PersistentVolumeClaim"]:
|
||||
pvc_spec = template["spec"]
|
||||
assert "volumeName" not in pvc_spec, (
|
||||
f"{template_id(template)} has a default volumeName when one isn't configured"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("values_file", values_files_to_test)
|
||||
@pytest.mark.asyncio_cooperative
|
||||
async def test_pvc_gets_configured_volumeName(values, make_templates, release_name):
|
||||
def set_volumeName(deployable_details: DeployableDetails):
|
||||
volumeName = "".join(random.choices(string.ascii_lowercase))
|
||||
deployable_details.set_helm_values(values, PropertyType.Storage, {"volumeName": volumeName})
|
||||
|
||||
iterate_deployables_parts(
|
||||
set_volumeName,
|
||||
lambda deployable_details: deployable_details.has_storage,
|
||||
)
|
||||
for template in await make_templates(values):
|
||||
if template["kind"] in ["PersistentVolumeClaim"]:
|
||||
pvc_spec = template["spec"]
|
||||
assert "volumeName" in pvc_spec, f"{template_id(template)} doesn't have a volumeName when one is configured"
|
||||
|
||||
deployable_details = template_to_deployable_details(template)
|
||||
expected_volumeName = deployable_details.get_helm_values(values, PropertyType.Storage)["volumeName"]
|
||||
assert pvc_spec["volumeName"] == expected_volumeName, (
|
||||
f"{template_id(template)} has an unexpected volumeName"
|
||||
)
|
||||
Reference in new issue
Block a user