-
Notifications
You must be signed in to change notification settings - Fork 1k
Document secure Kserve authentication via automated tests #3056
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
Document secure Kserve authentication via automated tests #3056
Conversation
PS: okay i will look into the failed CI/CD runs, fixing them |
/retest |
#3062 is merged, so you can just rebase to master and have way less complexity |
Signed-off-by: juliusvonkohout <45896133+juliusvonkohout@users.noreply.github.com>
This change applies oauth2-proxy authentication to the cluster-local-gateway, ensuring KServe inference endpoints require proper authentication. Also adds a predictor-specific AuthorizationPolicy for test workflows. Fixes kubeflow#2811 Signed-off-by: madmecodes <ayushguptadev1@gmail.com>
…dd wait steps Signed-off-by: madmecodes <ayushguptadev1@gmail.com>
1aea113
to
6813561
Compare
Signed-off-by: madmecodes <ayushguptadev1@gmail.com>
The Profile CRD needs to be installed via multi-tenancy components before attempting to create a user profile. This ensures the kubeflow-user-example-com namespace is properly created for tests. Signed-off-by: madmecodes <ayushguptadev1@gmail.com>
Signed-off-by: madmecodes <ayushguptadev1@gmail.com>
if KF-Profile is before KF-multi-tenancy common/kubeflow-namespace/base creates kubeflow namespace If KF-profile is after Multi Tenancy ![]() ![]() @juliusvonkohout Could you please review the installation order, and guide a bit, still facing the namespace issue. |
Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
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.
@akagami-harsh can you cross check whether this file is auto generated?
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.
The gateway-authorizationpolicy.yaml
file appears to be a manually created file that doesn't change when running the synchronize-istio-manifests.sh
script.
… in cluster-local-gateway Signed-off-by: madmecodes <ayushguptadev1@gmail.com>
Signed-off-by: madmecodes <ayushguptadev1@gmail.com>
Signed-off-by: madmecodes <ayushguptadev1@gmail.com>
Signed-off-by: madmecodes <ayushguptadev1@gmail.com>
working on Auth Policy, so that unwanted namespace get access denied PS: found |
Signed-off-by: madmecodes <ayushguptadev1@gmail.com>
Signed-off-by: madmecodes <ayushguptadev1@gmail.com>
@juliusvonkohout Currently Auth Policy is allowing access to models, via any namespace, if it has a valid JWT we need to change it to so that only specified namespaces in AuthPolicy can access them, am i thinking in the right direction? i am testing it locally, when its too strict, it forbids all if too permissive, allows all (with valid JWT), working on a middle path, am i working on right problem? ![]() ![]() |
Yes, that is what we want. Only mebers/serviceaccounts of the same namespace should be able to access it. Maybe you can work with the allowing the default-editor, default and default-viewer serviceaccount of the same namespace as principals in the authorizationpolicy. |
Signed-off-by: madmecodes <ayushguptadev1@gmail.com>
Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Let me do some changes, merge the PR and then you can create a follow-up PR for the remaining stuff @madmecodes
|
yes, i am working on this only, facing some problems, troubleshooting them, i will create a follow up PR for these 3 things as mentioned once the PR is merged.
|
Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: juliusvonkohout The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Please make sure that you rebase to master before you create the new branch / PR. |
In the follow up PR you can either remove or secure the cluster-local-gateway. Whatever works for kserve and keeps all security tests green. |
) * update the kserve tests Signed-off-by: juliusvonkohout <45896133+juliusvonkohout@users.noreply.github.com> * Secure KServe endpoints with oauth2-proxy authentication This change applies oauth2-proxy authentication to the cluster-local-gateway, ensuring KServe inference endpoints require proper authentication. Also adds a predictor-specific AuthorizationPolicy for test workflows. Fixes kubeflow#2811 Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Fix KServe workflows: use consistent paths, namespace handling, and add wait steps Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Fix Fix KServe auth workflow by ordering components correctly Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Fix order of KF Profile creation after multi-tenancy installation The Profile CRD needs to be installed via multi-tenancy components before attempting to create a user profile. This ensures the kubeflow-user-example-com namespace is properly created for tests. Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * test: namespace manual creation Update kserve_m2m_test.yaml workflow Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update requirements.txt Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * update: attempt to Enable secure KServe inferencing with oauth2-proxy authentication Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * enable istio-cni Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update dex_oauth2-proxy_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Delete tests/gh-actions/deploy-dex-login-environment/kustomization.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update dex_oauth2-proxy_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update dex_oauth2-proxy_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update dex_oauth2-proxy_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update centraldashboard_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update: Istio-cni-1-24 authorizationpolicy to use custom oauth2-proxy in cluster-local-gateway Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: kserve_m2m_test.yaml attacker namespace test Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: KServe AuthorizationPolicy Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: using old KServe AuthorizationPolicy Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: Kserve Auth policy namespace access Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: fix the label in Auth Policy Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: test, kserve_m2m_test using principals not namespaces Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> --------- Signed-off-by: juliusvonkohout <45896133+juliusvonkohout@users.noreply.github.com> Signed-off-by: madmecodes <ayushguptadev1@gmail.com> Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> Co-authored-by: juliusvonkohout <45896133+juliusvonkohout@users.noreply.github.com>
) * update the kserve tests Signed-off-by: juliusvonkohout <45896133+juliusvonkohout@users.noreply.github.com> * Secure KServe endpoints with oauth2-proxy authentication This change applies oauth2-proxy authentication to the cluster-local-gateway, ensuring KServe inference endpoints require proper authentication. Also adds a predictor-specific AuthorizationPolicy for test workflows. Fixes kubeflow#2811 Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Fix KServe workflows: use consistent paths, namespace handling, and add wait steps Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Fix Fix KServe auth workflow by ordering components correctly Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Fix order of KF Profile creation after multi-tenancy installation The Profile CRD needs to be installed via multi-tenancy components before attempting to create a user profile. This ensures the kubeflow-user-example-com namespace is properly created for tests. Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * test: namespace manual creation Update kserve_m2m_test.yaml workflow Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update requirements.txt Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * update: attempt to Enable secure KServe inferencing with oauth2-proxy authentication Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * enable istio-cni Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update dex_oauth2-proxy_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Delete tests/gh-actions/deploy-dex-login-environment/kustomization.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update dex_oauth2-proxy_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update dex_oauth2-proxy_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update dex_oauth2-proxy_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update centraldashboard_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update: Istio-cni-1-24 authorizationpolicy to use custom oauth2-proxy in cluster-local-gateway Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: kserve_m2m_test.yaml attacker namespace test Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: KServe AuthorizationPolicy Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: using old KServe AuthorizationPolicy Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: Kserve Auth policy namespace access Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: fix the label in Auth Policy Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: test, kserve_m2m_test using principals not namespaces Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> --------- Signed-off-by: juliusvonkohout <45896133+juliusvonkohout@users.noreply.github.com> Signed-off-by: madmecodes <ayushguptadev1@gmail.com> Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> Co-authored-by: juliusvonkohout <45896133+juliusvonkohout@users.noreply.github.com> Signed-off-by: kunal-511 <yoyokvunal@gmail.com>
) * update the kserve tests Signed-off-by: juliusvonkohout <45896133+juliusvonkohout@users.noreply.github.com> * Secure KServe endpoints with oauth2-proxy authentication This change applies oauth2-proxy authentication to the cluster-local-gateway, ensuring KServe inference endpoints require proper authentication. Also adds a predictor-specific AuthorizationPolicy for test workflows. Fixes kubeflow#2811 Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Fix KServe workflows: use consistent paths, namespace handling, and add wait steps Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Fix Fix KServe auth workflow by ordering components correctly Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Fix order of KF Profile creation after multi-tenancy installation The Profile CRD needs to be installed via multi-tenancy components before attempting to create a user profile. This ensures the kubeflow-user-example-com namespace is properly created for tests. Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * test: namespace manual creation Update kserve_m2m_test.yaml workflow Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update requirements.txt Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * update: attempt to Enable secure KServe inferencing with oauth2-proxy authentication Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * enable istio-cni Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update dex_oauth2-proxy_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Delete tests/gh-actions/deploy-dex-login-environment/kustomization.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update dex_oauth2-proxy_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update dex_oauth2-proxy_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update dex_oauth2-proxy_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update centraldashboard_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update: Istio-cni-1-24 authorizationpolicy to use custom oauth2-proxy in cluster-local-gateway Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: kserve_m2m_test.yaml attacker namespace test Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: KServe AuthorizationPolicy Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: using old KServe AuthorizationPolicy Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: Kserve Auth policy namespace access Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: fix the label in Auth Policy Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update: test, kserve_m2m_test using principals not namespaces Signed-off-by: madmecodes <ayushguptadev1@gmail.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> * Update kserve_m2m_test.yaml Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> --------- Signed-off-by: juliusvonkohout <45896133+juliusvonkohout@users.noreply.github.com> Signed-off-by: madmecodes <ayushguptadev1@gmail.com> Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com> Co-authored-by: juliusvonkohout <45896133+juliusvonkohout@users.noreply.github.com> Signed-off-by: kunal-511 <yoyokvunal@gmail.com>
Pull Request Template for Kubeflow Manifests
✏️ Summary of Changes
This PR addresses a security issue with KServe inference endpoints by applying oauth2-proxy authentication to the cluster-local-gateway. Currently, KServe endpoints lack proper authentication because they use the cluster-local-gateway which has an
ALLOW
policy instead of proper oauth2-proxy authentication.Changes include:
This ensures KServe inference endpoints are properly secured and require authentication, just like other Kubeflow services accessed through the istio-ingressgateway.
📦 Dependencies
No direct dependencies on other PRs. This PR combines improvements that were planned for PR #2936 with the security fix.
🐛 Related Issues
✅ Contributor Checklist