higress icon indicating copy to clipboard operation
higress copied to clipboard

e2e: cover all higress extending abilities of annotations cases

Open Xunzhuo opened this issue 2 years ago • 2 comments

Why do you need it?

Cover all nginx.ingress.kubernetes.io and higress.io annotations cases.

How could it be?

流量治理

灰度发布

注解 作用域 支持度 Issues 说明
nginx.ingress.kubernetes.io/canary Ingress 兼容 https://github.com/alibaba/higress/issues/166 开启或关闭灰度发布
nginx.ingress.kubernetes.io/canary-by-header Ingress 兼容 https://github.com/alibaba/higress/issues/166 基于Request Header Key 流量切分
nginx.ingress.kubernetes.io/canary-by-header-value Ingress 兼容 https://github.com/alibaba/higress/issues/166 基于Request Header Value 流量切分,Value为精确匹配
nginx.ingress.kubernetes.io/canary-by-header-pattern Ingress 兼容 https://github.com/alibaba/higress/issues/166 基于Request Header Value 流量切分,Value为正则匹配
nginx.ingress.kubernetes.io/canary-by-cookie Ingress 兼容 https://github.com/alibaba/higress/issues/166 基于Request Cookie Key 流量切分
nginx.ingress.kubernetes.io/canary-weight Ingress 兼容 https://github.com/alibaba/higress/issues/166 基于权重 流量切分
nginx.ingress.kubernetes.io/canary-weight-total Ingress 兼容 https://github.com/alibaba/higress/issues/166 权重总和

Fallback(容灾)

注解 作用域 支持度 Issues 说明
nginx.ingress.kubernetes.io/default-backend Ingress 兼容 https://github.com/alibaba/higress/issues/193 容灾服务。当Ingress定义的服务没有可用节点时,请求会自动转发该容灾服务。
nginx.ingress.kubernetes.io/custom-http-errors Ingress 兼容 https://github.com/alibaba/higress/issues/193 该注解和default-backend一起工作。当后端服务返回指定HTTP响应码,原始请求会被再次转发至容灾服务。
> 注意:转发至容灾服务时,请求的Path会被重写为/,该行为与ingress-nginx保持一致

重写

注解 作用域 支持度 Issues 说明
nginx.ingress.kubernetes.io/rewrite-target Ingress 兼容 https://github.com/alibaba/higress/issues/167 将Ingress定义的原path重写为指定目标,支持Group Capture.
nginx.ingress.kubernetes.io/upstream-vhost Ingress 兼容 https://github.com/alibaba/higress/issues/167 匹配Ingress定义的路由的请求在转发给后端服务时,修改头部host值为指定值。

重定向

注解 作用域 支持度 Issues 说明
nginx.ingress.kubernetes.io/ssl-redirect Ingress 兼容 https://github.com/alibaba/higress/issues/169 HTTP 重定向为HTTPS
nginx.ingress.kubernetes.io/force-ssl-redirect Ingress 兼容 https://github.com/alibaba/higress/issues/169 HTTP 重定向为HTTPS
nginx.ingress.kubernetes.io/permanent-redirect Ingress 兼容 https://github.com/alibaba/higress/issues/168 永久重定向
nginx.ingress.kubernetes.io/permanent-redirect-code Ingress 兼容 https://github.com/alibaba/higress/issues/168 永久重定向状态码
nginx.ingress.kubernetes.io/temporal-redirect Ingress 兼容 https://github.com/alibaba/higress/issues/168 临时重定向
nginx.ingress.kubernetes.io/app-root Ingress 兼容 https://github.com/alibaba/higress/issues/168 修改应用根路径,对于访问/的请求将会被重定向为设置的新路径

跨域

注解 作用域 支持度 Issues 说明
nginx.ingress.kubernetes.io/enable-cors Ingress 兼容 https://github.com/alibaba/higress/issues/171 开启或关闭跨域
nginx.ingress.kubernetes.io/cors-allow-origin Ingress 兼容 https://github.com/alibaba/higress/issues/171 允许的第三方站点
nginx.ingress.kubernetes.io/cors-allow-methods Ingress 兼容 https://github.com/alibaba/higress/issues/171 允许的请求方法,如GET、POST、PUT等
nginx.ingress.kubernetes.io/cors-allow-headers Ingress 兼容 https://github.com/alibaba/higress/issues/171 允许的请求Header
nginx.ingress.kubernetes.io/cors-expose-headers Ingress 兼容 https://github.com/alibaba/higress/issues/171 允许的暴露给浏览器的响应Header
nginx.ingress.kubernetes.io/cors-allow-credentials Ingress 兼容 https://github.com/alibaba/higress/issues/171 是否允许携带凭证信息
nginx.ingress.kubernetes.io/cors-max-age Ingress 兼容 https://github.com/alibaba/higress/issues/171 预检结果的最大缓存时间

重试

注解 作用域 支持度 Issues 说明
nginx.ingress.kubernetes.io/proxy-next-upstream-tries Ingress 兼容 https://github.com/alibaba/higress/issues/172 请求的最大重试次数。默认3次。
nginx.ingress.kubernetes.io/proxy-next-upstream-timeout Ingress 兼容 https://github.com/alibaba/higress/issues/172 请求重试的超时时间,单位秒。默认未配置超时时间。
nginx.ingress.kubernetes.io/proxy-next-upstream Ingress 兼容 https://github.com/alibaba/higress/issues/172 请求重试条件

后端服务使用的协议

注解 作用域 支持度 Issues 说明
nginx.ingress.kubernetes.io/backend-protocol 服务 部分兼容。不支持AJP和FCGI https://github.com/alibaba/higress/issues/194 指定后端服务使用的协议,默认为HTTP,支持HTTP、HTTP2、HTTPS、GRPC和GRPCS

负载均衡

注解 作用域 支持度 Issues 说明
nginx.ingress.kubernetes.io/load-balance 服务 部分兼容。不支持ewma算法 https://github.com/alibaba/higress/issues/195 后端服务的普通负载均衡算法。默认为round_robin。
合法值如下:
- round_robin:基于轮询的负载均衡。
- least_conn:基于最小请求数的负载均衡。
- random:基于随机的负载均衡。
> 注意:Higress不支持ewma算法,若配置为ewma算法,会回退到round_robin算法。
nginx.ingress.kubernetes.io/upstream-hash-by 服务 部分兼容。暂不支持Nginx变量、常量的组合使用方式 https://github.com/alibaba/higress/issues/195 基于一致Hash的负载均衡算法,Higress支持以下几种形式:
1. Higress支持配置部分nginx变量:
- $request_uri:请求的Path(包括路径参数)作为Hash Key
- $host:请求的Host作为Hash Key
- $remote_addr:请求的客户端IP作为Hash Key。
2. 基于请求header的一致性Hash。您只需配置为$http_headerName。
3. 基于请求路径参数的一致性Hash。您只需配置为$arg_varName

Cookie亲和性

注解 作用 支持度 Issues 说明
nginx.ingress.kubernetes.io/affinity 服务 兼容 https://github.com/alibaba/higress/issues/196 亲和性种类,目前只支持cookie,默认为cookie。
nginx.ingress.kubernetes.io/affinity-mode 服务 部分兼容。暂不支持persistent模式 https://github.com/alibaba/higress/issues/196 亲和性模式,云原生网关目前只支持balanced模式,默认为balanced模式。
nginx.ingress.kubernetes.io/session-cookie-name 服务 兼容 https://github.com/alibaba/higress/issues/196 配置指定Cookie的值作为Hash Key
nginx.ingress.kubernetes.io/session-cookie-path 服务 兼容 https://github.com/alibaba/higress/issues/196 当指定Cookie不存在,生成的Cookie的Path值,默认为/
nginx.ingress.kubernetes.io/session-cookie-max-age 服务 兼容 https://github.com/alibaba/higress/issues/196 当指定Cookie不存在,生成的Cookie的过期时间,单位为秒,默认为Session会话级别。
nginx.ingress.kubernetes.io/session-cookie-expires 服务 兼容 https://github.com/alibaba/higress/issues/196 当指定Cookie不存在,生成的Cookie的过期时间,单位为秒,默认为Session会话级别。

IP访问控制

注解 作用域 支持度 Issues 说明
nginx.ingress.kubernetes.io/whitelist-source-range Ingress 兼容 https://github.com/alibaba/higress/issues/197 指定路由上的IP白名单,支持IP地址或CIDR地址块,以逗号分隔。

安全防护

客户端与网关之前的通信加密

