Skip to content

If ControllerResourceEventCource not initialized firtst can cause issues with indexing and secondary to primary mapping #1238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
csviri opened this issue May 25, 2022 · 0 comments · Fixed by #1237 or #1239
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@csviri
Copy link
Collaborator

csviri commented May 25, 2022

Source code from Flink operator. Such cases if the controller ES is not initialized first it will mean that the informer's SecondaryToPrimaryMapper won't find resource in the primary index. This is quite natural setup, so makes sense to in general to init ControllerResourceEventSource as first, so the index is filled when other event source are started, so their index is filled also correctly.

 public static InformerEventSource<FlinkDeployment, FlinkSessionJob>
            getFlinkDeploymentInformerEventSource(EventSourceContext<FlinkSessionJob> context) {
        context.getPrimaryCache()
                .addIndexer(
                        FLINK_SESSIONJOB_IDX,
                        sessionJob -> List.of(sessionJob.getSpec().getDeploymentName()));

        InformerConfiguration<FlinkDeployment> configuration =
                InformerConfiguration.from(FlinkDeployment.class, context)
                        .withSecondaryToPrimaryMapper(
                                flinkDeployment ->
                                        context.getPrimaryCache()
                                                .byIndex(
                                                        FLINK_SESSIONJOB_IDX,
                                                        flinkDeployment.getMetadata().getName())
                                                .stream()
                                                .map(ResourceID::fromResource)
                                                .collect(Collectors.toSet()))
                        .withNamespacesInheritedFromController(context)
                        .followNamespaceChanges(true)
                        .build();

        InformerEventSource<FlinkDeployment, FlinkSessionJob>
                flinkDeploymentFlinkSessionJobInformerEventSource =
                        new InformerEventSource<>(configuration, context);
        return flinkDeploymentFlinkSessionJobInformerEventSource;
    }
    
@csviri csviri added the kind/bug Categorizes issue or PR as related to a bug. label May 25, 2022
@csviri csviri self-assigned this May 25, 2022
@csviri csviri linked a pull request May 25, 2022 that will close this issue
@csviri csviri reopened this May 25, 2022
@csviri csviri linked a pull request May 25, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
1 participant