mirror of
https://github.com/element-hq/ess-helm.git
synced 2026-11-27 04:16:41 -08:00
Merge pull request #1398 from element-hq/gaelg/pvc-selector
Add support for PVC selector
This commit is contained in:
9 files changed
+207
No files matched your search
@@ -16,6 +16,9 @@
|
||||
"keep",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
"selector": {
|
||||
"$ref": "file://common/labelSelector.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -225,6 +225,9 @@ networking:
|
||||
## The size of a PersistentVolumeClaim to be constructed
|
||||
## Ignored if existingClaim is provided
|
||||
size: 10Gi
|
||||
|
||||
## The PersistentVolumeClaim PV selector
|
||||
# selector: {}
|
||||
{%- endif %}
|
||||
|
||||
## The StorageClass to be used by {{ 'all constructed PersistentVolumeClaims by default' if global else 'the constructed PersistentVolumeClaim' }}.
|
||||
|
||||
@@ -26,6 +26,10 @@ spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .storage.size }}
|
||||
{{- with .storage.selector }}
|
||||
selector:
|
||||
{{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -26,6 +26,10 @@ spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .storage.size }}
|
||||
{{- with .storage.selector }}
|
||||
selector:
|
||||
{{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -26,6 +26,10 @@ spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .media.storage.size }}
|
||||
{{- with .media.storage.selector }}
|
||||
selector:
|
||||
{{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -5537,6 +5537,55 @@
|
||||
"keep",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
"selector": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"matchExpressions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"key",
|
||||
"operator"
|
||||
],
|
||||
"properties": {
|
||||
"key": {
|
||||
"type": "string"
|
||||
},
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"In",
|
||||
"NotIn",
|
||||
"Exists",
|
||||
"DoesNotExist"
|
||||
]
|
||||
},
|
||||
"values": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"matchLabels": {
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
@@ -8256,6 +8305,55 @@
|
||||
"keep",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
"selector": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"matchExpressions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"key",
|
||||
"operator"
|
||||
],
|
||||
"properties": {
|
||||
"key": {
|
||||
"type": "string"
|
||||
},
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"In",
|
||||
"NotIn",
|
||||
"Exists",
|
||||
"DoesNotExist"
|
||||
]
|
||||
},
|
||||
"values": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"matchLabels": {
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
@@ -10052,6 +10150,55 @@
|
||||
"keep",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
"selector": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"matchExpressions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"key",
|
||||
"operator"
|
||||
],
|
||||
"properties": {
|
||||
"key": {
|
||||
"type": "string"
|
||||
},
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"In",
|
||||
"NotIn",
|
||||
"Exists",
|
||||
"DoesNotExist"
|
||||
]
|
||||
},
|
||||
"values": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"matchLabels": {
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
||||
@@ -2020,6 +2020,9 @@ hookshot:
|
||||
## Ignored if existingClaim is provided
|
||||
size: 10Gi
|
||||
|
||||
## The PersistentVolumeClaim PV selector
|
||||
# selector: {}
|
||||
|
||||
## 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.
|
||||
@@ -3030,6 +3033,9 @@ postgres:
|
||||
## Ignored if existingClaim is provided
|
||||
size: 10Gi
|
||||
|
||||
## The PersistentVolumeClaim PV selector
|
||||
# selector: {}
|
||||
|
||||
## 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.
|
||||
@@ -3678,6 +3684,9 @@ synapse:
|
||||
## Ignored if existingClaim is provided
|
||||
size: 10Gi
|
||||
|
||||
## The PersistentVolumeClaim PV selector
|
||||
# selector: {}
|
||||
|
||||
## 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` `selector` properties.
|
||||
@@ -161,3 +161,35 @@ async def test_individual_storageClassName_passed_through_to_created_pvcs(values
|
||||
assert expected_storageClassName == template["spec"]["storageClassName"], (
|
||||
f"{template_id(template)} didn't respect the configured PVC storageClassName"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("values_file", values_files_to_test)
|
||||
@pytest.mark.asyncio_cooperative
|
||||
async def test_pvc_has_no_selector_by_default(templates):
|
||||
for template in templates:
|
||||
if template["kind"] in ["PersistentVolumeClaim"]:
|
||||
pvc_spec = template["spec"]
|
||||
assert "selectors" not in pvc_spec, (
|
||||
f"{template_id(template)} has a default selector when one isn't configured"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("values_file", values_files_to_test)
|
||||
@pytest.mark.asyncio_cooperative
|
||||
async def test_pvc_gets_configured_selector(values, make_templates, release_name):
|
||||
def set_selector(deployable_details: DeployableDetails):
|
||||
selector = {"k8s.element.io/pvc-testing": "".join(random.choices(string.ascii_lowercase))}
|
||||
deployable_details.set_helm_values(values, PropertyType.Storage, {"selector": {"matchLabels": selector}})
|
||||
|
||||
iterate_deployables_parts(
|
||||
set_selector,
|
||||
lambda deployable_details: deployable_details.has_storage,
|
||||
)
|
||||
for template in await make_templates(values):
|
||||
if template["kind"] in ["PersistentVolumeClaim"]:
|
||||
pvc_spec = template["spec"]
|
||||
assert "selector" in pvc_spec, f"{template_id(template)} doesn't have a selector when one is configured"
|
||||
|
||||
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"
|
||||
Reference in new issue
Block a user