Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hgctl Enhance the code-debug subcommand to support local debugging for higress/isio #872

Open
Erica177 opened this issue Mar 15, 2024 · 0 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed level/challenge sig/ops

Comments

@Erica177
Copy link
Collaborator

Erica177 commented Mar 15, 2024

Why do you need it?

在涉及higress核心功能开发时,我需要更改istio的代码以实现相应的功能,每次更改都需要构建镜像耗费比较多的时间
因此我尝试了本地启动 higress/istio,来代理掉集群中higress-controller Pod中 pilot的容器进程

虽然我成功的完成了上述功能,但是步骤比较复杂涉及的改动比较多,为了更方便开发者调试,希望把以上的步骤集成到 hgctl code-debug命令中,自动化的完成一些改动

How could it be?

当我运行具备以上功能的 hgctl code-debug命令时,我希望他能帮住我完成除了需要与IDE进行交互之外的所有任务
即 Other related information中 1-3步
当我通过IDE 启动istio 的 main函数时,只需要设置环境变量和参数就能完成istio 的本地调试

Other related information

在我本地启动 higress/istio并代理掉集群中higress-controller Pod中 pilot的容器时,我做了以下的操作

1.更改 higress-config configmap,以使得 higress-gateway可以连接到我本机的 istio进程

image

如图所示 我将上面的 discoveryAddress 换成了我本机的IP地址和15010端口,并添加了新的字段:controlPlaneAuthPolicy: 0

2.将 higress-controller 的15051端口代理至本机15051端口

image

3.创建 meshcongfig.yaml 和 meshnetwork.yaml 两个文件用来为IDE 中的istio使用

文件 meshcongfig.yaml 和 meshnetwork.yaml 分别对应 higress-config configmap中的mesh 和meshNetworks字段

image

4.最后,我参照 higress-controller Pod中pilot容器的环境变量和参数,在我的IDE(Goland)中进行配置并运行就完成了istio的本地调试
当然环境变量和参数也需要做一些改动,即:

在环境变量中,将 KUBECONFIG 替换为本机的 kubeconfig文件地址
在参数设置中,添加以下两个参数并设置为对应的值,meshconfig.yaml和meshnetworks.yaml两个文件的地址即为上述第三步时创建的文件的地址
--meshConfig {your-path}/meshconfig.yaml
--meshConfig {your-path}/meshnetworks.yaml
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed level/challenge sig/ops
Projects
Status: Todo
Development

No branches or pull requests

2 participants