Skip to content

fix: persist specialization state and update controller dependencies#1083

Merged
nephio-prow[bot] merged 1 commit into
nephio-project:mainfrom
pulkitvats2007-crypto:fix-specialization-and-network-resources
Apr 15, 2026
Merged

fix: persist specialization state and update controller dependencies#1083
nephio-prow[bot] merged 1 commit into
nephio-project:mainfrom
pulkitvats2007-crypto:fix-specialization-and-network-resources

Conversation

@pulkitvats2007-crypto
Copy link
Copy Markdown
Contributor

@pulkitvats2007-crypto pulkitvats2007-crypto commented Mar 29, 2026

Bug & Fix Summary

1. Critical State Loss in Generic Specializer

  • File: controllers/pkg/reconcilers/generic-specializer/reconciler.go
  • Function: Reconcile

Bug:
An early return (return ctrl.Result{}, nil) was triggered when a package reached the Ready state. This caused the reconciliation flow to exit before calling r.porchClient.Update(ctx, prr).

Impact:
All in-memory specialization data (e.g., IP allocations, VLAN assignments, and KRM function outputs) was never persisted to the API server. As a result:

  • Allocated resources were effectively “lost”
  • Backend systems experienced resource leaks
  • The controller entered repeated reconciliation loops because the package appeared unspecialized in persistent state

Fix:

  • Removed the premature return to ensure the final state is always persisted via Update
  • Fixed a log.Error(err, ...) call that could receive a nil error when handling missing Kptfile cases

2. Resource Mutation Loss in Network Reconciler

  • File: controllers/pkg/reconcilers/network/reconciler.go
  • Functions: getNewResources, applyInitialresources

Bug:
The Resources collection was being passed by value to helper functions. This resulted in mutations (e.g., res.AddNewResource(o)) being applied only to a local copy instead of the original collection.

Impact:
Newly generated network configurations were silently dropped before reaching the final APIApply stage, leading to incomplete or missing infrastructure setup.

Fix:

  • Updated function signatures to pass *resources.Resources (by pointer)
  • Ensured all mutations are applied to the shared collection and correctly persisted

3. Controller Manager Dependency Reversion

  • File: operators/nephio-controller-manager/go.mod

Issue:
The controllers/pkg dependency had been unintentionally downgraded to an older 2023 version, risking API incompatibility and regression of newer features.

Impact:

  • Potential mismatches between controller logic and dependency APIs
  • Increased risk of subtle runtime errors and unstable builds

Fix:

  • Restored dependency to v0.0.0-20250915052103-2af16ab1c9e2
  • Ran go mod tidy to ensure a clean and consistent module state

Final Impact

These changes restore correctness and reliability across the Nephio specialization pipeline:

  • Ensures all computed infrastructure state (IPs, VLANs, etc.) is persisted reliably
  • Prevents silent state loss and backend resource leaks
  • Guarantees network reconciler applies all generated configurations
  • Stabilizes dependency management and avoids unintended regressions

Overall, this PR fixes critical state-handling flaws and brings the reconciliation flow back to a consistent, production-safe state.


AI Tool Used

Gemini 1.5 Pro (Web Interface): Used for codebase analysis and understanding execution flow.

Signed-off-by: pulkitvats2007-crypto <pulkitvats2007@gmail.com>
@nephio-prow
Copy link
Copy Markdown
Contributor

nephio-prow Bot commented Mar 29, 2026

Hi @pulkitvats2007-crypto. Thanks for your PR.

I'm waiting for a nephio-project member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@efiacor
Copy link
Copy Markdown
Collaborator

efiacor commented Mar 30, 2026

/ok-to-test

@pulkitvats2007-crypto
Copy link
Copy Markdown
Contributor Author

/assign @liamfallon

Comment thread controllers/pkg/reconcilers/generic-specializer/reconciler.go
@liamfallon
Copy link
Copy Markdown
Member

Hi @pulkitvats2007-crypto, thanks for your contribution. If you have used any AI tools in preparation of your PR please declare so in the description, listing the AI tools used.

@pulkitvats2007-crypto
Copy link
Copy Markdown
Contributor Author

Hi @pulkitvats2007-crypto, thanks for your contribution. If you have used any AI tools in preparation of your PR please declare so in the description, listing the AI tools used.

Hi @liamfallon,

Thanks for the feedback! I have updated the PR description to declare the AI assistance as requested. I used the Gemini 1.5 Pro web interface to help analyze the codebase and understanding execution flow.

@nephio-prow nephio-prow Bot added the approved label Apr 15, 2026
@liamfallon
Copy link
Copy Markdown
Member

/approve
/lgtm

@nephio-prow
Copy link
Copy Markdown
Contributor

nephio-prow Bot commented Apr 15, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liamfallon

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

@nephio-prow nephio-prow Bot merged commit 96d44a6 into nephio-project:main Apr 15, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants