CLB 2nd PR: Add DiffTracker core types, state management, and sync operations#10068
Conversation
1. Removing NSG code for now 2. Remove unused scaffold code 3. Added context based logger
1. Removing NSG code for now 2. Remove unused scaffold code 3. Added context based logger
Introduces the difftracker package with core K8s/NRP state tracking, diff computation, and state mutation logic. Includes comprehensive test coverage (25+ test functions).
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions 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-sigs/prow repository. |
|
Hi @georgeedward2000. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: georgeedward2000 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR introduces the DiffTracker core package — the foundational types, state management, and diff computation logic for the Container Load Balancer (CLB) feature.
The DiffTracker maintains two parallel state representations:
It provides operations to mutate both states and compute the diff between them, determining what needs to be synced to Azure.
Package contents (
pkg/provider/difftracker/):types.goOperation,UpdateAction,SyncStatus), K8s/NRP state model types,DiffTrackerstruct, input types, sync result typesconfig.goConfigstruct with Azure subscription, resource group, location, and ServiceGateway fieldsdifftracker.goInitializeDiffTracker()constructor with validationk8s_state_updates.gonrp_state_updates.gosync_operations.goGetSyncOperations,GetSyncLoadBalancerServices,GetSyncNRPNATGateways,GetSyncLocationsAddresses)util.goDeepEqual,Equalscomparison methodsDependency changes (
pkg/util/sets/string.go):Equals()method toIgnoreCaseSetfor set comparisonMarshalJSON()method toIgnoreCaseSetfor JSON serializationTest coverage:
difftracker_test.go— 14 test functions covering initialization, state updates, sync operations, and end-to-end scenariosutil_test.go— 11 test functions covering enum serialization, JSON round-trips,HasPods/HasIdentitieshelpers,DeepEqual,Equals, andConfig.Validate()string_test.go— AddedTestEquals(8 sub-tests) for the newIgnoreCaseSet.Equals()methodThis is PR 2 in the CLB series, building on the configuration and constants from PR 1 (#9775). Engine-layer code (async processing, updaters, finalizers, metrics, Azure operations) and ServiceGateway API DTOs/mappers are intentionally excluded and will follow in subsequent PRs.
Which issue(s) this PR fixes:
Part of CLB (Container Load Balancer) feature implementation.
Special notes for your reviewer:
isServiceReady()function currently checks NRP state only. In the engine PR (PR 3), it will be extended to also checkpendingServiceOpsforStateCreatedstatus.DEFERRED_CODE_TRACKER.mdis maintained in the source repo tracking what was excluded and which future PR will add it back.Does this PR introduce a user-facing change?