Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
809c04c9
Unverified
Commit
809c04c9
authored
Mar 09, 2026
by
Anant Sharma
Committed by
GitHub
Mar 09, 2026
Browse files
revert: "fix: strip apiVersion/kind/metadata from overrides.dgd before merging" (#7100)
parent
440d72ee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
146 deletions
+1
-146
components/src/dynamo/profiler/tests/__init__.py
components/src/dynamo/profiler/tests/__init__.py
+0
-2
components/src/dynamo/profiler/tests/test_profiler_protocol.py
...nents/src/dynamo/profiler/tests/test_profiler_protocol.py
+0
-105
components/src/dynamo/profiler/utils/config_modifiers/protocol.py
...ts/src/dynamo/profiler/utils/config_modifiers/protocol.py
+1
-39
No files found.
components/src/dynamo/profiler/tests/__init__.py
deleted
100644 → 0
View file @
440d72ee
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
components/src/dynamo/profiler/tests/test_profiler_protocol.py
deleted
100644 → 0
View file @
440d72ee
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
"""Unit tests for profiler config_modifiers/protocol helpers."""
import
pytest
from
dynamo.profiler.utils.config_modifiers.protocol
import
apply_dgd_overrides
pytestmark
=
[
pytest
.
mark
.
unit
,
pytest
.
mark
.
gpu_0
,
pytest
.
mark
.
pre_merge
,
]
def
test_apply_dgd_overrides_strips_envelope
()
->
None
:
"""Envelope fields are stripped; nested payload keys are deep-merged."""
dgd_config
=
{
"apiVersion"
:
"dynamo.ai/v1alpha1"
,
"kind"
:
"DynamoGraphDeployment"
,
"metadata"
:
{
"name"
:
"my-deployment"
,
"namespace"
:
"default"
},
"spec"
:
{
"services"
:
{
"Frontend"
:
{
"replicas"
:
1
},
}
},
}
overrides
=
{
# Envelope fields — must be stripped entirely.
"apiVersion"
:
"dynamo.ai/v1beta1"
,
"kind"
:
"SomethingElse"
,
# metadata identity keys must be stripped; labels/annotations kept.
"metadata"
:
{
"name"
:
"injected-name"
,
"namespace"
:
"injected-ns"
,
"uid"
:
"abc-123"
,
"resourceVersion"
:
"999"
,
"labels"
:
{
"team"
:
"infra"
},
"annotations"
:
{
"note"
:
"perf-run"
},
},
# Regular payload key — must be deep-merged.
"spec"
:
{
"services"
:
{
"Frontend"
:
{
"replicas"
:
3
},
}
},
}
result
=
apply_dgd_overrides
(
dgd_config
,
overrides
)
# apiVersion and kind must not be changed.
assert
result
[
"apiVersion"
]
==
"dynamo.ai/v1alpha1"
assert
result
[
"kind"
]
==
"DynamoGraphDeployment"
# Identity metadata keys must not be overwritten.
assert
result
[
"metadata"
][
"name"
]
==
"my-deployment"
assert
result
[
"metadata"
][
"namespace"
]
==
"default"
assert
"uid"
not
in
result
[
"metadata"
]
assert
"resourceVersion"
not
in
result
[
"metadata"
]
# Safe metadata keys must be merged in.
assert
result
[
"metadata"
][
"labels"
]
==
{
"team"
:
"infra"
}
assert
result
[
"metadata"
][
"annotations"
]
==
{
"note"
:
"perf-run"
}
# Regular spec overrides must be applied.
assert
result
[
"spec"
][
"services"
][
"Frontend"
][
"replicas"
]
==
3
# Original dicts must not be mutated.
assert
dgd_config
[
"apiVersion"
]
==
"dynamo.ai/v1alpha1"
assert
dgd_config
[
"spec"
][
"services"
][
"Frontend"
][
"replicas"
]
==
1
def
test_apply_dgd_overrides_no_metadata_in_overrides
()
->
None
:
"""When overrides contain no metadata key, existing metadata is untouched."""
dgd_config
=
{
"apiVersion"
:
"dynamo.ai/v1alpha1"
,
"kind"
:
"DynamoGraphDeployment"
,
"metadata"
:
{
"name"
:
"svc"
,
"namespace"
:
"ns"
},
"spec"
:
{
"services"
:
{
"Backend"
:
{
"replicas"
:
2
}}},
}
overrides
=
{
"spec"
:
{
"services"
:
{
"Backend"
:
{
"replicas"
:
5
}}}}
result
=
apply_dgd_overrides
(
dgd_config
,
overrides
)
assert
result
[
"metadata"
]
==
{
"name"
:
"svc"
,
"namespace"
:
"ns"
}
assert
result
[
"spec"
][
"services"
][
"Backend"
][
"replicas"
]
==
5
def
test_apply_dgd_overrides_metadata_only_identity_keys_dropped_entirely
()
->
None
:
"""If metadata override contains only identity keys, nothing is merged into metadata."""
dgd_config
=
{
"apiVersion"
:
"dynamo.ai/v1alpha1"
,
"kind"
:
"DynamoGraphDeployment"
,
"metadata"
:
{
"name"
:
"svc"
},
"spec"
:
{},
}
overrides
=
{
"metadata"
:
{
"name"
:
"other"
,
"namespace"
:
"other-ns"
,
"uid"
:
"x"
},
}
result
=
apply_dgd_overrides
(
dgd_config
,
overrides
)
# Only original metadata should remain — no extra keys added.
assert
result
[
"metadata"
]
==
{
"name"
:
"svc"
}
components/src/dynamo/profiler/utils/config_modifiers/protocol.py
View file @
809c04c9
...
@@ -723,43 +723,5 @@ def apply_dgd_overrides(dgd_config: dict, overrides: dict) -> dict:
...
@@ -723,43 +723,5 @@ def apply_dgd_overrides(dgd_config: dict, overrides: dict) -> dict:
A new dict with the overrides applied (the original is not mutated).
A new dict with the overrides applied (the original is not mutated).
"""
"""
result
=
copy
.
deepcopy
(
dgd_config
)
result
=
copy
.
deepcopy
(
dgd_config
)
# Strip K8s envelope fields — these are controlled by the template and must
_deep_merge_overrides
(
result
,
overrides
,
path
=
[])
# not be overwritten by user-supplied overrides (e.g. apiVersion from a
# DGDR spec would change v1alpha1 → v1beta1 causing a 400 Bad Request).
stripped_top
=
[
k
for
k
in
(
"apiVersion"
,
"kind"
)
if
k
in
overrides
]
if
stripped_top
:
logger
.
warning
(
"Ignoring envelope field(s) %s from overrides.dgd — these are "
"controlled by the deployment template and cannot be overridden."
,
stripped_top
,
)
filtered
=
{
k
:
v
for
k
,
v
in
overrides
.
items
()
if
k
not
in
(
"apiVersion"
,
"kind"
,
"metadata"
)
}
# For metadata: strip identity/owner keys (name, namespace, uid,
# resourceVersion) which are template-controlled, but preserve safe fields
# such as labels and annotations supplied by the user.
if
"metadata"
in
overrides
and
isinstance
(
overrides
[
"metadata"
],
dict
):
_METADATA_IDENTITY_KEYS
=
frozenset
(
{
"name"
,
"namespace"
,
"uid"
,
"resourceVersion"
}
)
stripped_meta
=
[
k
for
k
in
overrides
[
"metadata"
]
if
k
in
_METADATA_IDENTITY_KEYS
]
if
stripped_meta
:
logger
.
warning
(
"Ignoring metadata identity field(s) %s from overrides.dgd — "
"use the DGD template to set these."
,
stripped_meta
,
)
sanitized_metadata
=
{
k
:
v
for
k
,
v
in
overrides
[
"metadata"
].
items
()
if
k
not
in
_METADATA_IDENTITY_KEYS
}
if
sanitized_metadata
:
filtered
[
"metadata"
]
=
sanitized_metadata
_deep_merge_overrides
(
result
,
filtered
,
path
=
[])
return
result
return
result
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment