Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Inject config into a KubernetesDependentResource

Aberta
#2,087 5 comentários 0 reações 2 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@metacosm já está trabalhando nisso.

Desde 11/10/2023.

  • #2088 de @csviri — fechado sem integrar

Avaliação

Esta issue ainda não foi avaliada.

Descrição

kind/documentation lifecycle/stale

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?

Linguagem predominante
Java
Estrelas
942
Forks
246
Merge médio
1d 11h
PRs com merge (30d)
28

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de operator-framework/java-operator-sdk

Todas as issues de operator-framework/java-operator-sdk

Issues semelhantes

Mais issues de Java

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.