Skip to content

Commit

Permalink
feat: KServe InferenceGraph auth configurations (#1491)
Browse files Browse the repository at this point in the history
This adds resources required to support auth for KServe InferenceGraphs.

Signed-off-by: Edgar Hernández <23639005+israel-hdez@users.noreply.github.com>
  • Loading branch information
israel-hdez authored Jan 10, 2025
1 parent 524e4c2 commit 4685177
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
2 changes: 2 additions & 0 deletions controllers/components/kserve/kserve_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ func defineServiceMeshFeatures(ctx context.Context, cli client.Client, dscispec
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"),
path.Join(Resources.ServiceMeshDir, "kserve-inferencegraph-authorizationpolicy.tmpl.yaml"),
),
).
Managed().
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: security.istio.io/v1beta1
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
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

0 comments on commit 4685177

Please sign in to comment.