-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: KServe InferenceGraph auth configurations (#1491)
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
1 parent
524e4c2
commit 4685177
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...mponents/kserve/resources/servicemesh/kserve-inferencegraph-authorizationpolicy.tmpl.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
43 changes: 43 additions & 0 deletions
43
...llers/components/kserve/resources/servicemesh/kserve-inferencegraph-envoyfilter.tmpl.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |