spring-cloud / spring-cloud-task

Short lived microservices with Spring Batch
https://cloud.spring.io/spring-cloud-task/
Apache License 2.0
425 stars 305 forks source link

NoSuchMethodError when launch a spring batch worker using DeployerPartitionerHandler on KubernetesDeloyerTaskLaucher #926

Open toandocoffee opened 1 year ago

toandocoffee commented 1 year ago

I am getting this issue while trying to run the pod worker into kubernetes cluster using DeployerPartitionerHandler with Kubernetes Deployer

java.lang.NoSuchMethodError: 'io.fabric8.kubernetes.api.model.HTTPGetActionFluent io.fabric8.kubernetes.api.model.HTTPGetActionBuilder.withNewPort(java.lang.Integer)'
at org.springframework.cloud.deployer.spi.kubernetes.HttpProbeCreator.create(HttpProbeCreator.java:65) ~[spring-cloud-deployer-kubernetes-2.9.0.jar:na]

In the HTTPGetActionBuilder class there is a function withNewPort(Object port), even though the port 8989 has been populated but it thrown this exception

image

Please find more details of package version:

Spring boot: 3.1.4 Spring Cloud Task: 3.0.3 Spring Cloud Task Batch: 3.0.3 Spring Cloud Deployer: 2.9.0

This is how I configure the partition handler:

@Bean
public DeployerPartitionHandler partitionHandler() {
    Resource resource = new DockerResource("service-image");
    DeployerPartitionHandler partitionHandler = new DeployerPartitionHandler(taskLauncher, jobExplorer, resource, "ingestWorkerStep", taskRepository);
    List<String> commandLineArgs = new ArrayList<>(4);
    commandLineArgs.add("--spring.profiles.active=worker");
    commandLineArgs.add("--spring.cloud.task.initialize.enable=false");
    commandLineArgs.add("--spring.batch.initializer.enabled=false");
    commandLineArgs.add("--spring.datasource.initialize=false");
    commandLineArgs.add("--spring.datasource.initialize=false");
    partitionHandler.setCommandLineArgsProvider(new PassThroughCommandLineArgsProvider(commandLineArgs));
    partitionHandler.setEnvironmentVariablesProvider(new SimpleEnvironmentVariablesProvider(environment));
    partitionHandler.setMaxWorkers(3);
    partitionHandler.setApplicationName("partitionjob");
    return partitionHandler;
}
spring:
  cloud:
    deployer:
      kubernetes:
        namespace: default
        startup-http-probe-port: 8989
        liveness-http-probe-port: 8989
        readiness-http-probe-port: 8989
        host-network: true
        livenessProbePath: /actuator/health/liveness
        readinessProbePath: /actuator/health/readiness

Did I miss any configuration?

Thanks

toandocoffee commented 1 year ago

There is another reported issue in this https://github.com/spring-cloud/spring-cloud-deployer/issues/400. I am not sure if both are related

corneil commented 9 months ago

Spring Cloud Deployer has not been tested with Spring Boot 3.x

cppwfs commented 9 months ago

Hmmm.... I'm unable to reproduce, can you share a small example that exhibits the problem. It would be most helpful.