注解 作用域 支持度 Issues 说明
nginx.ingress.kubernetes.io/ssl-cipher 域名 兼容 https://github.com/alibaba/higress/issues/198 指定tls的加密套件,可以指定多个,英文逗号分隔,仅当tls握手时采用TLSv1.0-1.2生效。
默认加密套件如下:
- ECDHE-ECDSA-AES128-GCM-SHA256
- ECDHE-RSA-AES128-GCM-SHA256
- ECDHE-ECDSA-AES128-SHA
- ECDHE-RSA-AES128-SHA
- AES128-GCM-SHA256
- AES128-SHA
- ECDHE-ECDSA-AES256-GCM-SHA384
- ECDHE-RSA-AES256-GCM-SHA384
- ECDHE-ECDSA-AES256-SHA
- ECDHE-RSA-AES256-SHA
- AES256-GCM-SHA384
- AES256-SHA
nginx.ingress.kubernetes.io/auth-tls-secret 域名 部分兼容。secret名字格式必须是:(该域名证书所在的secret的名字)-cacert https://github.com/alibaba/higress/issues/198 网关使用的CA证书,用于验证MTLS握手期间,客户端提供的证书。该注解主要应用于网关需要验证客户端身份的场景。

网关与后端服务之间通信加密

注解 作用域 支持度 Issues 说明
nginx.ingress.kubernetes.io/proxy-ssl-secret 服务 兼容 https://github.com/alibaba/higress/issues/199 网关使用的客户端证书,用于后端服务对网关进行身份认证
nginx.ingress.kubernetes.io/proxy-ssl-name 服务 兼容 https://github.com/alibaba/higress/issues/199 TLS握手期间使用的SNI
nginx.ingress.kubernetes.io/proxy-ssl-server-name 服务 兼容 https://github.com/alibaba/higress/issues/199 开启或关闭TLS握手期间使用SNI

安全认证

Basic
注解 作用域 支持度 Issues 说明
nginx.ingress.kubernetes.io/auth-type Ingress 部分兼容。暂只支持Basic。 https://github.com/alibaba/higress/issues/200 认证类型
nginx.ingress.kubernetes.io/auth-secret Ingress 兼容 https://github.com/alibaba/higress/issues/200 Secret名字,格式支持/,包含被授予能够访问该Ingress上定义的路由的访问权限的用户名和密码。
nginx.ingress.kubernetes.io/auth-secret-type Ingress 兼容 https://github.com/alibaba/higress/issues/200 Secret内容格式。
- auth-file:data的key为auth;value为用户名和密码,多帐号回车分隔
- auth-map:data的key为用户名;value为密码
nginx.ingress.kubernetes.io/auth-realm Ingress 兼容 https://github.com/alibaba/higress/issues/200 保护域。相同的保护域共享用户名和密码。

Higress Custom Annotations

注解 作用域 Issues 说明
higress.io/ignore-path-case Ingress https://github.com/alibaba/higress/issues/163 case-insensitive path matching
higress.io/match-method Ingress https://github.com/alibaba/higress/issues/161 Match by method
higress.io/<matchType>-match-header-<header key>: "<part or all of the header value>" Ingress https://github.com/alibaba/higress/issues/161 Match by headers
higress.io/<matchType>-match-query-<param key>: "<part or all of the param value>" Ingress https://github.com/alibaba/higress/issues/161 Match by url parameters
higress.io/destination Ingress #860
higress.io/timeout Ingress #861
higress.io/route-limit-rps Ingress #862
higress.io/route-limit-rpm Ingress #862
higress.io/route-limit-burst-multiplier Ingress #862
higress.io/request-header-control-add Ingress #863
higress.io/request-header-control-update Ingress #863
higress.io/request-header-control-remove Ingress #863
higress.io/response-header-control-add Ingress #863
higress.io/response-header-control-update Ingress #863
higress.io/response-header-control-remove Ingress #863

Other related information

  • https://higress.io/zh-cn/docs/user/annotation.html
  • https://github.com/alibaba/higress/tree/main/test

Xunzhuo avatar Feb 16 '23 07:02 Xunzhuo

@Xunzhuo Hi Xunzhuo,请问你是否有时间继续完善这块e2e用例?如果没有的话,我Assign给其他同学

johnlanni avatar Dec 26 '23 08:12 johnlanni

@johnlanni sure, no bandwidth left recently

Xunzhuo avatar Dec 26 '23 09:12 Xunzhuo