cloudfoundry / cf-java-client

Java Client Library for Cloud Foundry
Apache License 2.0
329 stars 317 forks source link

UpdateProcessRequest cannot remove a timeout or invocationTimeout #1232

Open LitschiW opened 5 months ago

LitschiW commented 5 months ago

We are on version 5.12.1-RELEASE.

The default ObjectMapper is configured with setSerializationInclusion(NON_NULL) . When removing a timeout the request should set it explicitly to null, which is not possible using this configuration. Hence an UpdateProcessRequest can, by default, never remove a timeout.

See the following screenshot for a debugging example result

grafik

The code above is called by invoking the following Mono:

Mono.just("<app-id>")
                .flatMap(appId -> operator
                        .getCloudFoundryClient()
                        .applicationsV3()
                        .getProcess(GetApplicationProcessRequest.builder().applicationId(appId).type("web").build())
                        .flatMap(process -> {
                            return operator
                                    .getCloudFoundryClient()
                                    .processes().update(
                                            UpdateProcessRequest.builder()
                                                    .processId(process.getId())
                                                    .healthCheck(HealthCheck.builder()
                                                            .type(HealthCheckType.from(targetState.manifest().getHealthCheckType().toString()))
                                                            .data(Data.builder()
                                                                    .endpoint(targetState.manifest().getHealthCheckHttpEndpoint())
                                                                    .timeout(targetState.manifest().getTimeout())
                                                                    .build())
                                                            .build())
                                                    .build()
                                    ).doOnSuccess(updateProcessResponse -> {
                                        log.info("Updated health check for application");
                                    });
                        }).then()
LitschiW commented 5 months ago

I think this may also apply to the PushApplicationManifestRequest since it also cannot remove a timeout.

LitschiW commented 5 months ago

As a workaround we now use the cf api directly, using the default ObjectMapper.