Skip to content

Fix hub webhook DRA version gating to skip cluster version check#1286

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
TomerNewman:fix-hub-dra-version-gating
Jun 14, 2026
Merged

Fix hub webhook DRA version gating to skip cluster version check#1286
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
TomerNewman:fix-hub-dra-version-gating

Conversation

@TomerNewman

Copy link
Copy Markdown
Collaborator

The ManagedClusterModule webhook on the hub was incorrectly using the hub cluster's Kubernetes version to gate DRA usage. Since the hub cannot know the target managed cluster's version, this could wrongly reject valid specs or accept invalid ones.

Fix by passing an empty KubeVersion to the hub validator and skipping the version gate in validateDRA when the version is zero. Field format validation (driverName, deviceClasses) still runs unconditionally. The spoke cluster's own Module webhook enforces the version requirement.

Also moves DiscoverKubeVersion inside the enableModule branch so that webhook modes that don't need cluster version (namespace, preflight) no longer require ClusterVersion API access.


/cc @yevgeny-shnaidman
/assign @yevgeny-shnaidman

@netlify

netlify Bot commented Jun 12, 2026

Copy link
Copy Markdown

Deploy Preview for kubernetes-sigs-kmm ready!

Name Link
🔨 Latest commit e6f1373
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-kmm/deploys/6a2bff06e220af0008b4167e
😎 Deploy Preview https://deploy-preview-1286--kubernetes-sigs-kmm.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: TomerNewman

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 12, 2026
@codecov-commenter

codecov-commenter commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 56.25000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.39%. Comparing base (fa23a9b) to head (e6f1373).
⚠️ Report is 381 commits behind head on main.

Files with missing lines Patch % Lines
cmd/webhook-server/main.go 0.00% 6 Missing ⚠️
...ternal/webhook/hub/managedclustermodule_webhook.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1286      +/-   ##
==========================================
- Coverage   79.09%   73.39%   -5.70%     
==========================================
  Files          51       67      +16     
  Lines        5109     4921     -188     
==========================================
- Hits         4041     3612     -429     
- Misses        882     1140     +258     
+ Partials      186      169      -17     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread cmd/webhook-server/main.go Outdated
The ManagedClusterModule webhook on the hub was incorrectly using the
hub cluster's Kubernetes version to gate DRA usage.
Since the hub cannot know the target managed cluster's version, this could wrongly reject
valid specs or accept invalid ones.

Fix by passing an empty KubeVersion to the hub validator and skipping
the version gate in validateDRA when the version is zero. Field format
validation (driverName, deviceClasses) still runs unconditionally. The
spoke cluster's own Module webhook enforces the version requirement.

Also moves DiscoverKubeVersion inside the enableModule branch so that
webhook modes that don't need cluster version (namespace, preflight)
no longer require ClusterVersion API access.
@TomerNewman TomerNewman force-pushed the fix-hub-dra-version-gating branch from a156105 to e6f1373 Compare June 12, 2026 12:43
@yevgeny-shnaidman

Copy link
Copy Markdown
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 14, 2026
@k8s-ci-robot k8s-ci-robot merged commit 0ebd56c into kubernetes-sigs:main Jun 14, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants