Repository navigation
feat(operator): add runtime feature gates #12421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tmonty12
merged 6 commits into
ai-dynamo:main
from
xianlubird:codex/typed-runtime-compatibility-gates
Aug 4, 2026
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d44a19b
refactor(operator): type compatibility gates
xianlubird 434bf1b
refactor(operator): define canary gate policy
xianlubird 903a137
refactor(operator): unify compatibility gates
xianlubird c159539
refactor(operator): derive gate origin from metadata
xianlubird b0ddedd
refactor(operator): use runtime-only feature gates
xianlubird 8fa7ea8
refactor(operator): simplify runtime gate evaluation
xianlubird File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
deploy/operator/internal/features/compatibility/runtime.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package compatibility | ||
|
|
||
| import ( | ||
| "github.com/ai-dynamo/dynamo/deploy/operator/internal/runtimeversion" | ||
| "sigs.k8s.io/controller-runtime/pkg/log" | ||
| ) | ||
|
|
||
| // RuntimeGate represents a feature gated on the resolved Dynamo runtime | ||
| // compatibility version. | ||
| type RuntimeGate struct { | ||
| Name string // Human-readable feature name (for logging) | ||
| MinRuntimeVersion runtimeversion.Version // Minimum runtime version required | ||
| } | ||
|
|
||
| // Enabled returns true if runtimeVersion is known and meets or exceeds the | ||
| // gate's minimum runtime version. | ||
| func (fg RuntimeGate) Enabled(runtimeVersion *runtimeversion.Version) bool { | ||
| logger := log.Log.WithName("compatibility").WithValues("feature", fg.Name) | ||
| if runtimeVersion == nil { | ||
| logger.V(1).Info("Runtime version unknown, feature disabled") | ||
| return false | ||
| } | ||
|
|
||
| enabled := runtimeVersion.AtLeast(fg.MinRuntimeVersion) | ||
|
|
||
| logger.V(1).Info("Runtime feature gate evaluated", | ||
| "runtimeVersion", runtimeVersion.String(), | ||
| "threshold", fg.MinRuntimeVersion, | ||
| "enabled", enabled) | ||
|
xianlubird marked this conversation as resolved.
Outdated
|
||
|
|
||
| return enabled | ||
| } | ||
54 changes: 54 additions & 0 deletions
54
deploy/operator/internal/features/compatibility/runtime_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package compatibility | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/ai-dynamo/dynamo/deploy/operator/internal/runtimeversion" | ||
| ) | ||
|
|
||
| func TestRuntimeGateEnabled(t *testing.T) { | ||
| gate := RuntimeGate{ | ||
| Name: "TestFeature", | ||
| MinRuntimeVersion: runtimeversion.Version{Major: 1, Minor: 4, Patch: 0}, | ||
| } | ||
|
|
||
| tests := []struct { | ||
| name string | ||
| version *runtimeversion.Version | ||
| want bool | ||
| }{ | ||
| { | ||
| name: "unknown runtime version is disabled", | ||
| version: nil, | ||
| want: false, | ||
| }, | ||
| { | ||
| name: "runtime version below threshold is disabled", | ||
| version: &runtimeversion.Version{Major: 1, Minor: 3, Patch: 9}, | ||
| want: false, | ||
| }, | ||
| { | ||
| name: "runtime version at threshold is enabled", | ||
| version: &runtimeversion.Version{Major: 1, Minor: 4, Patch: 0}, | ||
| want: true, | ||
| }, | ||
| { | ||
| name: "runtime version above threshold is enabled", | ||
| version: &runtimeversion.Version{Major: 2, Minor: 0, Patch: 0}, | ||
| want: true, | ||
| }, | ||
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| if got := gate.Enabled(tt.version); got != tt.want { | ||
| t.Fatalf("Enabled(%v) = %t, want %t", tt.version, got, tt.want) | ||
| } | ||
| }) | ||
| } | ||
|
xianlubird marked this conversation as resolved.
xianlubird marked this conversation as resolved.
Outdated
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.