Help us shape the future of Go! Take the 2026 Go Developer Survey

istio

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 5 Imported by: 0

README

ekit-istio

Istio Proxyless 集成——Kitex xDS 动态熔断,零 ekit 内部依赖。

本仓库是 ekit(git.enjoye.top/enjoydream/ekit v0.34.0) 拆分出的独立 Go module,属于 yi-nology ekit 子项目矩阵(Round-2 深拆粒度)。

安装

go get github.com/yi-nology/ekit-istio@v0.1.0

包清单

  • 根包 `istio`(import `github.com/yi-nology/ekit-istio`)— InitXDS(opts) + NewXDSClientOption()(⚠️ 要求 K8s bootstrap 环境变量;bootstrap 后对不可达 istiod 阻塞重试)

依赖关系

子项目矩阵与依赖方向(自底向上,19 仓):

ekit-core            文本/数据工具 + governance/lifecycle/version      (零内部依赖)
ekit-concurrency     并发与流控原语                                     (零内部依赖)
ekit-logx            日志门面 + shutdown                                (零内部依赖)
ekit-istio           Istio Proxyless                                    (零内部依赖)
  ekit-metrics       Prometheus 门面                          → core
  ekit-tracing       OTel + traceid                           → logx
  ekit-registry      注册发现 + 配置                          → core, logx
    ekit-data        缓存抽象 + 定时任务                      → core, logx, concurrency
      ekit-gorm      SQL/GORM 全家                            → core, logx
      ekit-redis     Redis 全家                               → data, core, logx
    ekit-httpx       HTTP 客户端 + 负载均衡                   → core, concurrency, logx, metrics, tracing, registry
      ekit-nns       服务治理客户端                           → httpx, registry, core, logx, tracing, metrics
        ekit-bootstrap 应用引导
    ekit-middleware  Hertz 中间件栈                           → core, concurrency, logx, metrics, tracing, registry
    ekit-hertz       Hertz 运行时/适配/instrumentation        → middleware, gorm, nns, registry, metrics, tracing, logx, core
    ekit-kitex       Kitex 生态                               → nns, registry, core, concurrency, logx, metrics
  ekit-workflow      流程编排                                 → concurrency, logx

注:ekit-observability 已在 Round-2 深拆中解散——logx 迁 [ekit-logx]、metrics 迁 [ekit-metrics]、 tracing/traceid 迁 [ekit-tracing]、shutdown 迁 [ekit-logx];原仓库已归档。

本仓库为 L0 独立件;第三方仅 kitex-contrib/xds。

与 ekit 单体仓库的关系

  • 代码与 ekit v0.34.0 等价,module 路径 git.enjoye.top/enjoydream/ekit/... → github.com/yi-nology/ekit-istio/...
  • 各子仓库独立发版(SemVer);开发规范沿用 ekit AGENTS.md 约定

License

见 LICENSE

Documentation

Overview

Package istio 提供 Kitex xDS / Proxyless / Istio 集成的 ekit 桥接。

官方依据:https://github.com/kitex-contrib/xds (v0.4.2) + Istio "Kitex Proxyless" 文档 (https://www.cloudwego.io/zh/docs/kitex/\ tutorials/service-governance/proxyless/)。

背景:Kitex 可以 Proxyless 模式对接 Istio(无 sidecar),通过 xDS 协议从 istiod 拉路由/限流/熔断等配置,ekit 通过本包 Init 即可启用。

业务用法(典型部署):

// 启动:连接 istiod(要求 K8s bootstrap 环境变量;对不可达 istiod
// 会阻塞重试,不能当连通性检查用 — 详见 InitXDS 文档)
_ = istio.InitXDS(istio.WithXDSServerAddress("istiod.istio-system:15010"))

// 客户端:动态熔断(替代静态配置)
cli, _ := myservice.NewClient("myservice",
    istio.NewXDSClientOption(),
    client.WithMiddleware(...),
)

// 启动 server:ekit 已有 NewServerOptions(走 metainfo),无需 xDS 接入

设计选择:

  • xds 是 kitex 专属(对 hertz 没用,hertz 用 hertz-contrib/mesh 适配 istio,本仓库暂不桥接)
  • Init 幂等:多次调用安全(实际只第一次生效,后续返回 nil)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitXDS

func InitXDS(opts ...XDSOption) error

func NewXDSClientOption

func NewXDSClientOption(opts ...XDSClientOption) client.Option

NewXDSClientOption 桥接 xds/xdssuite.NewCircuitBreaker,作为 kitex client option 使用 — 动态熔断配置从 istiod 拉取,不需要业务写静态规则。

业务用法:

cli, _ := myservice.NewClient("myservice",
    istio.NewXDSClientOption(),
    ...
)

返回 client.Option,业务直接挂到 kitex client 上。

Types

type XDSClientOption

type XDSClientOption = xdssuite.Option

XDSClientOption 是 xds/xdssuite.Option 的 type alias(避免业务 import 长串上游 path;后续暴露熔断/重试等 Option 时统一用)。

type XDSOption

type XDSOption = xdsmanager.Option

XDSOption 是 xds 包的 manager.Option 的 type alias。

func WithXDSServerAddress

func WithXDSServerAddress(address string) XDSOption

WithXDSServerAddress 透传 kitex-contrib/xds.WithXDSServerAddress。 业务用:

istio.InitXDS(istio.WithXDSServerAddress("istiod.istio-system:15010"))

func WithXDSServerConfig

func WithXDSServerConfig(cfg *XDSServerConfig) XDSOption

WithXDSServerConfig 透传 kitex-contrib/xds.WithXDSServerConfig。 业务需要自定义 Node ID / Cert path 等高级配置时用。

type XDSServerConfig

type XDSServerConfig = xdsmanager.XDSServerConfig

XDSServerConfig 是 xds/core/manager.XDSServerConfig 的 type alias, 业务用 istio.XDSServerConfig{} 构造配置 + WithXDSServerConfig 注入。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL