fix: update same-name Helm images by image path - #4913
Open
Cynthia-0203 wants to merge 13 commits into
Open
Conversation
Signed-off-by: Cynthia <chenchen@koderover.com>
Signed-off-by: Cynthia <chenchen@koderover.com>
Signed-off-by: Cynthia <chenchen@koderover.com>
Signed-off-by: Cynthia <chenchen@koderover.com>
Signed-off-by: Cynthia <chenchen@koderover.com>
Signed-off-by: Cynthia <chenchen@koderover.com>
Signed-off-by: Cynthia-0203 <chenchen@koderover.com>
Signed-off-by: Cynthia-0203 <chenchen@koderover.com>
Signed-off-by: Cynthia <chenchen@koderover.com>
Signed-off-by: Cynthia <chenchen@koderover.com>
Signed-off-by: Cynthia <chenchen@koderover.com>
PetrusZ
reviewed
Aug 21, 2026
| if i == nil { | ||
| return "" | ||
| } | ||
| return fmt.Sprintf("%s\x00%s\x00%s\x00%s", i.Repo, i.Namespace, i.Image, i.Tag) |
Contributor
Author
There was a problem hiding this comment.
就是作为分隔符,这些数据可能是包含-,_之类的,就没有使用-来作为分隔符
Comment on lines
+429
to
+431
| if _, ok := imageMap[name]; !ok { | ||
| imageMap[name] = image | ||
| } |
Contributor
Author
There was a problem hiding this comment.
镜像名 → 完整镜像地址。同名组件可能导致输入中出现多个相同镜像名,这里采用 first-win,保证后续所有同名组件统一使用第一个镜像,避免后面的重复项覆盖前面的选择。
Contributor
There was a problem hiding this comment.
不统一使用第一个会有什么问题吗?因为这样改了以后可能会造成产品逻辑跟之前不一样
| container.Image = imageMap[container.ImageName] | ||
| } | ||
| mergedContainers = append(mergedContainers, container) | ||
| continue |
Comment on lines
467
to
484
| if container.ImageName == name { | ||
| // find corresponding image in values | ||
| // path present in values: skip when unchanged and no build image | ||
| if imageMap[name] == "" && container.Image == imageUrl { | ||
| continue | ||
| } | ||
| if imageMap[name] != "" { | ||
| // if found image in images, and the images are from build job, we should override it | ||
| container.Image = imageMap[name] | ||
| mergedContainers = append(mergedContainers, container) | ||
| } | ||
| } else { | ||
| // not found corresponding image in values | ||
| // add container image into values | ||
| if imageMap[container.ImageName] != "" { | ||
| // if found image in images, and the images are from build job, we should override it | ||
| container.Image = imageMap[container.ImageName] | ||
| } | ||
| mergedContainers = append(mergedContainers, container) | ||
| continue | ||
| } | ||
|
|
||
| // path not in values: always write back | ||
| if imageMap[container.ImageName] != "" { | ||
| container.Image = imageMap[container.ImageName] | ||
| } | ||
| mergedContainers = append(mergedContainers, container) | ||
| } |
Comment on lines
+468
to
+471
| // path present in values: skip when unchanged and no build image | ||
| if imageMap[name] == "" && container.Image == imageUrl { | ||
| continue | ||
| } |
Contributor
Author
There was a problem hiding this comment.
imageMap[name] == "":本次没有构建任务产出的镜像需要覆盖
container.Image == imageUrl:环境中记录的镜像与当前 Values 路径解析出的镜像一致
两个条件同时满足时,不需要加入 mergedContainers 再次回写 Values,所以直接跳过。
Signed-off-by: Cynthia <chenchen@koderover.com>
Signed-off-by: Cynthia <chenchen@koderover.com>
PetrusZ
approved these changes
Aug 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / Why we need it:
Fixes Helm services where multiple components share the same image name but use different values paths. Previously, components were merged by name, causing one component to overwrite another and preventing simultaneous image updates.
What is changed and how it works?
name + image_pathas the identity for Helm service modules.service_modulerecords.name + image_pathmatching.service_moduleas the authoritative container list.Does this PR introduce a user-facing change?
This change is