Skip to content

Unproject using the same mapping used to project the binding#233

Merged
sadlerap merged 1 commit intoservicebinding:mainfrom
scothis:mapped-unbind
Feb 6, 2023
Merged

Unproject using the same mapping used to project the binding#233
sadlerap merged 1 commit intoservicebinding:mainfrom
scothis:mapped-unbind

Conversation

@scothis
Copy link
Member

@scothis scothis commented Jan 19, 2023

From the spec:

When a service binding projection is removed, the controller MUST use
the same mappings from the projection creation. After a
ClusterWorkloadResourceMapping resource is modified, each binding
targeting the mapped workload type MUST be removed, then reattempted
with the latest mapping.

We now stash the mapping used to project the binding on the workload as an annotation. When unprojecting that same binding, we use the stashed mapping to unproject the binding. If updating an existing binding, the stashed mapping is used to cleanup existing state before the updated mapping is used to re-project the binding into the workload.

Resolves #138

@codecov-commenter
Copy link

Codecov Report

Base: 82.66% // Head: 81.71% // Decreases project coverage by -0.95% ⚠️

Coverage data is based on head (25e2090) compared to base (4d9ed4c).
Patch coverage: 73.42% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #233      +/-   ##
==========================================
- Coverage   82.66%   81.71%   -0.95%     
==========================================
  Files          15       15              
  Lines        1350     1444      +94     
==========================================
+ Hits         1116     1180      +64     
- Misses        200      217      +17     
- Partials       34       47      +13     
Impacted Files Coverage Δ
projector/metapodtemplate.go 60.73% <33.33%> (-1.77%) ⬇️
projector/binding.go 88.18% <67.85%> (-4.77%) ⬇️
projector/mapping.go 94.11% <93.54%> (-5.89%) ⬇️
resolver/cluster.go 88.46% <93.75%> (-0.57%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

From the spec:

> When a service binding projection is removed, the controller MUST use
> the same mappings from the projection creation. After a
> ClusterWorkloadResourceMapping resource is modified, each binding
> targeting the mapped workload type MUST be removed, then reattempted
> with the latest mapping.

We now stash the mapping used to project the binding on the workload as
an annotation. When unprojecting that same binding, we use the stashed
mapping to unproject the binding. If updating an existing binding, the
stashed mapping is used to cleanup existing state before the updated
mapping is used to re-project the binding into the workload.

Signed-off-by: Scott Andrews <andrewssc@vmware.com>
@scothis scothis marked this pull request as ready for review January 23, 2023 14:58
@scothis scothis requested a review from a team January 23, 2023 14:59
Copy link
Contributor

@sadlerap sadlerap left a comment

Choose a reason for hiding this comment

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

Some initial feedback.

@scothis scothis requested a review from sadlerap February 1, 2023 15:08
Copy link
Contributor

@sadlerap sadlerap left a comment

Choose a reason for hiding this comment

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

LGTM

@sadlerap sadlerap merged commit cdb9db6 into servicebinding:main Feb 6, 2023
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.

Unproject binding using mapping used to create projection

3 participants