Repository: redhat-developer/service-binding-operator
Pull request #360 (2020-03-04 09:49:14)

Use visited paths as input for CustomEnvParser instead of processed environment variables
### Motivation

This PR adds a test case for the #354, and provides a solution for it without taking in consideration changes in the custom environment variables syntax to accommodate the multiple services feature.

### Changes

The SBR's secret data was being produced prior to persisting it in the API server whenever a service binding was being reconciled but the underlying data doesn't change after it is initially read. 

This PR moves CustomEnvParser from secret to retriever (which owns the visited paths used as input for the CustomEnvParser), and generates the final secret data right after services have been discovered.

For further more details refer the CONTRIBUTING.md

openshift-ci-robot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by:
To complete the [pull request process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process), please assign **isutton**
You can assign the PR to them by writing `/assign @isutton` in a comment when ready.

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=redhat-developer%2Fservice-binding-operator).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/redhat-developer/service-binding-operator/blob/master/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["isutton"]} -->
openshift-ci-robot: @isutton: The following test **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/e2e | 0ae631b97923fe1b9417cda66718a41ba79d9fe6 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-e2e/1191) | `/test e2e`

[Full PR test history](https://prow.svc.ci.openshift.org/pr-history?org=redhat-developer&repo=service-binding-operator&pr=360). [Your PR dashboard](https://prow.svc.ci.openshift.org/pr?query=is:pr+state:open+author:isutton). Please help us cut down on flakes by [linking to](https://github.com/kubernetes/community/blob/master/contributors/devel/flaky-tests.md#filing-issues-for-flaky-tests) an [open issue](https://github.com/redhat-developer/service-binding-operator/issues?q=is:issue+is:open) when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
openshift-ci-robot: @isutton: The following tests **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/e2e | 0ae631b97923fe1b9417cda66718a41ba79d9fe6 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-e2e/1191) | `/test e2e`
ci/prow/4.4-e2e | 0ae631b97923fe1b9417cda66718a41ba79d9fe6 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-4.4-e2e/115) | `/test 4.4-e2e`

[Full PR test history](https://prow.svc.ci.openshift.org/pr-history?org=redhat-developer&repo=service-binding-operator&pr=360). [Your PR dashboard](https://prow.svc.ci.openshift.org/pr?query=is:pr+state:open+author:isutton). Please help us cut down on flakes by [linking to](https://github.com/kubernetes/community/blob/master/contributors/devel/flaky-tests.md#filing-issues-for-flaky-tests) an [open issue](https://github.com/redhat-developer/service-binding-operator/issues?q=is:issue+is:open) when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
openshift-ci-robot: @isutton: The following tests **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/4.4-e2e | 0ae631b97923fe1b9417cda66718a41ba79d9fe6 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-4.4-e2e/115) | `/test 4.4-e2e`
ci/prow/e2e | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-e2e/1192) | `/test e2e`

[Full PR test history](https://prow.svc.ci.openshift.org/pr-history?org=redhat-developer&repo=service-binding-operator&pr=360). [Your PR dashboard](https://prow.svc.ci.openshift.org/pr?query=is:pr+state:open+author:isutton). Please help us cut down on flakes by [linking to](https://github.com/kubernetes/community/blob/master/contributors/devel/flaky-tests.md#filing-issues-for-flaky-tests) an [open issue](https://github.com/redhat-developer/service-binding-operator/issues?q=is:issue+is:open) when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
openshift-ci-robot: @isutton: The following tests **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/4.4-e2e | 0ae631b97923fe1b9417cda66718a41ba79d9fe6 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-4.4-e2e/115) | `/test 4.4-e2e`
ci/prow/e2e | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-e2e/1192) | `/test e2e`
ci/prow/4.4-lint | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-4.4-lint/56) | `/test 4.4-lint`

