-
Notifications
You must be signed in to change notification settings - Fork 89
Streamline data retrieval based on annotations #407
Streamline data retrieval based on annotations #407
Conversation
Thank you! |
Codecov Report
@@ Coverage Diff @@
## master #407 +/- ##
==========================================
- Coverage 66.26% 63.07% -3.19%
==========================================
Files 21 27 +6
Lines 1479 1774 +295
==========================================
+ Hits 980 1119 +139
- Misses 377 489 +112
- Partials 122 166 +44
Continue to review full report at Codecov.
|
Could you add a description and title on what to expect in the code, please? |
Could you limit this PR to only changes to custom env var handling ? There are a lot of discussions on annotations going on ( will link), and it would be nice to have them settle before we introduce new things :) |
This PR will deliver that once the data is properly collected and sorted.
To properly collect and sort the related data, some internal re-arranging
is required, and this is the stage this PR is at this point.
No changes in annotations semantics are going to be implemented in this PR.
… |
I want to review this bad but I'd like to have a description :-) |
@isutton Can we please have proper description for this PR? |
pkg/controller/servicebindingrequest/bindinginfo/bindinginfo_test.go
Outdated
Show resolved
Hide resolved
2f27151
to
e6fce56
Compare
@redhat-developer/service-binding Please review. |
/retest |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: baijum The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
Sorry for the late reply on this, comments should have been addressed before merging! But, since in the cabal meeting of yesterday, we've decided to have this merged and address the open comments in dedicated issues/PRs:
We've spoken about this yesterday. But, let's make sure #462 gets priority, so we can address this concern promptly. |
If I may summarize what we've discussed yesterday, the points were:
Please correct if I'm missing something, and lets all make sure concerts are addressed properly. |
They could have, but I considered those less urgent than enabling developers needing to work in the project; instead I created GitHub issues grouping related review comments
Same as above, they could have, but I considered those less urgent. Now that the PR is merged, I will do the cleanup meanwhile the rest of the team can do more interesting things such as implement the Service Binding Spec annotations, or make sure errors and warnings are being properly surfaced to the user through proper channels such as events and conditions. Hope I have informed you well :) |
This change adjusts the visibility of symbols in the entire project; the visibility has been raised several moments during review of redhat-developer#407 and tracked in redhat-developer#462 after redhat-developer#407 has been merged. Because of the nature of the change, some variables have been renamed to avoid value shadowing when the variable name is identical to the type name (e.g. 'binder := &binder{}'). Closes redhat-developer#462
This change adjusts the visibility of symbols in the entire project; the visibility has been raised several moments during review of redhat-developer#407 and tracked in redhat-developer#462 after redhat-developer#407 has been merged. Because of the nature of the change, some variables have been renamed to avoid value shadowing when the variable name is identical to the type name (e.g. 'binder := &binder{}'). Closes redhat-developer#462
This change adjusts the visibility of symbols in the entire project; the visibility has been raised several moments during review of redhat-developer#407 and tracked in redhat-developer#462 after redhat-developer#407 has been merged. Because of the nature of the change, some variables have been renamed to avoid value shadowing when the variable name is identical to the type name (e.g. 'binder := &binder{}'). Closes redhat-developer#462
This change adjusts the visibility of symbols in the entire project; the visibility has been raised several moments during review of redhat-developer#407 and tracked in redhat-developer#462 after redhat-developer#407 has been merged. Because of the nature of the change, some variables have been renamed to avoid value shadowing when the variable name is identical to the type name (e.g. 'binder := &binder{}'). Closes redhat-developer#462
This change adjusts the visibility of symbols in the entire project; the visibility has been raised several moments during review of redhat-developer#407 and tracked in redhat-developer#462 after redhat-developer#407 has been merged. Because of the nature of the change, some variables have been renamed to avoid value shadowing when the variable name is identical to the type name (e.g. 'binder := &binder{}'). Closes redhat-developer#462
…om environment variables With the configuration values collection and aggregation solved in redhat-developer#407, this change introduces the id field in backing service selectors to be used as alias while composing custom environment variables. Solves redhat-developer#396 PR redhat-developer#407 has grouped service configuration values in the template context using the following the version, api group, kind and name (for example {{ .v1alpha1.postgresql_baiju_dev.Database.db_testing.status.dbConnection }}). This change groups service configuration values in the template context using the optional id field declared by the user, allowing the user to write {{ .db_testing.status.dbConnection }} instead.
…om environment variables (#468) With the configuration values collection and aggregation solved in #407, this change introduces the id field in backing service selectors to be used as alias while composing custom environment variables. Solves #396 PR #407 has grouped service configuration values in the template context using the following the version, api group, kind and name (for example {{ .v1alpha1.postgresql_baiju_dev.Database.db_testing.status.dbConnection }}). This change groups service configuration values in the template context using the optional id field declared by the user, allowing the user to write {{ .db_testing.status.dbConnection }} instead.
fixes https://issues.redhat.com/browse/APPSVC-493
Motivation
Changes
Some existing components have been simplified and several others have been removed in order to reduce the number of indirections in the system.
The
annotations
package has been created to group all annotation related symbols.annotations.Handler
is an interface specifying the annotation handler contract, which is responsible for processing a single annotation key and value pairs as for example.../status.dbConnectionIP
andbinding:env:attribute
; an instance can be obtained throughannotations.BuildHandler()
.There are currently two annotation handlers:
annotations.AttributeHandler
andannotations.ResourceHandler
. The handlers return aResult
containing the data produced by the annotation inData
, which is stored in a deep structure with the root path found in thePath
field. Additionally the binding type (whether volume mounts or environment variables should be used) is present in theType
field.The
AttributeHandler
is used to collect a value from the object where the annotation is declared; for example, in the example.../status.dbConnectionIP
andbinding:env:attribute
annotation pair the data found in the simple JSONPathstatus.dbConnectionIP
will be extracted from the object. On the other hand, theResourceHandler
is used to collect information present in another external resource, for example a config map or a secret; in the.../status.dbCredentials-user
andbinding:env:object:configmap
annotation pairs example, thedata.user
field from the config map resource which name is present instatus.dbCredentials
will be extracted.The
envvars
package contains tooling to constructmap[string][]byte
data-structures from an arbitrarily nestedmap[string]interface{}
value.The
nested
package contains utilities to extract the arbitrarily deep data-structures in the annotation handlers.Since the whole data extraction process has been modified to provide the testing baseline, this change also includes support for custom environment variable templates such as
{{ index "v1alpha1" "postgresql.baiju.dev" "Database" "db-testing" "metadata" "name" }}
and{{ .v1alpha1.postgresql_baiju_dev.Database.db_testing.metadata.name }}
.Test coverage should be improved, and internals should keep to be simplified in subsequent work units, such as:
ServiceBinder
andBinder
can be further simplified.Testing
Currently the only tests being amended are unit tests. Once integration is more mature, e2e tests will be used to guarantee the behavior hasn't been changed unwillingly.
For further more details refer the CONTRIBUTING.md