Skip to content

refactor(operator): switch DGD and DCD admission to v1beta1 for 1.5 - #11177

Merged
sttts merged 3 commits into
ai-dynamo:mainfrom
sttts:sttts-1.5-remove-v1alpha1-dgd-admission
Aug 10, 2026
Merged

refactor(operator): switch DGD and DCD admission to v1beta1 for 1.5#11177
sttts merged 3 commits into
ai-dynamo:mainfrom
sttts:sttts-1.5-remove-v1alpha1-dgd-admission

Conversation

@sttts

@sttts sttts commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Switch the DGD validating and defaulting webhook registrations to v1beta1.
  • Remove the legacy v1alpha1 DGD validating and defaulting webhook endpoints for 1.5.
  • Remove the DGD admission-only alpha-to-beta adapter types, conversion helper, and compatibility tests.
  • Switch the DCD validating webhook registration from the v1alpha1 compatibility endpoint to /validate/nvidia.com/v1beta1/dynamocomponentdeployments.
  • Keep the DCD v1alpha1 compatibility handler in the binary; this PR changes only which endpoint Helm actively registers.

This does not remove the v1alpha1 CRD versions or the API conversion webhook.

Dependencies

Validation

  • GOCACHE=/private/tmp/dynamo-go-cache go test ./internal/webhook/...
  • helm lint . --set discoveryBackend=kubernetes
  • helm template dcd-validation . --set discoveryBackend=kubernetes --show-only templates/webhook-configuration.yaml
  • Verified the rendered DCD validating webhook uses /validate/nvidia.com/v1beta1/dynamocomponentdeployments with apiVersions: [v1beta1].

Summary by CodeRabbit

  • Bug Fixes
    • Updated admission webhooks to use the newer beta API endpoints for deployment resources.
    • Simplified webhook behavior so create and update requests are handled consistently on the supported version.
    • Removed legacy alpha-version handling, reducing mismatched webhook routing and conversion issues.

@sttts
sttts requested a review from a team as a code owner July 2, 2026 13:52
@copy-pr-bot

copy-pr-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@sttts
sttts temporarily deployed to external_collaborator July 2, 2026 13:52 — with GitHub Actions Inactive
@sttts
sttts had a problem deploying to external_collaborator July 2, 2026 13:52 — with GitHub Actions Failure
@github-actions github-actions Bot added refactor deployment::k8s Relates to dynamo deployment in kubernetes labels Jul 2, 2026
@datadog-official

datadog-official Bot commented Jul 2, 2026

