-
Notifications
You must be signed in to change notification settings - Fork 322
Add Service Brokers Endpoints #1080
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
Conversation
|
Thanks for the PR @theghost5800! Unfortunately I've just pushed an implementation of service offerings, so if you could remove that part and resubmit I'll get started on a merge. |
|
Okay, I'll remove service offering part and update the PR. |
|
I took a pass through and everything looks great, with one exception. You're absolutely right that |
8b3cf83 to
5c2e539
Compare
|
Hello, did you have some comments on last changes? Also did you expect from me to fix merge conflicts or you will fix them? Probably they are related with package renaming. |
|
Hi @theghost5800 No comments, just working through PRs at the moment. No need to resolve conflicts, I'll handle that. |
|
(Edited title to help with tracking) |
|
As I can see, these changes are not comitted in main brach. So when I can expect these changes to be merged in main branch and released? |
|
Hi @dmikusa-pivotal , |
|
@theghost5800 My apologies & thanks for the PR. We've had some changes on the team and this has caused some delays with some PRs/Issues. In particular, CI has not been in good shape. I have been working through that and getting it fixed. If you could fix up the merge conflicts on this PR, I will take a look and review it for you. Thanks for your time, it is appreciated! |
|
Hi @dmikusa-pivotal , I have updated PR with fixed merge conflicts, so now you can take a look and if you want to make some changes, please let me know. |
dmikusa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for the PR. It looks good. A couple points of feedback:
-
There are a handful of files like CloudFoundryCleaner.java and ServiceInstancesTest.java (and some others) where the only changes appear to be the reordering of imports. This sometimes happens with IDE code formatters. In general, we don't want code like that checked in. It's confusing because it complicates the PR an can make merges harder. Please go and exclude any non-material changes like space-only changes to unaltered code or reordering imports in otherwise unaltered files. That should shrink the surface area of this PR.
-
There need to be integration tests. There needs to be a client-specific test for the broker here, something like ServiceBrokersTest.java.
It's not an easy aspect to test because you actually need some sort of service broker, so you can add the broker to the CF to test it. If you check out ServiceBrokerUtils, I think this might be enough to get what you need.
Thanks again, let me know if you have questions on this feedback.
|
Hi @dmikusa-pivotal , I fixed files with switched imports and try to copy existing ServiceBrokersTest from v2 package and adapt it to v3 but I don't have cf environment with admin access where I can run integration tests. Could you please try to execute this new integration tests on your environment? As far as I’ve heard previosly was not necessary contributors to write integration tests because there is no other options if you don't have CF environment with admin access. |
|
Thanks. We need to have integration tests before anything can be merged. You can write them or I can write them. If you are unable to provide them, I can write the tests but I cannot promise priority to that work so it will be much quicker to merge this PR if you are able to provide them. The tests do require full admin access to a CF installation. If you do not have access to one, you can run one locally using bosh-deployment & cf-deployment & Virtualbox.
Before you start the tests, I would recommend taking a snapshot of the VMs in the environment. That way you can quickly restore back to the initial state (tests should clean up after themselves, but this gives you another way to refresh your env). Thanks |
|
@theghost5800 I took these and ran them locally against a CF foundation & got some errors. Here's the output: There's not a lot to go on here. It just seems like it's expecting the broker to exist in the test, but it doesn't exist so fails. |
|
Hi @dmikusa-pivotal , |
|
You can basically use anything Bosh supports, but most of those are public cloud/not something you run on your laptop. I think Virtualbox is the only one that's feasible to run on a laptop/desktop. You could potentially try https://github.com/cloudfoundry/cf-for-k8s which runs on K8s. That has a section for deploying locally, https://cf-for-k8s.io/docs/deploying/deploy-local/. It should be compatible with cf-java-client, but we don't test it in our CI pipelines. |
|
Hello @dmikusa-pivotal , I have tried to execute steps related with setup bosh-lite and deploy local CF using Virtualbox. I had successfully execute steps in this link https://bosh.io/docs/bosh-lite/ and now I have bosh vm director but when I try to deploy CF from this guide https://github.com/cloudfoundry/cf-deployment/blob/main/texts/deployment-guide.md#for-operators-deploying-cf-to-local-bosh-lite , I have always receive a lot of errors related with missing configurations in cloud-config.yml file(I am trying to use this one https://github.com/cloudfoundry/bosh-deployment/blob/master/virtualbox/cloud-config.yml). Tried some of them to add/edit them but again receive another errors related with network configuration(for example missing vm_extensions or some static configured ip described here https://github.com/cloudfoundry/cf-deployment/blob/main/operations/bosh-lite.yml doesn't belong to any subnets). So do you know some guide or exact descriptors which I can use to deploy CF locally? Just to mention that I am using master branches of cf-deployment and bosh-deployment repos. |
|
Sorry, I can't really add anything beyond what's in the docs. I would suggest not running on main/master though. Pick one of the tagged releases. Those coincide with release versions. It's possible that main/master isn't in a good state. |
|
Hi @dmikusa-pivotal I find out where is the issue with create and update tests. It looks like list request which assert that create/update operation is successful doesn't wait previous operation to finish and this cause result from list requests to be empty. Now it should be wait until first operation is executed and then verify operation. You can trigger your test pipeline including latest changes in the PR. I hope now everything will be okay and the PR can be merged. |
|
Many thanks, @theghost5800! I will try to run these through our integration env on Mon or Tue next week. |
|
I took a look at this today and there is still a similar error on the update integration test. I suspect that what is happening is because the cloud controller API for service brokers may return immediately and process the job asynchronously.
http://v3-apidocs.cloudfoundry.org/version/3.101.0/index.html#create-a-service-broker The update API has the same note:
http://v3-apidocs.cloudfoundry.org/version/3.101.0/index.html#update-a-service-broker In fact that one is a little more confusing cause it says that it MAY respond with a background job, so sometimes it will, sometimes it won't. The docs say that a 200 OK will indicate an immediate response, while a 202 Accepted indicates a background job. I capture the HTTP request/response data and it is returning a 202 in my test, so that's why I suspect that this isn't working for me. It seems like it's not handling that case where the response is non-immediate. It looks like delete does the same. I'm not sure why delete & create work, it might be just a timing thing in my environment, not sure. I think we want this to be handled similar to other endpoints that return a Job, see Route and that uses this method instead which is returning a job id, so the client could monitor the Job and wait for it to complete. This helper also exists for http://v3-apidocs.cloudfoundry.org/version/3.101.0/index.html#asynchronous-operations For the integration tests, the one test that I could find that appears to be doing this correctly is delete for Apps. I would suggest doing something like that where it uses JobUtils to ensure correct polling of the resulting Job. When the job is done, you can do the current logic of checking for the list of service brokers filtered by the new name. |
|
Hi @dmikusa-pivotal , I have make changes about extraction of job id of async operations and use |
|
I got some different failures this time: The create failure is caused by a 422 response from the create request. The other two are 404's. Those were run against a TAS 2.11 environment, with API versions: Apologizes, as I didn't have time to dig into them further so I'm not sure quite what is causing those failures. |
|
Hi @dmikusa-pivotal , I can see that api version is quite old. If I am not wrong, it is coming with CAPI 1.84.0 which includes v3 version 3.74.0. From documentation about version 3.74.0, it seems that endpoints for update and delete of service broker are not included and create endpoint requires other fields which are changed in latest versions of capi 3.102.0. Could you please try to run integration tests on newer CF version. |
|
Hmm, I can take another look. I believe that was run against TAS 2.11, which should be very recent. |
|
I found out that Update service broker response can be different based on what will be updated. In case of update of metadata.labels or metadata.annotations then it won't return Location header including link to job and it will return updated entity itself. In such case, what result should return cf java client? It looks like such scenario is not covered in the code right now. What will be your suggestion about this issue? Because currently if someone tries to prepare update request of service broker metada only, it will throw |
🤦
I'm not 100% sure. I'm trying to think of things from the perspective of a user of the library. What would make sense if you're trying to update a service broker in your code? What results in an easy/smooth usable API? A couple of thoughts:
I'm open to other suggestions. I just want to make sure the experience of using the API is clean.
I wouldn't be in favor of this approach because typically an update request would return the updated object. If I understand what you're proposing, that would mean the case where it would return a |
Response from update request of v3 service broker can be different based on what is updated. That's why client should able to return job id or whole service broker object as result.
|
Hi @dmikusa-pivotal , I have push new commit which implement mechanism to return jobid and service broker object as optional. I have test it manually and add additional integration test about this. |
|
Sorry for the delay @theghost5800. I ran the tests and they all passed, so I wanted to dig in a little more and play with the API changes too. Looks good. I'll merge shortly. |
…rs (#1080) This request adds client support for managing service brokers using the v3 API. It also adds support for retrieving managed service instance credentials and service instance parameters. * Add get service instance credentials/parameters * Add Service Brokers V3 API * Renames `org.cloudfoundry.client.v3.serviceInstances` package to `org.cloudfoundry.client.v3.serviceinstances`. This was done on the 5.x branch but not merged back.
Resolve #1076