Inject config into a KubernetesDependentResource
评估
这个 Issue 还没有评估数据。
描述
I'm trying to inject some dependencies into my KubernetesDependentResource.
For dependent resources I usually do this by implementing DependentResourceConfigurator:
// Dependent resource
public class MyDependentResource
extends PerResourcePollingDependentResource<MyDependent, MyPrimary>
implements DependentResourceConfigurator<MyConfig> {
@Override
public void configureWith(MyConfig config) {
this.dependency1 = config.dependency1();
}
}
// Startup code
Operator operator = new Operator();
operator.register(reconciler, r -> r.replaceNamedDependentResourceConfig(MyDependentResource.NAME, new MyConfig(/*...*/)));
But KubernetesDependentResource already implements DependentResourceConfigurator, so I can't configure my own config.
Currently working around this issue by using a singleton pattern.
I inject the dependencies into the singleton and initialise it before the dependent resource reconciler is created.
The dependent resource reconciler then fetches its dependencies from the singleton.
Is there a different way to do this?
- 主要语言
- Java
- 星标
- 944
- 派生
- 242
- 平均合并
- 1 天 14 小时
- 30 天内合并 PR
- 46
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
operator-framework/java-operator-sdk 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 55/100
operator-framework/java-operator-sdk#3621 · 7 条评论 · 已指派 1 人 ·
-
难度 4/5 3-5 天 新手友好度 38/100
operator-framework/java-operator-sdk#3615 · 1 条评论 · 3 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 45/100
operator-framework/java-operator-sdk#3568 · 1 条评论 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 25/100
-
operator-framework/java-operator-sdk#3538 · 2 条评论 · 已指派 2 人 ·
查看 operator-framework/java-operator-sdk 的全部 Issue
相似的 Issue
-
certification
难度 1/5 1 小时以内 新手友好度 80/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's 未关闭bug ecr
难度 2/5 1-3 小时 新手友好度 75/100
-
Needs: Triage Type: Feature request
难度 2/5 1-3 小时 新手友好度 70/100
AntennaPod/AntennaPod#8794 ·
-
agentic-workflows
难度 2/5 1-3 小时 新手友好度 65/100
github/copilot-sdk#2760 ·