-
Notifications
You must be signed in to change notification settings - Fork 102
feat(allowlist): support both v1 and v1alpha2 InferencePool APIs with flag #474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
pierDipi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
pkg/sidecar/proxy/allowlist.go
Outdated
| if errors.IsNotFound(err) { | ||
| return false, nil // GroupVersion not supported | ||
| } | ||
| return false, fmt.Errorf("failed to discover resources for %s: %w", gvr.GroupVersion(), err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: as the function is generic and doesn't necessarily assume InfPool resource
| return false, fmt.Errorf("failed to discover resources for %s: %w", gvr.GroupVersion(), err) | |
| return false, fmt.Errorf("failed to discover resources for %s: %w", gvr.String(), err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
70ebbf1 to
cf90c1e
Compare
|
@googs1025 If I understand this PR correctly, it is trying to figure which version of the InferencePool CRD is installed. What happens if both CRDs are installed? I believe |
@shmuelk thanks for feed back. This PR handles that scenario explicitly by using a prioritized candidate list: var candidateGVRs = []schema.GroupVersionResource{
{Group: "inference.networking.k8s.io", Version: "v1", Resource: inferencePoolResource}, // ← Preferred
{Group: "inference.networking.x-k8s.io", Version: "v1alpha2", Resource: inferencePoolResource}, // ← Fallback
}This logic use this list in order and picks the first GVR that is supported by the cluster. So if both CRDs exist, it will always prefer v1 API (inference.networking.k8s.io/v1) and only fall back to v1alpha2 if v1 is not present. This matches the behavior of upstream components like the Ingress Gateway (IGW), which also support both versions but prioritize the stable one. |
5da9581 to
5403cbf
Compare
pkg/sidecar/proxy/allowlist.go
Outdated
| // | ||
| // This approach aligns with upstream Ingress Gateway (IGW) behavior, which also supports | ||
| // both API versions concurrently (see issue #462). | ||
| var candidateGVRs = []schema.GroupVersionResource{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isGVRSupported() is generic function, should candidateGVRs be more specific as it is only on inferencepools for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to inferencePoolGVRCandidates
5403cbf to
24df901
Compare
|
/lgtm |
|
Cannot apply the lgtm label because Error: zdtsw is not included in the reviewers role in the OWNERS file |
| Resource: inferencePoolResource, | ||
| } | ||
| av.logger.Info("starting SSRF protection allowlist validator", | ||
| "namespace", av.namespace, "poolName", av.poolName, "gvr", av.gvr.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
av.gvr is never set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh... my bad. done
|
@googs1025 Thank you for your continued efforts on this PR. I added an additional comment on the code as it seemed that something was missing in the code. Additionally, I have an issue with the overall design of the code. You check what CRDs are installed. If the InferencePool V1 CRD is installed, you watch on V1 InferencePool objects. If that CRD isn't installed, you will watch on v1alpha2 InferencePool objects. Bottom line you watch on one of the two possible types. The problem is in the case where the user has both CRDs installed and for a variety of reasons is still using the v1alpha2 version of the InferencePool. I see two possible solutions:
|
24df901 to
29a9d31
Compare
thanks for this great feed back 😄 this make more sense to me. We should align with GIE upstream.
|
29a9d31 to
a6ceb58
Compare
|
@googs1025 This looks much better. You have a lint failure. Please add a comment for the exported field. |
… auto-discovery Signed-off-by: CYJiang <googs1025@gmail.com>
a6ceb58 to
2a65147
Compare
|
/lgtm |
add new
pool-groupflag to choose which inferencepool to supportfix: #462