Classify using token prefix
For gitlab-org/gitlab#465432 (closed)
The changes in this MR supports
-
renames the attribute named
session_prefix
in config.toml to justprefix
, because "session_prefix" is too specific. We would use the same prefix to classify a cell, whether that data originates from session or a token, so it made sense to just use "prefix" as the attribute name. -
classification using a token's prefix.
- A token's prefix matches a cell's
prefix
attribute specified in the configuration, so we match this value (which HTTP router would pass to TS) in the request to theprefix
attributes in the TS's configuration to find the right cell to route the request to.
- A token's prefix matches a cell's
With a valid cell name
curl --cacert tmp/certs/ca-cert.pem --cert tmp/certs/client-cert.pem --key tmp/certs/client-key.pem -X POST https://localhost:9096/v1/classify -H "Content-Type: application/json" -d '{"type": "TokenPrefix", "value": "cell-1"}'
{"action":"Proxy","proxy":{"address":"my.cell-1.example.com"}}
With an invalid cell name
curl --cacert tmp/certs/ca-cert.pem --cert tmp/certs/client-cert.pem --key tmp/certs/client-key.pem -X POST https://localhost:9096/v1/classify -H "Content-Type: application/json" -d '{"type": "TokenPrefix", "value": "junk_value"}'
{"code":5,"message":"cell not found: \"junk_value\"","details":[]}
Edited by Manoj M J