Copy link
Copy Markdown

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 46.09% (-11.92%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: bdc44ab | Docs | Datadog PR Page | Give us feedback!

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review

@sttts
sttts temporarily deployed to external_collaborator July 9, 2026 16:35 — with GitHub Actions Inactive
@dynamo-ops

Copy link
Copy Markdown
Contributor

/ok to test 7410e0a

@sttts sttts changed the title refactor(operator): 1.5 remove v1alpha1 DGD admission handlers refactor(operator): switch DGD and DCD admission to v1beta1 for 1.5 Jul 9, 2026
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR removes v1alpha1 admission webhook support for DynamoGraphDeployment, consolidating defaulting and validation webhooks onto a single v1beta1 endpoint. The Helm chart webhook configuration is updated to reference v1beta1 paths and API versions, and conversion helpers plus related v1alpha1 tests are deleted.

Changes

v1alpha1 webhook removal and v1beta1 consolidation

Layer / File(s) Summary
Helm webhook configuration updated to v1beta1 paths
deploy/helm/charts/platform/components/operator/templates/webhook-configuration.yaml
Validating and mutating webhook entries for dynamocomponentdeployments and dynamographdeployments switch admission path and rules.apiVersions from v1alpha1 to v1beta1.
Defaulting webhook simplified to v1beta1 only
deploy/operator/internal/webhook/defaulting/dynamographdeployment_handler.go, deploy/operator/internal/webhook/defaulting/dynamographdeployment_handler_test.go
The v1alpha1 import, path constants, and legacy defaulter struct are removed; Default inlines v1beta1 admission handling, replica/MinAvailable defaulting, and origin-version annotation stamping; RegisterWithManager registers only the v1beta1 mutate path; the v1alpha1 defaulting test is deleted.
Validation webhook simplified to v1beta1 only, conversion helpers removed
deploy/operator/internal/webhook/validation/dynamographdeployment_handler.go, deploy/operator/internal/webhook/validation/dynamographdeployment_handler_test.go, deploy/operator/internal/webhook/dynamographdeployment_conversion.go
ValidateCreate, ValidateUpdate, and ValidateDelete inline v1beta1 GVK checks and casting, removing the v1alpha1 handler wrapper and delegated helpers; RegisterWithManager registers a single v1beta1 endpoint; castToDynamoGraphDeployment only accepts v1beta1; the conversion helper file and the v1alpha1 validation test are deleted.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the change, but it does not follow the required template sections or include the required Related Issues block. Add the template sections: Overview, Details, Where should the reviewer start?, and the required Related Issues section with the issue link or no-issue confirmation.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: switching DGD and DCD admission to v1beta1 for 1.5.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch sttts-1.5-remove-v1alpha1-dgd-admission

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
deploy/operator/internal/webhook/defaulting/dynamographdeployment_handler.go (1)

76-96: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Move nil-Replicas defaulting ahead of the admission-request fetch.

The replica default is described as preventing a controller nil-pointer panic and must apply "on every operation," yet it now sits after the RequestFromContext call, whose error branch (Line 79) returns nil early. If the request can't be extracted, the object is admitted with nil Replicas and the panic the comment warns about can still occur downstream. The request is only needed for the CREATE-time annotation stamping, so run the component defaulting first, then fetch the request solely to gate the stamping.

🛠️ Proposed reordering
-	req, err := admission.RequestFromContext(ctx)
-	if err != nil {
-		logger.Error(err, "failed to get admission request from context, skipping defaulting")
-		return nil
-	}
-
 	// Default nil replicas to 1 for all components. The Replicas field is
 	// *int32 with omitempty, so users can legally omit it. Without this
 	// default the controller panics on a nil pointer dereference in
 	// expandRolesForComponent(). Apply on every operation so that components
 	// added via UPDATE also get the default.
 	grovePathway := d.isGrovePathway(dgd)
 	for i := range dgd.Spec.Components {
 		component := &dgd.Spec.Components[i]
 		if component.Replicas == nil {
 			component.Replicas = ptr.To(int32(1))
 		}
 		if grovePathway && component.MinAvailable == nil {
 			component.MinAvailable = ptr.To(int32(1))
 		}
 	}
 
+	req, err := admission.RequestFromContext(ctx)
+	if err != nil {
+		logger.Error(err, "failed to get admission request from context, skipping origin-version stamping")
+		return nil
+	}
+
 	if req.Operation == admissionv1.Create {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@deploy/operator/internal/webhook/defaulting/dynamographdeployment_handler.go`
around lines 76 - 96, Move the nil-Replicas defaulting in
dynamographdeploymentHandler.Default around the RequestFromContext logic so it
always runs first, before any early return from admission request lookup. Keep
the component loop that initializes Replicas (and grovePathway MinAvailable)
unconditional, then call admission.RequestFromContext(ctx) only for the
CREATE-time annotation stamping path so a missing request cannot bypass the
safety default.
deploy/helm/charts/platform/components/operator/templates/webhook-configuration.yaml (1)

44-62: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Update the DCD validating webhook to use the new v1beta1 route. deploy/operator/internal/webhook/validation/dynamocomponentdeployment_handler.go still registers /validate-nvidia-com-v1alpha1-dynamocomponentdeployment and gates on nvidiacomv1alpha1.DynamoComponentDeploymentGVK, while the Helm config now sends requests to /validate/nvidia.com/v1beta1/dynamocomponentdeployments. That mismatch will break CREATE/UPDATE admission for dynamocomponentdeployments.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@deploy/helm/charts/platform/components/operator/templates/webhook-configuration.yaml`
around lines 44 - 62, The validating webhook route and version gate are still on
the old v1alpha1 path, so update `dynamocomponentdeployment_handler.go` to
register and handle the new
`/validate/nvidia.com/v1beta1/dynamocomponentdeployments` route. Make the
handler use the v1beta1 `DynamoComponentDeployment` GVK and ensure the webhook
registration, path matching, and admission logic all align with the Helm
`webhook-configuration` template so CREATE/UPDATE requests reach the correct
validator.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@deploy/helm/charts/platform/components/operator/templates/webhook-configuration.yaml`:
- Around line 44-62: The validating webhook route and version gate are still on
the old v1alpha1 path, so update `dynamocomponentdeployment_handler.go` to
register and handle the new
`/validate/nvidia.com/v1beta1/dynamocomponentdeployments` route. Make the
handler use the v1beta1 `DynamoComponentDeployment` GVK and ensure the webhook
registration, path matching, and admission logic all align with the Helm
`webhook-configuration` template so CREATE/UPDATE requests reach the correct
validator.

In
`@deploy/operator/internal/webhook/defaulting/dynamographdeployment_handler.go`:
- Around line 76-96: Move the nil-Replicas defaulting in
dynamographdeploymentHandler.Default around the RequestFromContext logic so it
always runs first, before any early return from admission request lookup. Keep
the component loop that initializes Replicas (and grovePathway MinAvailable)
unconditional, then call admission.RequestFromContext(ctx) only for the
CREATE-time annotation stamping path so a missing request cannot bypass the
safety default.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a8509ad0-004e-48a5-b913-bfe44f1b016c

📥 Commits

Reviewing files that changed from the base of the PR and between d17cdf7 and 7410e0a.

📒 Files selected for processing (6)
  • deploy/helm/charts/platform/components/operator/templates/webhook-configuration.yaml
  • deploy/operator/internal/webhook/defaulting/dynamographdeployment_handler.go
  • deploy/operator/internal/webhook/defaulting/dynamographdeployment_handler_test.go
  • deploy/operator/internal/webhook/dynamographdeployment_conversion.go
  • deploy/operator/internal/webhook/validation/dynamographdeployment_handler.go
  • deploy/operator/internal/webhook/validation/dynamographdeployment_handler_test.go
💤 Files with no reviewable changes (3)
  • deploy/operator/internal/webhook/dynamographdeployment_conversion.go
  • deploy/operator/internal/webhook/validation/dynamographdeployment_handler_test.go
  • deploy/operator/internal/webhook/defaulting/dynamographdeployment_handler_test.go

sttts added 2 commits August 10, 2026 10:36
Signed-off-by: Dr. Stefan Schimanski <sschimanski@nvidia.com>
Signed-off-by: Dr. Stefan Schimanski <sschimanski@nvidia.com>
@sttts
sttts force-pushed the sttts-1.5-remove-v1alpha1-dgd-admission branch from 7410e0a to 69b1460 Compare August 10, 2026 08:46
@sttts
sttts requested a review from a team as a code owner August 10, 2026 08:46
@sttts
sttts temporarily deployed to external_collaborator August 10, 2026 08:46 — with GitHub Actions Inactive
@dynamo-ops

Copy link
Copy Markdown
Contributor

/ok to test 69b1460

Signed-off-by: Dr. Stefan Schimanski <sschimanski@nvidia.com>
@sttts
sttts temporarily deployed to external_collaborator August 10, 2026 08:54 — with GitHub Actions Inactive
@dynamo-ops

Copy link
Copy Markdown
Contributor

/ok to test bdc44ab

@sttts
sttts enabled auto-merge (squash) August 10, 2026 14:36
@sttts
sttts merged commit 2f6cd32 into ai-dynamo:main Aug 10, 2026
99 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deployment::k8s Relates to dynamo deployment in kubernetes refactor size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants