Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jacobweinstock
Copy link
Member

Description

This allows individual Hardware objects to opt out of Auto Enrollment, creating Workflows. This doesn't affect the manual creation of Workflows. Manual creation of Workflows is unaffected by the field.

This allows Agents with Hardware.Spec.Auto.EnrollmentEnabled=false to be running and waiting for a Workflow to be created without Auto Enrollment creating a Workflow. This enables Agents to be waiting and run Workflows quickly when one is manually created.

This field defaults to false. This should make it a seamless upgrade.

Why is this needed

Fixes: #

How Has This Been Tested?

How are existing users impacted? What migration steps/scripts do we need?

Checklist:

I have:

  • updated the documentation and/or roadmap (if required)
  • added unit or e2e tests
  • provided instructions on how to upgrade

@codecov
Copy link

codecov bot commented Jun 30, 2025

Codecov Report

Attention: Patch coverage is 43.33333% with 34 lines in your changes missing coverage. Please review.

Project coverage is 48.14%. Comparing base (7b8ab45) to head (9b7b4e3).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
tink/server/internal/grpc/grpc.go 20.00% 10 Missing and 2 partials ⚠️
tink/server/server.go 0.00% 11 Missing ⚠️
tink/server/internal/grpc/enrollment.go 33.33% 4 Missing and 2 partials ⚠️
tink/server/internal/grpc/hardware.go 73.68% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #230      +/-   ##
==========================================
- Coverage   48.18%   48.14%   -0.05%     
==========================================
  Files         101      102       +1     
  Lines        8596     8622      +26     
==========================================
+ Hits         4142     4151       +9     
- Misses       4201     4213      +12     
- Partials      253      258       +5     

☔ View full report in Codecov by Sentry.
📢 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.

@jacobweinstock jacobweinstock changed the title Add Hardware.Spec.Auto.EnrollmentEnabled: Enable/Disable Auto Enrollment per Hardware Jun 30, 2025
@jacobweinstock jacobweinstock changed the title Enable/Disable Auto Enrollment per Hardware Enable/Disable Auto Enrollment per Hardware Jun 30, 2025
@jacobweinstock jacobweinstock requested a review from Copilot June 30, 2025 14:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements the ability for individual Hardware objects to opt out of auto enrollment by restructuring the auto enrollment and discovery configuration. Key changes include:

  • Refactoring the configuration into an AutoCapabilities structure with separate Enrollment and Discovery sections.
  • Updating functional options, flags, and backend registration to support the new auto enrollment logic.
  • Adding corresponding documentation changes and CRD updates to reflect the new configuration fields.

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tink/server/server.go Refactored auto enrollment/discovery configuration into nested structs.
tink/server/internal/grpc/grpc.go Updated GetAction and doGetAction functions to use the new options struct.
tink/server/internal/grpc/enrollment.go Modified enrollment logic to enforce hardware auto enrollment settings.
tink/server/internal/grpc/discovery.go Adjusted hardware lookup and creation logic to use the new interface.
helm/tinkerbell/values.yaml and templates Updated Helm configuration for auto enrollment/discovery options.
docs/technical/AUTO_ENROLLMENT.md & AUTO_DISCOVERY.md Revised documentation to describe new configuration options.
crd/bases/tinkerbell.org_hardware.yaml Added CRD definitions for the new auto configuration.
cmd/tinkerbell/flag/tink_server.go Registered new flags for auto enrollment/discovery.
api/v1alpha1/... Updated API types and deepcopy functions for the auto configuration.
Comments suppressed due to low confidence (2)

tink/server/internal/grpc/grpc.go:78

  • Changing the opts parameter from a pointer to a value removes the nil check; ensure that every call to doGetAction always provides a fully initialized options struct to avoid potential nil pointer issues.
func (h *Handler) doGetAction(ctx context.Context, req *proto.ActionRequest, opts options) (*proto.ActionResponse, error) {

tink/server/internal/grpc/discovery.go:41

  • The explicit check for multiple Hardware objects (via foundMultipleHardware) was removed; verify that handling multiple hardware errors through apierrors.IsNotFound(err) is sufficient for the intended behavior.
	if !apierrors.IsNotFound(err) {

This allows individual Hardware objects to
opt out of Auto Enrollment creating Workflows.
This doesn't affect manual creation of Workflow.
Manual creation of Workflows are unaffected by the
field.

This allows Agents with Hardware.Spec.Auto.EnrollmentEnabled=false
to be running and waiting for a Workflow to be created without
Auto Enrollment creating a Workflow. This enables
Agents to be waiting and run Workflows quickly when
one is manually created.

Signed-off-by: Jacob Weinstock <[email protected]>
@jacobweinstock jacobweinstock force-pushed the per-hw-auto-enroll-disable branch from c18130f to 3faa304 Compare June 30, 2025 17:49
Signed-off-by: Jacob Weinstock <[email protected]>
@jacobweinstock jacobweinstock added the ready-to-merge Signal Mergify to merge the PR label Jun 30, 2025
@mergify mergify bot merged commit 656efb0 into tinkerbell:main Jun 30, 2025
13 checks passed
@jacobweinstock jacobweinstock deleted the per-hw-auto-enroll-disable branch June 30, 2025 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Signal Mergify to merge the PR tink-server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant