Skip to content
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

feat: KServe InferenceGraph auth configurations #1483

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: security.istio.io/v1beta1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind: AuthorizationPolicy
metadata:
name: kserve-inferencegraph
namespace: {{ .ControlPlane.Namespace }}
labels:
app.opendatahub.io/kserve: "true"
app.kubernetes.io/part-of: kserve
spec:
action: CUSTOM
provider:
name: {{ .AuthExtensionName }}
rules:
- to:
- operation:
notPaths:
- /healthz
- /debug/pprof/
- /metrics
- /wait-for-drain
selector:
matchLabels:
serving.kserve.io/kind: InferenceGraph
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: networking.istio.io/v1alpha3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind: EnvoyFilter
metadata:
name: kserve-inferencegraph-host-header
namespace: {{ .ControlPlane.Namespace }}
labels:
app.opendatahub.io/kserve: "true"
app.kubernetes.io/part-of: kserve
spec:
priority: 20
workloadSelector:
labels:
serving.kserve.io/kind: InferenceGraph
configPatches:
- applyTo: HTTP_FILTER
match:
listener:
filterChain:
filter:
name: envoy.filters.network.http_connection_manager
patch:
operation: INSERT_BEFORE
value:
name: envoy.filters.http.lua
typed_config:
'@type': type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
inlineCode: |
function envoy_on_request(request_handle)
local headers = request_handle:headers()
if not headers then
return
end

local original_host = headers:get("k-original-host")
if original_host then

port_seperator = string.find(original_host, ":", 7)
if port_seperator then
original_host = string.sub(original_host, 0, port_seperator-1)
end
headers:replace('host', original_host)
end
end
2 changes: 2 additions & 0 deletions components/kserve/servicemesh_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ func (k *Kserve) defineServiceMeshFeatures(ctx context.Context, cli client.Clien
path.Join(Resources.ServiceMeshDir, "activator-envoyfilter.tmpl.yaml"),
path.Join(Resources.ServiceMeshDir, "envoy-oauth-temp-fix.tmpl.yaml"),
path.Join(Resources.ServiceMeshDir, "kserve-predictor-authorizationpolicy.tmpl.yaml"),
path.Join(Resources.ServiceMeshDir, "kserve-inferencegraph-envoyfilter.tmpl.yaml"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path.Join(Resources.ServiceMeshDir, "kserve-inferencegraph-authorizationpolicy.tmpl.yaml"),
path.Join(Resources.ServiceMeshDir, "z-migrations"),
),
).
Expand Down
Loading