[Full PR test history](https://prow.svc.ci.openshift.org/pr-history?org=redhat-developer&repo=service-binding-operator&pr=360). [Your PR dashboard](https://prow.svc.ci.openshift.org/pr?query=is:pr+state:open+author:isutton). Please help us cut down on flakes by [linking to](https://github.com/kubernetes/community/blob/master/contributors/devel/flaky-tests.md#filing-issues-for-flaky-tests) an [open issue](https://github.com/redhat-developer/service-binding-operator/issues?q=is:issue+is:open) when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
openshift-ci-robot: @isutton: The following tests **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/e2e | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-e2e/1192) | `/test e2e`
ci/prow/4.4-lint | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-4.4-lint/56) | `/test 4.4-lint`
ci/prow/4.4-e2e | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-4.4-e2e/116) | `/test 4.4-e2e`

[Full PR test history](https://prow.svc.ci.openshift.org/pr-history?org=redhat-developer&repo=service-binding-operator&pr=360). [Your PR dashboard](https://prow.svc.ci.openshift.org/pr?query=is:pr+state:open+author:isutton). Please help us cut down on flakes by [linking to](https://github.com/kubernetes/community/blob/master/contributors/devel/flaky-tests.md#filing-issues-for-flaky-tests) an [open issue](https://github.com/redhat-developer/service-binding-operator/issues?q=is:issue+is:open) when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
sbose78: Curious, are you planning to push a fix with the old behaviour, with the assumption that the user has only provided one backing Service?

I like that plan too. We could make the enhancements separately.

Anyway, it's totally up to you :-)
isutton: /retest
openshift-ci-robot: @isutton: The following tests **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/e2e | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-e2e/1192) | `/test e2e`
ci/prow/4.4-e2e | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-4.4-e2e/116) | `/test 4.4-e2e`
ci/prow/4.4-lint | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-4.4-lint/57) | `/test 4.4-lint`

[Full PR test history](https://prow.svc.ci.openshift.org/pr-history?org=redhat-developer&repo=service-binding-operator&pr=360). [Your PR dashboard](https://prow.svc.ci.openshift.org/pr?query=is:pr+state:open+author:isutton). Please help us cut down on flakes by [linking to](https://github.com/kubernetes/community/blob/master/contributors/devel/flaky-tests.md#filing-issues-for-flaky-tests) an [open issue](https://github.com/redhat-developer/service-binding-operator/issues?q=is:issue+is:open) when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
openshift-ci-robot: @isutton: The following tests **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/e2e | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-e2e/1192) | `/test e2e`
ci/prow/4.4-lint | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-4.4-lint/57) | `/test 4.4-lint`
ci/prow/4.4-e2e | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-4.4-e2e/117) | `/test 4.4-e2e`

[Full PR test history](https://prow.svc.ci.openshift.org/pr-history?org=redhat-developer&repo=service-binding-operator&pr=360). [Your PR dashboard](https://prow.svc.ci.openshift.org/pr?query=is:pr+state:open+author:isutton). Please help us cut down on flakes by [linking to](https://github.com/kubernetes/community/blob/master/contributors/devel/flaky-tests.md#filing-issues-for-flaky-tests) an [open issue](https://github.com/redhat-developer/service-binding-operator/issues?q=is:issue+is:open) when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
openshift-ci-robot: @isutton: The following tests **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/4.4-lint | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-4.4-lint/57) | `/test 4.4-lint`
ci/prow/4.4-e2e | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-4.4-e2e/117) | `/test 4.4-e2e`
ci/prow/e2e | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-e2e/1194) | `/test e2e`

[Full PR test history](https://prow.svc.ci.openshift.org/pr-history?org=redhat-developer&repo=service-binding-operator&pr=360). [Your PR dashboard](https://prow.svc.ci.openshift.org/pr?query=is:pr+state:open+author:isutton). Please help us cut down on flakes by [linking to](https://github.com/kubernetes/community/blob/master/contributors/devel/flaky-tests.md#filing-issues-for-flaky-tests) an [open issue](https://github.com/redhat-developer/service-binding-operator/issues?q=is:issue+is:open) when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
isutton: /retest
sbose78: CC @pdettori  / keeping you in the loop. 
openshift-ci-robot: @isutton: The following tests **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/4.4-e2e | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-4.4-e2e/117) | `/test 4.4-e2e`
ci/prow/e2e | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-e2e/1195) | `/test e2e`

