operator-framework / operator-framework/java-operator-sdk

Colliding root-level version.properties can misreport the SDK version

未关闭
#3,627 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Java
星标
944
派生
242
平均合并
1 天 4 小时
30 天内合并 PR
43

描述

Bug Report

What did you do?

Built an operator as a single shaded jar depending on both io.javaoperatorsdk:operator-framework-core (5.6.1) and io.javaoperatorsdk:kubernetes-webhooks-framework-core (3.0.4). Both artifacts generate a root-level version.properties via the git-commit-id-maven-plugin, so the two files collide at the same jar entry path.

What did you expect to see?

The operator startup log reports operator-framework-core's commit id and build time, which Utils.loadFromProperties() reads from version.properties.

What did you see instead? Under which circumstances?

ClassLoader.getResourceAsStream returns the first match, so Utils can silently report the webhooks framework's commit id and build time as the SDK version. This only surfaces when the jars are merged into one (or the classpath puts the webhooks jar first), which is probably why it went unnoticed: setups that keep the jars separate, such as Quarkus, usually resolve the operator-framework-core copy first.

Possible Solution

Give each artifact a uniquely named properties file:

  • operator-framework-core: operator-sdk-version.properties, updating the lookup in Utils.loadFromProperties() (its only reader)
  • kubernetes-webhooks-framework-core: for example kubernetes-webhooks-framework-version.properties (nothing reads it today, so it is only a rename); I can file a companion issue there

Happy to contribute PRs (for both repos if needed).

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先定位 Utils.loadFromProperties() 以及用于创建 version.properties 的 git-commit-id-maven-plugin 配置。重命名 operator-framework-core 资源并更新其查找逻辑,然后构建一个包含两个 framework artifact 的 shaded jar,并验证启动日志报告 operator framework 的 commit id 和 build time。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, kubernetes
领域
build-system
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
72/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。