You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MINOR: replace positional string params in IsAccessGranted with typed structs
IsAccessGranted previously took seven positional string parameters
(fromGroup, fromKind, fromNamespace, toGroup, toKind, toNamespace, toName),
which the compiler cannot distinguish — an incorrectly ordered call site is
a silent bug waiting to happen.
Introduce GrantFrom{Group, Kind, Namespace} and GrantTo{Group, Kind,
Namespace, Name}, mirroring the From/To triples of the Gateway API spec.
IsAccessGranted now accepts these two structs, making each field explicit and
compiler-verified at every call site.
Move the key-building helpers onto the types themselves as methods:
- GrantFrom.ToKey() From
- GrantTo.ToKey() To
- GrantTo.wildcardKey() To (name-stripped variant for wildcard grant lookup)
Replace string concatenation in those methods with strings.Join.
Remove the now-redundant package-level ConvertTo/ConvertFrom functions.
Update all call sites: gateway_listener.go, route-rule.go,
tls-route-rule.go, and reference_grant_manager_test.go.
make removeReferenceGrantWithCheck private
The method was only ever called from within the tree package — once by
UpsertReferenceGrant (check=false) and once by RemoveReferenceGrant
(check=true). Exposing it as a public method leaked an implementation
detail and invited callers to pass the bool flag directly instead of
going through the two clearly-named entry points.
Rename to removeReferenceGrantWithCheck and update all internal call
sites and comments accordingly.
msg:=fmt.Sprintf("Secret reference %s/%s is not granted for listener in gateway %s/%s", nsName.Namespace, nsName.Name, treeGw.K8sResource.GetNamespace(), treeGw.K8sResource.GetName())
0 commit comments