cleanup: remove use of deprecated Go APIs #4791
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.45) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 424 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.362
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #4791"
general
weight: 0.35
markmandel
What type of PR is this?
/kind cleanup
What this PR does / Why we need it:
Removes our use of deprecated Go APIs.
staticcheck's SA1019, which reports deprecated APIs, was already enabled through
checks: [all]in.golangci.yml.//nolint:staticcheckdirectives hid some deprecated calls, and SA1019 missed others entirely. Upstream doc comments that putDeprecated:on the line right after the summary, instead of in its own paragraph, aren't recognised as deprecations, so SA1019 can't see them. This PR:-
grpc.DialContext+WithBlock→grpc.NewClient, plus a wait-for-ready loop in the Go SDK.NewSDKstill blocks until connected and still times out after 30s.-
workqueue.NewNamedRateLimitingQueue→NewTypedRateLimitingQueueWithConfig-
intstr.FromInt→FromInt32-
field.TooLongMaxLength→field.TooLong-
integer.IntMin→ theminbuiltin-
intstr.GetValueFromIntOrPercent→GetScaledValueFromIntOrPercent(see the breaking change below)// SA1019: <reason>explanation. These are the backward-compatibleRequired/Preferredallocation fields.defer reader.Close()inlocalsdk.gothat ran before theos.Openerror check (SA5001). Astaticchecksuppression on that line was hiding it..golangci.ymlthatallalready includes SA1019.Which issue(s) this PR fixes:
N/A
Did you use AI tools in preparing this PR?:
Y
Special notes for your reviewer:
:warning: Breaking change: Fleet
maxSurge/maxUnavailablepercentages now require a trailing%.Fleet
spec.strategy.rollingUpdate.maxSurgeandmaxUnavailableused to be parsed with the deprecatedintstr.GetValueFromIntOrPercent. That function reads any string as a percentage, somaxSurge: "25"was silently treated as25%. These fields now useintstr.GetScaledValueFromIntOrPercent, which rejects a numeric string without a trailing%."25"formaxSurge/maxUnavailable. Fleet'sstrategyisappsv1.DeploymentStrategy, and its API reference already describes the value as "an absolute number (ex: 5) or a percentage of desired pods (ex: 10%)".%-less form was never documented. Every example and reference undersite/uses25%.bufferSizealready works this way. Its validation has usedGetScaledValueFromIntOrPercentfor some time."25". A Fleet already stored* with"25"isn't re-validated, so its rolling updates will fail in the Fleet controller with an "error parsing MaxSurge/MaxUnavailable value" error until the value is changed to"25%". This needs to be in the release notes.Other notes:
ClientConn.Connect(), which grpc-go marks experimental but documents as the replacement forWithBlock.NewClientalso uses thednsresolver by default, whereDialContextusedpassthrough.examples/allocation-endpoint/serverstill usesgrpc.DialContext. The examples are separate Go modules thatgolangci-lint run ./examples/...doesn't actually lint, and changing one means bumping its image version, so it's left for a follow-up.