Skip to content

Commit 62a4fea

Browse files
committed
add some comments
1 parent 8cbb808 commit 62a4fea

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

helm/supersonic/cfg/envoy-filter-dynamic.lua

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ function envoy_on_request(request_handle)
1212
local msg = body:sub(6)
1313

1414
-- protobuf wire format for field 1, wire type 2: tag = 0x0A
15+
-- field 1 is the model name - we know it from here:
16+
-- https://github.com/kserve/open-inference-protocol/blob/main/specification/protocol/inference_grpc.md#inference
17+
-- wire type 2 means that the field is length-delimited
1518
if msg:byte(1) == 0x0A then
1619
-- next byte is a varint length (assumes <128 bytes)
1720
local name_len = msg:byte(2)
@@ -23,11 +26,12 @@ function envoy_on_request(request_handle)
2326
if model_name then
2427
local hostHeader = model_name .. ".NAMESPACE.svc.cluster.local:8001"
2528
request_handle:logInfo("route-to = " .. hostHeader)
29+
-- add header
2630
request_handle:headers():add("route-to", hostHeader)
2731
end
28-
for k, v in pairs(request_handle:headers()) do
29-
request_handle:logInfo("Header " .. k .. ": " .. v)
30-
end
32+
-- for k, v in pairs(request_handle:headers()) do
33+
-- request_handle:logInfo("Header " .. k .. ": " .. v)
34+
-- end
3135
else
3236
request_handle:logErr("Unexpected protobuf tag: " .. string.format("0x%02X", msg:byte(1)))
3337
end

0 commit comments

Comments
 (0)