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

feat: support service and more fields in K8s meta #1895

Merged
merged 6 commits into from
Nov 27, 2024
Merged

Conversation

Abingcbc
Copy link
Collaborator

@Abingcbc Abingcbc commented Nov 18, 2024

  1. K8s meta HTTP server 返回结果调整
  • 所有接口新增返回 podName,startTime
  • /metadata/ipport:支持传入service IP和ip port查询,返回其中一个对应的Pod信息。新增 contianerID 字段。
  • /metadata/containerid:修改containerID格式,去除前缀。新增 podIP 字段。
  • /metadata/host:新增 containerID 字段。
  1. 修复配置停止时导致的race问题

@Abingcbc Abingcbc force-pushed the abing/k8s-meta branch 7 times, most recently from f8203d4 to dd338a6 Compare November 19, 2024 16:26
@linrunqi08
Copy link
Collaborator

修复配置停止时导致的race问题 : 代码在哪里,说明一下

@linrunqi08
Copy link
Collaborator

"支持传入service IP查询,返回其中一个对应的Pod信息" 什么场景需要?以及返回一个pod信息是否合理?

pkg/helper/k8smeta/k8s_meta_http_server.go Outdated Show resolved Hide resolved
pkg/helper/k8smeta/k8s_meta_http_server.go Outdated Show resolved Hide resolved
Comment on lines +309 to +313
m.registerLock.RLock()
defer m.registerLock.RUnlock()
if f, ok := m.sendFuncs[timerEvent.ConfigName]; ok {
allItems := make([]*K8sMetaEvent, 0)
m.lock.RLock()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前在遍历sendFunc时,锁的粒度不够。只能保证取到元素时是原子的。
但是取到之后,到实际调用执行之间,可能会出现配置重新加载,unregister,无法保证元素仍是有效的。

@linrunqi08 linrunqi08 merged commit f7fe832 into main Nov 27, 2024
12 of 13 checks passed
@Abingcbc Abingcbc deleted the abing/k8s-meta branch November 27, 2024 03:04
@henryzhx8 henryzhx8 added the enhancement Feature enhancement label Nov 27, 2024
@henryzhx8 henryzhx8 added this to the v3.0 milestone Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants