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

Proposal to improve bind credential extraction #550

Merged
merged 2 commits into from Nov 14, 2017

Conversation

djzager
Copy link
Member

@djzager djzager commented Nov 13, 2017

A proposal to remove (really deprecate) kubectl exec from bind
credential extraction process.

A proposal to remove (really deprecate) `kubectl exec` from bind
credential extraction process.
@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 13, 2017
@djzager
Copy link
Member Author

djzager commented Nov 13, 2017

Copy link
Contributor

@jmrodri jmrodri left a comment

Choose a reason for hiding this comment

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

One minor sentence change in the problem description. Otherwise, ACK.

[Kubernetes Downward
API](https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/),
APBs have all they need to generate secrets inside the APB sandbox namespace to
be retrieved later by the broker.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would split the last sentence fragment so that it is more clear:

APBs will have all they need to generate secrets inside the APB sandbox namespace. The secret will be retrieved by the broker after the pod finishes.


- [ ] Update the [`asb_encode_binding`
module](https://github.com/ansibleplaybookbundle/ansible-asb-modules/blob/master/library/asb_encode_binding.py)
to create a kubernetes secret in the APB sandbox namespace.
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there any error conditions we need to be able to handle? Anything that could cause the information not to appear in the secret?

Copy link
Member Author

Choose a reason for hiding this comment

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

Could you elaborate more on this. Off the top of my head the only scenario that I would be concerned about would be if we fail to create the secret. I'm struggling to think of a scenario where we would be able to create the secret but it would be empty.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know :) just trying to come up with worst case scenarios. Can creating a secret fail? if we get errors what will happen? will we mark the pod as failed? today if we don't write the creds in the file we return an error code that exec can see. That way the broker knows when to stop looking. If the pod completes, but no secret exists does this mean there are no secrets or that we failed to write them?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. The APB would fail if we couldn't create the secret.

to create a kubernetes secret in the APB sandbox namespace.
- [ ] Update
[`apb-base`](https://github.com/ansibleplaybookbundle/apb-base/tree/master/files/usr/bin):
we no longer need to run `bind-init` or `broker-bind-creds`.
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 to removing the need for these scripts

- [ ] Update
[`apb-base`](https://github.com/ansibleplaybookbundle/apb-base/tree/master/files/usr/bin):
we no longer need to run `bind-init` or `broker-bind-creds`.
- [ ] Bump the APB version to `1.1`. This will prevent older broker's from grabbing
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you bumping the min and the max? or something else? Should newer brokers be able to handle older APBs?

ExtractCredentials`](https://github.com/openshift/ansible-service-broker/blob/8dda3277/pkg/apb/ext_creds.go#L33):
If APB version is `1.0`, do it the way we are currently doing it.
If APB version is `1.1`, 1) watch pod and wait for it to complete 2) evaluate
success/failure of APB execution 3) read credentials from secret.
Copy link
Contributor

Choose a reason for hiding this comment

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

This answers my question above.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 26.319% when pulling a3f6cfb on djzager:prop-apb-gen-creds into 8dda327 on openshift:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 26.319% when pulling ed901d8 on djzager:prop-apb-gen-creds into 8dda327 on openshift:master.

[`pkg/apb/ext_creds.go
ExtractCredentials`](https://github.com/openshift/ansible-service-broker/blob/8dda3277/pkg/apb/ext_creds.go#L33):
If APB version is `1.0`, do it the way we are currently doing it.
If APB version is `1.1`, 1) watch pod and wait for it to complete 2) evaluate
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to deprecate and warn v1.0 APBs?

Copy link
Contributor

Choose a reason for hiding this comment

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

Would this be a major version bump since it breaks compatibility with the 1.0 Broker?

It would be good to have a table somewhere tracking which Broker goes with which APBs that go with which release. Might come in handy.

@jmrodri jmrodri merged commit ea7b117 into openshift:master Nov 14, 2017
djzager pushed a commit to djzager/ansible-service-broker that referenced this pull request Nov 15, 2017
This change makes it so the broker can handle secrets that are created
by APBs when using the `asb_encode_binding` module.

- Update the broker so that it can handle secrets generated by the APB
  when `asb_encode_binding` module is used from the asb-modules.
- Update `executor::ExecuteApb` to wait for pod to complete, since the
  pod is no longer kept alive for credential extraction.
- Clean up some of the log messages and code format related to apb
  actions.

Implements openshift#544 and the proposal openshift#550. Also addresses the potential
issue in openshift#553.

Depends on the following PRs:
- [ansible-asb-modules#8](ansibleplaybookbundle/ansible-asb-modules#8)
  This is how the secret gets generated.
- [apb-base#7](ansibleplaybookbundle/apb-base#7)
  Remove scripts related to extracting credentials from the containers
  filesystem.
- [ansible-playbook-bundle#163](ansibleplaybookbundle/ansible-playbook-bundle#163)
  Bump the APB versions so freshly built APBs will pass version
  validation checks.
djzager pushed a commit to djzager/ansible-service-broker that referenced this pull request Nov 15, 2017
This change makes it so the broker can handle secrets that are created
by APBs when using the `asb_encode_binding` module.

- Update the broker so that it can handle secrets generated by the APB
  when `asb_encode_binding` module is used from the asb-modules.
- Update `executor::ExecuteApb` to wait for pod to complete, since the
  pod is no longer kept alive for credential extraction.
- Clean up some of the log messages and code format related to apb
  actions.

Implements openshift#544 and the proposal openshift#550. Also addresses the potential
issue in openshift#553.

Depends on the following PRs:
- [ansible-asb-modules#8](ansibleplaybookbundle/ansible-asb-modules#8)
  This is how the secret gets generated.
- [apb-base#7](ansibleplaybookbundle/apb-base#7)
  Remove scripts related to extracting credentials from the containers
  filesystem.
- [ansible-playbook-bundle#163](ansibleplaybookbundle/ansible-playbook-bundle#163)
  Bump the APB versions so freshly built APBs will pass version
  validation checks.
djzager added a commit to djzager/ansible-service-broker that referenced this pull request Nov 15, 2017
This change makes it so the broker can handle secrets that are created
by APBs when using the `asb_encode_binding` module.

- Update the broker so that it can handle secrets generated by the APB
  when `asb_encode_binding` module is used from the asb-modules.
- Update `executor::ExecuteApb` to wait for pod to complete, since the
  pod is no longer kept alive for credential extraction.
- Clean up some of the log messages and code format related to apb
  actions.

Fixes openshift#544
Fixes openshift#553
Implements the proposal openshift#550

Depends on the following PRs:
- [ansible-asb-modules#8](ansibleplaybookbundle/ansible-asb-modules#8) This is how the secret gets generated.
- [apb-base#7](ansibleplaybookbundle/apb-base#7) Remove scripts related to extracting credentials from the containers filesystem.
- [ansible-playbook-bundle#163](ansibleplaybookbundle/ansible-playbook-bundle#163) Bump the APB versions so freshly built APBs will pass version validation checks.
djzager added a commit to djzager/ansible-service-broker that referenced this pull request Nov 16, 2017
This change makes it so the broker can handle secrets that are created
by APBs when using the `asb_encode_binding` module.

- Update the broker so that it can handle secrets generated by the APB
  when `asb_encode_binding` module is used from the asb-modules.
- Update `executor::ExecuteApb` to wait for pod to complete, since the
  pod is no longer kept alive for credential extraction.
- Clean up some of the log messages and code format related to apb
  actions.

Fixes openshift#544
Fixes openshift#553
Implements the proposal openshift#550

Depends on the following PRs:
- [ansible-asb-modules#8](ansibleplaybookbundle/ansible-asb-modules#8) This is how the secret gets generated.
- [apb-base#7](ansibleplaybookbundle/apb-base#7) Remove scripts related to extracting credentials from the containers filesystem.
- [ansible-playbook-bundle#163](ansibleplaybookbundle/ansible-playbook-bundle#163) Bump the APB versions so freshly built APBs will pass version validation checks.
djzager added a commit to djzager/ansible-service-broker that referenced this pull request Nov 20, 2017
This change makes it so the broker can handle secrets that are created
by APBs when using the `asb_encode_binding` module.

- Update the broker so that it can handle secrets generated by the APB
  when `asb_encode_binding` module is used from the asb-modules.
- Update `executor::ExecuteApb` to wait for pod to complete, since the
  pod is no longer kept alive for credential extraction.
- Clean up some of the log messages and code format related to apb
  actions.

Fixes openshift#544
Fixes openshift#553
Implements the proposal openshift#550

Depends on the following PRs:
- [ansible-asb-modules#8](ansibleplaybookbundle/ansible-asb-modules#8) This is how the secret gets generated.
- [apb-base#7](ansibleplaybookbundle/apb-base#7) Remove scripts related to extracting credentials from the containers filesystem.
- [ansible-playbook-bundle#163](ansibleplaybookbundle/ansible-playbook-bundle#163) Bump the APB versions so freshly built APBs will pass version validation checks.
djzager added a commit to djzager/ansible-service-broker that referenced this pull request Nov 22, 2017
This change makes it so the broker can handle secrets that are created
by APBs when using the `asb_encode_binding` module.

- Update the broker so that it can handle secrets generated by the APB
  when `asb_encode_binding` module is used from the asb-modules.
- Update `executor::ExecuteApb` to wait for pod to complete, since the
  pod is no longer kept alive for credential extraction.
- Clean up some of the log messages and code format related to apb
  actions.

Fixes openshift#544
Fixes openshift#553
Implements the proposal openshift#550

Depends on the following PRs:
- [ansible-asb-modules#8](ansibleplaybookbundle/ansible-asb-modules#8) This is how the secret gets generated.
- [apb-base#7](ansibleplaybookbundle/apb-base#7) Remove scripts related to extracting credentials from the containers filesystem.
- [ansible-playbook-bundle#163](ansibleplaybookbundle/ansible-playbook-bundle#163) Bump the APB versions so freshly built APBs will pass version validation checks.
djzager added a commit to djzager/ansible-service-broker that referenced this pull request Nov 29, 2017
This change makes it so the broker can handle secrets that are created
by APBs when using the `asb_encode_binding` module.

- Update the broker so that it can handle secrets generated by the APB
  when `asb_encode_binding` module is used from the asb-modules.
- Update `executor::ExecuteApb` to wait for pod to complete, since the
  pod is no longer kept alive for credential extraction.
- Clean up some of the log messages and code format related to apb
  actions.

Fixes openshift#544
Fixes openshift#553
Implements the proposal openshift#550

Depends on the following PRs:
- [ansible-asb-modules#8](ansibleplaybookbundle/ansible-asb-modules#8) This is how the secret gets generated.
- [apb-base#7](ansibleplaybookbundle/apb-base#7) Remove scripts related to extracting credentials from the containers filesystem.
- [ansible-playbook-bundle#163](ansibleplaybookbundle/ansible-playbook-bundle#163) Bump the APB versions so freshly built APBs will pass version validation checks.
djzager added a commit to djzager/ansible-service-broker that referenced this pull request Nov 29, 2017
This change makes it so the broker can handle secrets that are created
by APBs when using the `asb_encode_binding` module.

- Update the broker so that it can handle secrets generated by the APB
  when `asb_encode_binding` module is used from the asb-modules.
- Update `executor::ExecuteApb` to wait for pod to complete, since the
  pod is no longer kept alive for credential extraction.
- Clean up some of the log messages and code format related to apb
  actions.

Fixes openshift#544
Fixes openshift#553
Implements the proposal openshift#550

Depends on the following PRs:
- [ansible-asb-modules#8](ansibleplaybookbundle/ansible-asb-modules#8) This is how the secret gets generated.
- [apb-base#7](ansibleplaybookbundle/apb-base#7) Remove scripts related to extracting credentials from the containers filesystem.
- [ansible-playbook-bundle#163](ansibleplaybookbundle/ansible-playbook-bundle#163) Bump the APB versions so freshly built APBs will pass version validation checks.
djzager added a commit to djzager/ansible-service-broker that referenced this pull request Dec 4, 2017
This change makes it so the broker can handle secrets that are created
by APBs when using the `asb_encode_binding` module.

- Update the broker so that it can handle secrets generated by the APB
  when `asb_encode_binding` module is used from the asb-modules.
- Update `executor::ExecuteApb` to wait for pod to complete, since the
  pod is no longer kept alive for credential extraction.
- Clean up some of the log messages and code format related to apb
  actions.

Fixes openshift#544
Fixes openshift#553
Implements the proposal openshift#550

Depends on the following PRs:
- [ansible-asb-modules#8](ansibleplaybookbundle/ansible-asb-modules#8) This is how the secret gets generated.
- [apb-base#7](ansibleplaybookbundle/apb-base#7) Remove scripts related to extracting credentials from the containers filesystem.
- [ansible-playbook-bundle#163](ansibleplaybookbundle/ansible-playbook-bundle#163) Bump the APB versions so freshly built APBs will pass version validation checks.
rthallisey pushed a commit that referenced this pull request Dec 4, 2017
* Broker should extract credentials from secret

This change makes it so the broker can handle secrets that are created
by APBs when using the `asb_encode_binding` module.

- Update the broker so that it can handle secrets generated by the APB
  when `asb_encode_binding` module is used from the asb-modules.
- Update `executor::ExecuteApb` to wait for pod to complete, since the
  pod is no longer kept alive for credential extraction.
- Clean up some of the log messages and code format related to apb
  actions.

Fixes #544
Fixes #553
Implements the proposal #550

Depends on the following PRs:
- [ansible-asb-modules#8](ansibleplaybookbundle/ansible-asb-modules#8) This is how the secret gets generated.
- [apb-base#7](ansibleplaybookbundle/apb-base#7) Remove scripts related to extracting credentials from the containers filesystem.
- [ansible-playbook-bundle#163](ansibleplaybookbundle/ansible-playbook-bundle#163) Bump the APB versions so freshly built APBs will pass version validation checks.

* Add APB runtime version to our APB Spec object

Update the broker to evaluate the `com.redhat.apb.runtime` label on APBs
(default to `1` when there is no label). Add version checking of this
new min/max apb runtime version and update associated tests.

* Handle bind credential extraction based on runtime

Update apb execution to be handle multiple apb runtime versions.

* Fixing log statements

* Only decode bind creds if encoded

Secrets retrieved using client-go are already decoded. So the extract
credentials function has been updated to only attempt to decode the
credentials if they need it.

Also changed the `log.Error` when the APB completed to a `log.Notice`
since it is not a failure.

* Pull k8s API call to get pod status into k8s client

* Cleanup extract credentials based on comments

* Update proposal based on what is implemented

* Improve adapter log info on apb runtime eval

* Fixes after rebase

* Address review comments and fix unit tests

* Ask for the k8s client when we need it

* Use canary APB images
jianzhangbjz pushed a commit to jianzhangbjz/ansible-service-broker that referenced this pull request May 17, 2018
* Broker should extract credentials from secret

This change makes it so the broker can handle secrets that are created
by APBs when using the `asb_encode_binding` module.

- Update the broker so that it can handle secrets generated by the APB
  when `asb_encode_binding` module is used from the asb-modules.
- Update `executor::ExecuteApb` to wait for pod to complete, since the
  pod is no longer kept alive for credential extraction.
- Clean up some of the log messages and code format related to apb
  actions.

Fixes openshift#544
Fixes openshift#553
Implements the proposal openshift#550

Depends on the following PRs:
- [ansible-asb-modules#8](ansibleplaybookbundle/ansible-asb-modules#8) This is how the secret gets generated.
- [apb-base#7](ansibleplaybookbundle/apb-base#7) Remove scripts related to extracting credentials from the containers filesystem.
- [ansible-playbook-bundle#163](ansibleplaybookbundle/ansible-playbook-bundle#163) Bump the APB versions so freshly built APBs will pass version validation checks.

* Add APB runtime version to our APB Spec object

Update the broker to evaluate the `com.redhat.apb.runtime` label on APBs
(default to `1` when there is no label). Add version checking of this
new min/max apb runtime version and update associated tests.

* Handle bind credential extraction based on runtime

Update apb execution to be handle multiple apb runtime versions.

* Fixing log statements

* Only decode bind creds if encoded

Secrets retrieved using client-go are already decoded. So the extract
credentials function has been updated to only attempt to decode the
credentials if they need it.

Also changed the `log.Error` when the APB completed to a `log.Notice`
since it is not a failure.

* Pull k8s API call to get pod status into k8s client

* Cleanup extract credentials based on comments

* Update proposal based on what is implemented

* Improve adapter log info on apb runtime eval

* Fixes after rebase

* Address review comments and fix unit tests

* Ask for the k8s client when we need it

* Use canary APB images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants