Skip to content

Register DRA reconciler with manager#1287

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
TomerNewman:MGMT-24472-register-dra-reconciler
Jun 17, 2026
Merged

Register DRA reconciler with manager#1287
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
TomerNewman:MGMT-24472-register-dra-reconciler

Conversation

@TomerNewman

@TomerNewman TomerNewman commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Register DRA reconciler with manager

Summary

Wire the existing DRA reconciler into the operator manager so that DRA Modules
are actively reconciled when the manager runs in a cluster. This adds the scheme
registration, RBAC permissions, reconciler construction, and DRA module count
metric to the existing metrics sweep.

Changes

  • cmd/manager/main.go:
    • Add resourcev1.AddToScheme(scheme) for the DRA resource API
    • Construct and register DRAReconciler via SetupWithManager
  • internal/controllers/dra_reconciler.go:
    • Add //+kubebuilder:rbac annotation for resource.k8s.io/deviceclasses
  • internal/metrics/metrics.go:
    • Add SetKMMDRANum method and kmm_dra_num gauge
  • internal/controllers/device_plugin_reconciler.go:
    • Count modules with spec.dra in the existing metrics sweep
  • config/rbac/role.yaml:
    • Regenerated with resource.k8s.io/deviceclasses rule (all CRUD verbs)

Testing

  • Unit tests: Extended the setKMMOMetrics DescribeTable with a dra bool parameter and a new "dra" entry. All 12 entries (including "altogether") pass.
  • Integration tests: N/A
  • Coverage: setKMMOMetrics function at 100% coverage; internal/controllers package at 89.9%

Acceptance Criteria

  • AC-1: resourcev1.AddToScheme(scheme) is called in cmd/manager/main.go
  • AC-2: DRAReconciler is constructed and registered via SetupWithManager(mgr) in cmd/manager/main.go
  • AC-3: ClusterRole manifest includes resource.k8s.io/deviceclasses verbs (get, list, watch, create, update, patch, delete)
  • AC-4: DRA module count is reported in existing metrics sweep
  • AC-5: All unit tests pass; no duplicate reconciler registration

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 16, 2026
@netlify

netlify Bot commented Jun 16, 2026

Copy link
Copy Markdown

Deploy Preview for kubernetes-sigs-kmm ready!

Name Link
🔨 Latest commit 61d35cd
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-kmm/deploys/6a325e3e16ec140008db0565
😎 Deploy Preview https://deploy-preview-1287--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 16, 2026
@codecov-commenter

codecov-commenter commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.46%. Comparing base (fa23a9b) to head (61d35cd).
⚠️ Report is 384 commits behind head on main.

Files with missing lines Patch % Lines
cmd/manager/main.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1287      +/-   ##
==========================================
- Coverage   79.09%   73.46%   -5.64%     
==========================================
  Files          51       67      +16     
  Lines        5109     4993     -116     
==========================================
- Hits         4041     3668     -373     
- Misses        882     1156     +274     
+ 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.

@TomerNewman TomerNewman force-pushed the MGMT-24472-register-dra-reconciler branch from beac291 to 7851a25 Compare June 16, 2026 15:11
@TomerNewman TomerNewman marked this pull request as ready for review June 16, 2026 15:13
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 16, 2026
@TomerNewman

Copy link
Copy Markdown
Collaborator Author

/uncc @mresvanis

@k8s-ci-robot k8s-ci-robot removed the request for review from mresvanis June 16, 2026 15:14
Comment thread cmd/manager/main.go Outdated
cmd.FatalError(setupLogger, err, "unable to create controller", "name", controllers.DevicePluginPodReconcilerName)
}

drac := controllers.NewDRAReconciler(client, nodeAPI, scheme)

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.

nit: lets do it the same way we do with NewDevicePluginPodReconciler, NewWorkerPodManager, etc'

Comment thread config/rbac/role.yaml
- list
- patch
- update
- watch

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.

do we need watch?

numModulesWithBuild := 0
numModulesWithSign := 0
numModulesWithDevicePlugin := 0
numModulesWithDRA := 0

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.

lets not mix apples and oranges: i think that metrics changes should be done in a different PR

@TomerNewman TomerNewman force-pushed the MGMT-24472-register-dra-reconciler branch from 7851a25 to 1eac8a5 Compare June 17, 2026 05:54
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 17, 2026
@TomerNewman

TomerNewman commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed all review comments @yevgeny-shnaidman :

  1. Inline construction — done, matches the NewDevicePluginPodReconciler pattern.
  2. Remove watch — removed watch and list from deviceclasses RBAC. The DRA reconciler only does get/create/update/patch/delete on DeviceClass; it never watches them.
  3. Metrics in separate PR — removed all metrics changes from this PR. Will add them in a follow-up.

@TomerNewman TomerNewman force-pushed the MGMT-24472-register-dra-reconciler branch from 1eac8a5 to 2af8954 Compare June 17, 2026 06:33
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 17, 2026
@yevgeny-shnaidman

Copy link
Copy Markdown
Contributor

@TomerNewman this note is probably not for this PR, but since DRAReconciler is creating the DeviceClass, it should also probably watch them and respond to their events

@TomerNewman

Copy link
Copy Markdown
Collaborator Author

@TomerNewman this note is probably not for this PR, but since DRAReconciler is creating the DeviceClass, it should also probably watch them and respond to their events

its in here
#1288

@TomerNewman TomerNewman force-pushed the MGMT-24472-register-dra-reconciler branch from 2af8954 to 9d682e6 Compare June 17, 2026 07:01
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 17, 2026
@TomerNewman

Copy link
Copy Markdown
Collaborator Author

/hold
lets wait for #1288

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 17, 2026
Wire the DRA reconciler into the operator manager:

- Add resourcev1.AddToScheme to register the DRA resource API
- Construct and register DRAReconciler via SetupWithManager
- Add RBAC annotation for resource.k8s.io/deviceclasses
- Add DRA module count to the existing metrics sweep
- Regenerate RBAC manifests and metrics mock
@TomerNewman

Copy link
Copy Markdown
Collaborator Author

/unhold
works locally, we can merge @yevgeny-shnaidman

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 17, 2026
@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 17, 2026
@TomerNewman

Copy link
Copy Markdown
Collaborator Author

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 17, 2026
@TomerNewman TomerNewman force-pushed the MGMT-24472-register-dra-reconciler branch from 9d682e6 to 61d35cd Compare June 17, 2026 08:43
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 17, 2026
@TomerNewman

Copy link
Copy Markdown
Collaborator Author

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 17, 2026
@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 17, 2026
@k8s-ci-robot k8s-ci-robot merged commit 40f1f16 into kubernetes-sigs:main Jun 17, 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/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants