agent-substrate / agent-substrate/substrate

EgressRules has situations where strict ordering is a problem

未关闭
#1,585 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
area/api area/network kind/design
主要语言
Go
星标
1.8k
派生
316
平均合并
2 天 43 分钟
30 天内合并 PR
287

描述

### Problem

Mixing of ip\_block and hostname-based rules based on ordering forces the implementation to handle all of the evaluation in a single place, but this might not be possible/efficient: commonly IPs are known and evaluated at lower layers vs hostname, which is an L7 (e.g. HTTP) property.

Imagine we have an egress policy:

```
"egress_policy": {
"metadata": {"atespace": "default", "name": "default"},
"rules": [
{ # a range covering api.github.com
"ip_blocks": { "cidrs": ["140.82.112.0/20"] }
},
{
"hostnames": {
"patterns": ["api.github.com"],
"effects": { ... }
}
]
}
```

Currently, the rule evaluation order is:
```
// Rules are evaluated in order. The first matching rule authorizes the
// request, only that rule's effects are applied, and evaluation stops even if
// later rules would also match. A request is denied when no rule matches.
//
// +k8s:optional
// +k8s:maxItems=256
// +k8s:listType=atomic # rule order matters
repeated EgressRule rules = 2;
```

This suggests that the `hostname` rule will not be evaluated.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。