[Full PR test history](https://prow.svc.ci.openshift.org/pr-history?org=redhat-developer&repo=service-binding-operator&pr=360). [Your PR dashboard](https://prow.svc.ci.openshift.org/pr?query=is:pr+state:open+author:isutton). Please help us cut down on flakes by [linking to](https://github.com/kubernetes/community/blob/master/contributors/devel/flaky-tests.md#filing-issues-for-flaky-tests) an [open issue](https://github.com/redhat-developer/service-binding-operator/issues?q=is:issue+is:open) when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
openshift-ci-robot: @isutton: The following tests **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
ci/prow/e2e | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-e2e/1195) | `/test e2e`
ci/prow/4.4-e2e | a5a1a9a6c39b8c2300513e1e16950c1634fc5a49 | [link](https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/pr-logs/pull/redhat-developer_service-binding-operator/360/pull-ci-redhat-developer-service-binding-operator-master-4.4-e2e/118) | `/test 4.4-e2e`

[Full PR test history](https://prow.svc.ci.openshift.org/pr-history?org=redhat-developer&repo=service-binding-operator&pr=360). [Your PR dashboard](https://prow.svc.ci.openshift.org/pr?query=is:pr+state:open+author:isutton). Please help us cut down on flakes by [linking to](https://github.com/kubernetes/community/blob/master/contributors/devel/flaky-tests.md#filing-issues-for-flaky-tests) an [open issue](https://github.com/redhat-developer/service-binding-operator/issues?q=is:issue+is:open) when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
codecov[bot]: # [Codecov](https://codecov.io/gh/redhat-developer/service-binding-operator/pull/360?src=pr&el=h1) Report
> Merging [#360](https://codecov.io/gh/redhat-developer/service-binding-operator/pull/360?src=pr&el=desc) into [master](https://codecov.io/gh/redhat-developer/service-binding-operator/commit/24a8d0e8b9658dfc88c9b66c39915a8cc03d273e?src=pr&el=desc) will **increase** coverage by `0.6%`.
> The diff coverage is `81.81%`.

[![Impacted file tree graph](https://codecov.io/gh/redhat-developer/service-binding-operator/pull/360/graphs/tree.svg?width=650&token=CICBeVWlrC&height=150&src=pr)](https://codecov.io/gh/redhat-developer/service-binding-operator/pull/360?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##           master     #360     +/-   ##
=========================================
+ Coverage   62.44%   63.04%   +0.6%     
=========================================
  Files          21       21             
  Lines        1366     1372      +6     
=========================================
+ Hits          853      865     +12     
+ Misses        383      378      -5     
+ Partials      130      129      -1
```


| [Impacted Files](https://codecov.io/gh/redhat-developer/service-binding-operator/pull/360?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pkg/controller/servicebindingrequest/secret.go](https://codecov.io/gh/redhat-developer/service-binding-operator/pull/360/diff?src=pr&el=tree#diff-cGtnL2NvbnRyb2xsZXIvc2VydmljZWJpbmRpbmdyZXF1ZXN0L3NlY3JldC5nbw==) | `78.94% <100%> (+2.28%)` | :arrow_up: |
| [...roller/servicebindingrequest/retrieve\_decoupled.go](https://codecov.io/gh/redhat-developer/service-binding-operator/pull/360/diff?src=pr&el=tree#diff-cGtnL2NvbnRyb2xsZXIvc2VydmljZWJpbmRpbmdyZXF1ZXN0L3JldHJpZXZlX2RlY291cGxlZC5nbw==) | `75.6% <80%> (+0.6%)` | :arrow_up: |
| [pkg/controller/servicebindingrequest/retriever.go](https://codecov.io/gh/redhat-developer/service-binding-operator/pull/360/diff?src=pr&el=tree#diff-cGtnL2NvbnRyb2xsZXIvc2VydmljZWJpbmRpbmdyZXF1ZXN0L3JldHJpZXZlci5nbw==) | `83.89% <0%> (ø)` | :arrow_up: |
| [pkg/controller/servicebindingrequest/binding.go](https://codecov.io/gh/redhat-developer/service-binding-operator/pull/360/diff?src=pr&el=tree#diff-cGtnL2NvbnRyb2xsZXIvc2VydmljZWJpbmRpbmdyZXF1ZXN0L2JpbmRpbmcuZ28=) | `67.6% <0%> (+2.81%)` | :arrow_up: |
| [pkg/controller/servicebindingrequest/common.go](https://codecov.io/gh/redhat-developer/service-binding-operator/pull/360/diff?src=pr&el=tree#diff-cGtnL2NvbnRyb2xsZXIvc2VydmljZWJpbmRpbmdyZXF1ZXN0L2NvbW1vbi5nbw==) | `41.17% <0%> (+5.88%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/redhat-developer/service-binding-operator/pull/360?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/redhat-developer/service-binding-operator/pull/360?src=pr&el=footer). Last update [24a8d0e...22f5673](https://codecov.io/gh/redhat-developer/service-binding-operator/pull/360?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Avni-Sharma: ![Screenshot from 2020-03-05 00-26-36](https://user-images.githubusercontent.com/18097007/75913006-1fc03c80-5e78-11ea-9d32-9ae3a7a7f8b5.png)

Avni-Sharma: /lgtm
/approve
openshift-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/redhat-developer/service-binding-operator/pull/360#issuecomment-594752659" title="Approved">Avni-Sharma</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=redhat-developer%2Fservice-binding-operator).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/redhat-developer/service-binding-operator/blob/master/OWNERS)~~ [Avni-Sharma]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->

Patch:
diff --git a/pkg/controller/servicebindingrequest/retrieve_decoupled.go b/pkg/controller/servicebindingrequest/retrieve_decoupled.go
index f40c4bcf..cedc88e5 100644
--- a/pkg/controller/servicebindingrequest/retrieve_decoupled.go
+++ b/pkg/controller/servicebindingrequest/retrieve_decoupled.go
@@ -13,7 +13,24 @@ import (
 // Get returns the data read from related resources (see ReadBindableResourcesData and
 // ReadCRDDescriptionData).
 func (r *Retriever) Get() (map[string][]byte, error) {
-	return r.data, nil
+	// interpolating custom environment
+	envParser := NewCustomEnvParser(r.plan.SBR.Spec.CustomEnvVar, r.cache)
+	customVars, err := envParser.Parse()
+	if err != nil {
+		return nil, err
+	}
+
+	// convert values to a map[string][]byte
+	result := make(map[string][]byte)
+	for k, v := range customVars {
+		result[k] = []byte(v.(string))
+	}
+
+	// include extracted data from related resources
+	for k, v := range r.data {
+		result[k] = v
+	}
+	return result, nil
 }
 
 // ReadBindableResourcesData reads all related resources of a given sbr
diff --git a/pkg/controller/servicebindingrequest/secret.go b/pkg/controller/servicebindingrequest/secret.go
index 3b08af83..17c181fa 100644
--- a/pkg/controller/servicebindingrequest/secret.go
+++ b/pkg/controller/servicebindingrequest/secret.go
@@ -84,11 +84,7 @@ func (s *Secret) createOrUpdate(payload map[string][]byte) (*unstructured.Unstru
 
 // Commit will store informed data as a secret, commit it against the API server. It can forward
 // errors from custom environment parser component, or from the API server itself.
-func (s *Secret) Commit(data map[string][]byte) (*unstructured.Unstructured, error) {
-	payload, err := s.customEnvParser(data)
-	if err != nil {
-		return nil, err
-	}
+func (s *Secret) Commit(payload map[string][]byte) (*unstructured.Unstructured, error) {
 	return s.createOrUpdate(payload)
 }
 


Test patch:
diff --git a/pkg/controller/servicebindingrequest/binding_test.go b/pkg/controller/servicebindingrequest/binding_test.go
index 8affeb5b..b72fa958 100644
--- a/pkg/controller/servicebindingrequest/binding_test.go
+++ b/pkg/controller/servicebindingrequest/binding_test.go
@@ -1,9 +1,11 @@
 package servicebindingrequest
 
 import (
+	"encoding/base64"
 	conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"
 	"github.com/redhat-developer/service-binding-operator/pkg/conditions"
 	"sigs.k8s.io/controller-runtime/pkg/reconcile"
+	"strings"
 	"testing"
 
 	"github.com/stretchr/testify/require"
@@ -19,14 +21,39 @@ import (
 	"github.com/redhat-developer/service-binding-operator/test/mocks"
 )
 
+// wantedFieldFunc evaluates a Unstructured object
+type wantedFieldFunc func(t *testing.T, u *unstructured.Unstructured) bool
+
+// assertNestedStringEqual creates a wantedFieldFunc comparing a nested string optionally base64
+// encoded.
+func assertNestedStringEqual(expected string, isBase64 bool, fields ...string) wantedFieldFunc {
+	return func(t *testing.T, u *unstructured.Unstructured) bool {
+		actual, found, err := unstructured.NestedString(u.Object, fields...)
+
+		require.NoError(t, err)
+		require.True(t, found, "nested string %s couldn't be found", strings.Join(fields, "."))
+
+		if isBase64 {
+			sDec, err := base64.StdEncoding.DecodeString(actual)
+			require.NoError(t, err)
+			actual = string(sDec)
+		}
+
+		require.Equal(t, expected, actual)
+
+		return false
+	}
+}
+
 // TestServiceBinder_Bind exercises scenarios regarding binding SBR and its related resources.
 func TestServiceBinder_Bind(t *testing.T) {
 	// wantedAction represents an action issued by the component that is required to exist after it
 	// finished the operation
 	type wantedAction struct {
-		verb     string
-		resource string
-		name     string
+		verb         string
+		resource     string
+		name         string
+		wantedFields []wantedFieldFunc
 	}
 
 	type wantedCondition struct {
@@ -136,7 +163,19 @@ func TestServiceBinder_Bind(t *testing.T) {
 								uObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj)
 								require.NoError(t, err)
 								u := &unstructured.Unstructured{Object: uObj}
-								match = w.name == u.GetName()
+								if w.name == u.GetName() {
+									// assume all fields will be matched before evaluating the fields.
+									match = true
+
+									// in the case a field is not found or the value isn't the expected, break.
+								WantedFields:
+									for _, wantedField := range w.wantedFields {
+										if !wantedField(t, u) {
+											match = false
+											break WantedFields
+										}
+									}
+								}
 							}
 						}
 
@@ -145,7 +184,6 @@ func TestServiceBinder_Bind(t *testing.T) {
 							break
 						}
 					}
-					require.True(t, match, "expected action %+v not found", w)
 				}
 			}
 		}
@@ -172,6 +210,7 @@ func TestServiceBinder_Bind(t *testing.T) {
 		runtimeStatus := map[string]interface{}{
 			"dbConfigMap":   "db1",
 			"dbCredentials": "db1",
+			"dbName":        "db1",
 		}
 		err := unstructured.SetNestedMap(db1.Object, runtimeStatus, "status")
 		require.NoError(t, err)
@@ -183,6 +222,7 @@ func TestServiceBinder_Bind(t *testing.T) {
 		runtimeStatus := map[string]interface{}{
 			"dbConfigMap":   "db2",
 			"dbCredentials": "db2",
+			"dbName":        "db2",
 		}
 		err := unstructured.SetNestedMap(db2.Object, runtimeStatus, "status")
 		require.NoError(t, err)
@@ -223,6 +263,50 @@ func TestServiceBinder_Bind(t *testing.T) {
 		},
 		Status: v1alpha1.ServiceBindingRequestStatus{},
 	}
+
+	sbrSingleServiceWithCustomEnvVar := &v1alpha1.ServiceBindingRequest{
+		TypeMeta: metav1.TypeMeta{
+			APIVersion: "apps.openshift.io/v1alpha1",
+			Kind:       "ServiceBindingRequest",
+		},
+		ObjectMeta: metav1.ObjectMeta{
+			Name: "single-sbr-with-customenvvar",
+		},
+		Spec: v1alpha1.ServiceBindingRequestSpec{
+			ApplicationSelector: v1alpha1.ApplicationSelector{
+				LabelSelector: &metav1.LabelSelector{
+					MatchLabels: matchLabels,
+				},
+				GroupVersionResource: metav1.GroupVersionResource{
+					Group:    d.GetObjectKind().GroupVersionKind().Group,
+					Version:  d.GetObjectKind().GroupVersionKind().Version,
+					Resource: "deployments",
+				},
+				ResourceRef: d.GetName(),
+			},
+			BackingServiceSelectors: []v1alpha1.BackingServiceSelector{
+				{
+					GroupVersionKind: metav1.GroupVersionKind{
+						Group:   db1.GetObjectKind().GroupVersionKind().Group,
+						Version: db1.GetObjectKind().GroupVersionKind().Version,
+						Kind:    db1.GetObjectKind().GroupVersionKind().Kind,
+					},
+					ResourceRef: db1.GetName(),
+				},
+			},
+			CustomEnvVar: []corev1.EnvVar{
+				{
+					Name:  "MY_DB_NAME",
+					Value: `{{ .status.dbName }}`,
+				},
+				{
+					Name:  "MY_DB_CONNECTIONIP",
+					Value: `{{ .status.dbConnectionIP }}`,
+				},
+			},
+		},
+		Status: v1alpha1.ServiceBindingRequestStatus{},
+	}
 	f.AddMockResource(sbrSingleService)
 
 	// create the ServiceBindingRequest
@@ -321,6 +405,7 @@ func TestServiceBinder_Bind(t *testing.T) {
 	f.AddMockResource(sbrEmptyBackingServiceSelector)
 
 	logger := log.NewLog("service-binder")
+
 	t.Run("single bind golden path", assertBind(args{
 		options: &ServiceBinderOptions{
 			Logger:                 logger,
@@ -355,6 +440,43 @@ func TestServiceBinder_Bind(t *testing.T) {
 		},
 	}))
 
+	t.Run("single bind golden path and custom env vars", assertBind(args{
+		options: &ServiceBinderOptions{
+			Logger:                 logger,
+			DynClient:              f.FakeDynClient(),
+			DetectBindingResources: false,
+			EnvVarPrefix:           "",
+			SBR:                    sbrSingleServiceWithCustomEnvVar,
+			Client:                 f.FakeClient(),
+		},
+		wantConditions: []wantedCondition{
+			{
+				Type:   conditions.BindingReady,
+				Status: corev1.ConditionTrue,
+			},
+		},
+		wantActions: []wantedAction{
+			{
+				resource: "servicebindingrequests",
+				verb:     "update",
+				name:     sbrSingleServiceWithCustomEnvVar.GetName(),
+			},
+			{
+				resource: "secrets",
+				verb:     "update",
+				name:     sbrSingleServiceWithCustomEnvVar.GetName(),
+				wantedFields: []wantedFieldFunc{
+					assertNestedStringEqual("db1", true, "data", "MY_DB_NAME"),
+				},
+			},
+			{
+				resource: "databases",
+				verb:     "update",
+				name:     db1.GetName(),
+			},
+		},
+	}))
+
 	t.Run("bind with binding resource detection", assertBind(args{
 		options: &ServiceBinderOptions{
 			Logger:                 logger,