Skip to content

Operator does not receive any events after startup #514

Closed
@steknowis

Description

@steknowis

Bug Report

What did you do?

Started my operator (locally or in cluster) with Spring Boot. Startup logs looking good and all custom resources are processed once. But after startup no events at all are processed. I have a reconciliation TimerEventSource that should be triggered every 30s, but nothing happens. I change a CR, nothing happens.

  1. Start (Spring Boot) operator in debug mode, wait for complete startup
  2. Change a watched CR or create a new one
  3. Check if createOrUpdateResource method of your ResourceController is invoked

What did you expect to see?

Events (of TimerEventSource and create/update/delete) should trigger `createOrUpdateResource `or `deleteResource `method of the ResourceController after startup.

What did you see instead? Under which circumstances?

No events were triggered and processed. No error message, operator running as normal. Happening locally or in cluster with operator version 1.9.4; 1.9.3 works as expected.

Environment

Kubernetes cluster type:

OpenShift 4.6.36

$ Mention java-operator-sdk version from pom.xml file

1.9.4

$ java -version

openjdk version "11.0.11" 2021-04-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.11+9-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.11+9-LTS, mixed mode)

$ kubectl version

Client Version: 4.6.23
Server Version: 4.6.36
Kubernetes Version: v1.19.0+b00ba52

Spring Boot version:
2.4.8

Additional context

My operator registration:
    @Bean(initMethod = "start", destroyMethod = "close")
    @Autowired
    public <R extends CustomResource<?, ?>> Operator operator(OpenShiftClient client,
                                                              List<ResourceController<R>> controllers, KubernetesEnvironmentService environmentService) {
        ConfigurationService configurationService = DefaultConfigurationService.instance();
        Operator operator = new Operator(client, configurationService);

        String namespace = environmentService.getCurrentNamespace();
        controllers.forEach(c -> registerController(operator, configurationService, c, namespace));

        return operator;
    }

    @Bean
    @Autowired
    public MyController myController(Service a, Service b) {
        return new MyController(a, b);
    }

    private <R extends CustomResource<?, ?>> void registerController(Operator operator,
                                                                     ConfigurationService configurationService, ResourceController<R> controller, String namespace) {
        // override configuration to watch only current namespace
        ControllerConfiguration<R> configuration = configurationService.getConfigurationFor(controller);
        configuration = ControllerConfigurationOverrider.override(configuration).settingNamespace(namespace).build();
        operator.register(controller, configuration);
    }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions