cloudfoundry / cf-java-client

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

Rolling update functionality in cf-java-client possible? #1103

Open FaulhabeJ001 opened 3 years ago

FaulhabeJ001 commented 3 years ago

We are currently working on a GitOps-Tool. This tool deploys apps to cloud foundry and uses the cf-java-client. For this we need the rolling-update functionality but are not sure if this is possible with the cf-java-client api.

Is it possible to use the rolling-update functionality with the cf-java-client api?

ghost commented 3 years ago

I believe that the current state is this:

  1. Using cf-java-client's cloudfoundry-client, we support the v3 API's required to do this.
  2. Using cf-java-client's cloudfoundry-operations, we are still using the older v2 APIs to push.

So you could use the cloudfoundry-client and the v3 APIs which it supports to do a v3 push, but you'd have to orchestrate that yourself. At least until cloudfoundry-operations is updated to use the v3 API.

automationman666 commented 3 years ago

Is there an ETA for "At least until cloudfoundry-operations is updated to use the v3 API" ?

dmikusa commented 3 years ago

@automationman666 Sorry, I cannot give a timeline as we don't have the work scheduled.

If anyone is interested in submitting a PR for this, it would help to speed up the process. I can help with running integration tests/validation. As well as getting it merged.

bpaffenback-db commented 2 months ago

I don't understand reference to being able to orchestrate a rolling strategy using the cloud-foundry-client v3 operations? I see a reference to a DeploymentStrategy, but I don't see that implemented in any of the actions (e.g. CreateDeploymentRequest; UpdateApplicationRequest).

bpaffenback-db commented 2 months ago

I don't understand reference to being able to orchestrate a rolling strategy using the cloud-foundry-client v3 operations? I see a reference to a DeploymentStrategy, but I don't see that implemented in any of the actions (e.g. CreateDeploymentRequest; UpdateApplicationRequest).

nm - I was able to get this working (note using cloudfoundry-client-reactor 5.12.2.RELEASE (achieved via createDeployment below):

public Mono<CreateDeploymentResponse> createDeployment(GetApplicationResponse applicationResponse) {
        return cloudFoundryClient.deploymentsV3().create(CreateDeploymentRequest.builder()
                .droplet(getApplicationCurrentDropletRelationshipResponse(applicationResponse.getId()).block().getData())
                .relationships(DeploymentRelationships.builder()
                        .app(ToOneRelationship.builder()
                                .data(Relationship.builder()
                                        .id(applicationResponse.getId())
                                        .build())
                                .build())
                        .build())
                .build());
    }

    public Mono<GetApplicationCurrentDropletRelationshipResponse> getApplicationCurrentDropletRelationshipResponse(String appId) {
        return cloudFoundryClient.applicationsV3().getCurrentDropletRelationship(GetApplicationCurrentDropletRelationshipRequest.builder()
                .applicationId(appId)
                .build());
    }

    public Mono<GetApplicationResponse> getAppDetailsClient(String appId) {
        return cloudFoundryClient.applicationsV3().get(GetApplicationRequest.builder()
                .applicationId(appId)
                .build());
    }