Skip to content

fix(worker-slice-config): propagate copier error instead of returning empty spec (#372)#376

Open
Elvand-Lie wants to merge 1 commit into
kubeslice:masterfrom
Elvand-Lie:fix/copier-error-propagation
Open

fix(worker-slice-config): propagate copier error instead of returning empty spec (#372)#376
Elvand-Lie wants to merge 1 commit into
kubeslice:masterfrom
Elvand-Lie:fix/copier-error-propagation

Conversation

@Elvand-Lie

Copy link
Copy Markdown

Description

copySpecFromSliceConfigToWorkerSlice in service/worker_slice_config_service.go (lines 687-694) uses copier.Copy to deep-copy the SliceConfig spec into a WorkerSliceConfig. If the copy fails, the function silently returns an empty WorkerSliceConfig{} with a zeroed spec. The caller then overwrites the existing worker slice config with this empty spec and pushes it to the API server, effectively wiping all slice configuration (SliceSubnet, QoS profile, NamespaceIsolationProfile, etc.).

Changes:

  • service/worker_slice_config_service.go: Change copySpecFromSliceConfigToWorkerSlice return type to (WorkerSliceConfig, error) and wrap the copier error
  • Update the caller in ReconcileWorkerSliceConfig to check the error and abort reconciliation on failure

The reconciler now returns the error to controller-runtime for requeue with exponential backoff, leaving the existing WorkerSliceConfig intact.

Fixes #372

How Has This Been Tested?

  • go build ./... passes
  • Manual code review: the error path now aborts reconciliation instead of pushing an empty spec

Checklist:

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR requires documentation updates?
  • I've updated documentation as required by this PR.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have tested it for all user roles.
  • I have added all the required unit test cases.

Does this PR introduce a breaking change for other components like worker-operator?

No. This only affects internal error handling in the WorkerSliceConfig reconciler. No APIs, CRDs, or external interfaces are changed. The behavioral change is that a copier failure now triggers a requeue (correct behavior) instead of silently wiping the worker's slice configuration (incorrect behavior).


… empty spec (kubeslice#372)

Signed-off-by: Elvand-Lie <elvandlie@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: copySpecFromSliceConfigToWorkerSlice silently returns empty spec on copier failure

1 participant