Skip to content

Commit f134ed4

Browse files
authored
[iris] Allow capacity_type in resources with stale compiled protos (#4407)
The unknown-keys check in _normalize_scale_group_resources derived allowed keys solely from the compiled proto descriptor. When the installed proto bindings are stale (capacity_type not yet in DESCRIPTOR.fields_by_name), the check raises ValueError before the normalization code can handle it. Add capacity_type to _NORMALIZED_KEYS (renamed from _YAML_ALIASES to reflect its actual purpose: fields explicitly handled by normalization, which may not yet appear in stale compiled protos).
1 parent 4885780 commit f134ed4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/iris/src/iris/cluster/config.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -952,9 +952,10 @@ def _normalize_scale_group_resources(data: dict) -> None:
952952
raise ValueError(f"scale_groups.{name}.resources must be a mapping")
953953

954954
# Proto field names derived from the ScaleGroupResources descriptor,
955-
# plus user-friendly YAML aliases that get normalized below.
956-
_YAML_ALIASES = {"cpu", "ram", "disk"}
957-
allowed_keys = set(config_pb2.ScaleGroupResources.DESCRIPTOR.fields_by_name.keys()) | _YAML_ALIASES
955+
# plus fields handled explicitly by normalization code below (may not
956+
# yet appear in stale compiled protos).
957+
_NORMALIZED_KEYS = {"cpu", "ram", "disk", "capacity_type"}
958+
allowed_keys = set(config_pb2.ScaleGroupResources.DESCRIPTOR.fields_by_name.keys()) | _NORMALIZED_KEYS
958959
unknown_keys = set(resources.keys()) - allowed_keys
959960
if unknown_keys:
960961
unknown = ", ".join(sorted(unknown_keys))

0 commit comments

Comments
 (0)