Skip to content
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

Ensure binding credentials are stored on async bind #3693

Merged
merged 2 commits into from
Jan 10, 2025

Conversation

danail-branekov
Copy link
Member

Is there a related GitHub Issue?

No

What is this change about?

Ensure credentials secret is created on async bind

  • When the bind operation state is succeeded, requeue the reconcile
    request. Thus we ensure that the controller would try to bind again,
    and as the bind operation has already succeeded, it would get a
    response containing the binding credentials

  • When checking the state of the last operation in asynchronous
    provision/bind, instance/binding controllers consider the operation to
    have completed when its state is either succeeded, or failed.
    Anything else is considered as if the operation is ongoing. Thus we
    protect ourselves from brokers returning nonsense operation state

  • The test for the instance controller is refactored so that the
    synchronous provisioning is the "default" case and there is a
    dedicated context for asynchronous provisioning. This aligns test
    style of instance/binding controller tests

  • The sample broker implements the async flow properly

Does this PR introduce a breaking change?

No

Tag your pair, your PM, and/or team

@georgethebeatle @uzabanov


When("the last operation is in progress", func() {
BeforeEach(func() {
brokerClient.GetServiceInstanceLastOperationReturns(osbapi.LastOperationResponse{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it duplicates the test starting on line 288

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, the duplicate has been removed. Thanks!

* When the bind operation state is `succeeded`, requeue the reconcile
  request. Thus we ensure that the controller would try to `bind` again,
  and as the bind operation has already succeeded, it would get a
  response containing the binding credentials
* When checking the state of the last operation in asynchronous
  provision/bind, instance/binding controllers consider the operation to
  have completed when its state is either `succeeded`, or `failed`.
  Anything else is considered as if the operation is ongoing. Thus we
  protect ourselves from brokers returning nonsense operation state
* The test for the instance controller is refactored so that the
  synchronous provisioning is the "default" case and there is a
  dedicated context for asynchronous provisioning. This aligns test
  style of instance/binding controller tests
* `Provision`/`Deprovision`/`Bind`/`Unbind` operations
  - return `HTTP 202 Accepted` on first invocation for a resource and return operation id
  - store the operation in a map and flags it as `in-progress`
* `GetLastOperation`
  - returns `in-progress` state upon first invocation for given
    operation and flags the operation as `done` in the map above
  - on subsequent invocation, `succeeded` state is returned
* Once the last operation succeeds (and is flagged as succeeded in the
  map), `Provision`/`Deprovision`/`Bind`/`Unbind` return `HTTP 200 OK`

* Misc:
  - last operation handler is common for instances and bindings
  - helper functions to implement async responses in a common manner
  - improved logging
@georgethebeatle georgethebeatle merged commit b8e30d6 into main Jan 10, 2025
10 checks passed
@georgethebeatle georgethebeatle deleted the fix-async-bind branch January 10, 2025 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants