Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

When trying to upgrade to version 5.2, I am facing problems problems with failing integration tests (LocallyRunOperatorExtension).

One problem is that the call to withKubernetesClient has to be replaced with a call to withInfrastructureKubernetesClient. Maybe deserves a mention in the release notes?

After fixing that, I am still facing the issue that the reconciler is not executed. Here is a simple example:

public class ConfigMapReconciler implements Reconciler<ConfigMap> {

    String configMapName;

    @Override
    public UpdateControl<ConfigMap> reconcile(ConfigMap resource, Context<ConfigMap> context) throws Exception {
        configMapName = resource.getMetadata().getName();
        return UpdateControl.noUpdate();
    }
}

and test

@EnableKubeAPIServer
class ConfigMapReconcilerTest {

    private ConfigMapReconciler configMapReconciler = new ConfigMapReconciler();

    @KubeConfig
    static String kubeConfigYaml;

    @RegisterExtension
    LocallyRunOperatorExtension operator = LocallyRunOperatorExtension.builder()
            .withReconciler(configMapReconciler)
            .withInfrastructureKubernetesClient(new KubernetesClientBuilder()
                    .withConfig(Config.fromKubeconfig(kubeConfigYaml))
                    .build())
            .waitForNamespaceDeletion(false)
            .build();

    @Test
    void test() {
        operator.create(new ConfigMapBuilder().withNewMetadata().withName("test").withNamespace(operator.getNamespace()).endMetadata().build());
        await("Reconciler called")
                .pollInterval(50, TimeUnit.MILLISECONDS)
                .atMost(10, TimeUnit.SECONDS)
                .until(() -> configMapReconciler.configMapName, Objects::nonNull);
    }
}

This works with 5.1.5 but fails with 5.2.0. Any help appreciated.

You must be logged in to vote

Thanks @mnk, we are missing the use of the correct client somewhere. But for now, you can workaround this issue with:

.withInfrastructureKubernetesClient(client)
.withKubernetesClient(client)

I need to finish something else with higher priority now but I'll take a look asap.

Replies: 3 comments

Comment options

Hi @mnk ,

thank you for reporting.

@xstefank could you pls take a look on this?

You must be logged in to vote
0 replies
Comment options

Thanks @mnk, we are missing the use of the correct client somewhere. But for now, you can workaround this issue with:

.withInfrastructureKubernetesClient(client)
.withKubernetesClient(client)

I need to finish something else with higher priority now but I'll take a look asap.

You must be logged in to vote
0 replies
Answer selected by mnk
Comment options

for the record adding here the fix pr: #3077

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.