Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Allows user to define Secret from annotation #1498

Merged
merged 3 commits into from
Jan 28, 2019

Conversation

bohmber
Copy link
Contributor

@bohmber bohmber commented Jan 24, 2019

Similar to fmp-configmap-file enricher for annotation

Signed-off-by: bohmber bommel@apache.org

Signed-off-by: bohmber <bommel@apache.org>
@codecov
Copy link

codecov bot commented Jan 24, 2019

Codecov Report

Merging #1498 into master will increase coverage by 0.1%.
The diff coverage is 88.46%.

@@             Coverage Diff             @@
##             master    #1498     +/-   ##
===========================================
+ Coverage     35.85%   35.96%   +0.1%     
- Complexity     1109     1116      +7     
===========================================
  Files           177      178      +1     
  Lines         10001    10027     +26     
  Branches       1658     1660      +2     
===========================================
+ Hits           3586     3606     +20     
- Misses         5993     5998      +5     
- Partials        422      423      +1

@codecov
Copy link

codecov bot commented Jan 24, 2019

Codecov Report

Merging #1498 into master will increase coverage by 0.16%.
The diff coverage is 88.46%.

@@             Coverage Diff              @@
##             master    #1498      +/-   ##
============================================
+ Coverage     35.85%   36.02%   +0.16%     
- Complexity     1109     1117       +8     
============================================
  Files           177      178       +1     
  Lines         10001    10027      +26     
  Branches       1658     1660       +2     
============================================
+ Hits           3586     3612      +26     
+ Misses         5993     5991       -2     
- Partials        422      424       +2

final Set<Map.Entry<String, String>> entries = annotations.entrySet();
final Map<String, String> secretFileLocations = new HashMap<>();

for(Iterator<Map.Entry<String, String>> it = entries.iterator(); it.hasNext(); ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @bohmber why not just use

for (Map.Entry<String, String> entry : annotations.entrySet( ) )

?
The FMP code base uses this way of iteration everywhere, so it would look uniform with the codebase if you change it to this style.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's just a modified copy of the ConfigMapEnricher and i think the iterator is needed for the remove a few lines later

it.remove();

Copy link
Contributor

Choose a reason for hiding this comment

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

oh i see

@devang-gaur
Copy link
Contributor

Really appreciate you adding test and documentation with your code.

@devang-gaur
Copy link
Contributor

Shouldn't the annotation get deleted/removed after it is 'enriched' into a proper secret?
It won't look good if deploy with those annotations (plain text) in for eg.,a shared cluster maybe. Will defeat the purpose of that info being a secret.

I'm not a kubernetes/openshift expert in the matter though. Correct me if I'm wrong here.

Also, Changelog entry missing.

@bohmber
Copy link
Contributor Author

bohmber commented Jan 25, 2019

@dev-gaur The annotation is deleted see my comment about the iterator and there is an assert in the unit test for it.

Signed-off-by: bohmber <bommel@apache.org>
@bohmber
Copy link
Contributor Author

bohmber commented Jan 25, 2019

@dev-gaur I can't add the change log entry before the pull request is created. I need the number and adding the change log entry early is causing more work on my side because i have to fix merge conflicts in the change log file. I can add the change log entry before the pull request will be merged

@bohmber
Copy link
Contributor Author

bohmber commented Jan 25, 2019

Is FileDataSecretEnricher a good class name?

@rohanKanojia rohanKanojia added the pr/changelog-entry-please Please add a changelog entry for this PR label Jan 25, 2019
@devang-gaur
Copy link
Contributor

@dev-gaur The annotation is deleted see my comment about the iterator and there is an assert in the unit test for it.

aah missed that.

We'll handle the merge conflicts before merging. You can go ahead with the changelog entry.
No need for a number. You can just do with "Feature: allow users to define secrets from annotations."

Signed-off-by: bohmber <bommel@apache.org>
@bohmber
Copy link
Contributor Author

bohmber commented Jan 25, 2019

@rohanKanojia changelog entry added

@rohanKanojia rohanKanojia removed the pr/changelog-entry-please Please add a changelog entry for this PR label Jan 26, 2019
@rohanKanojia rohanKanojia merged commit 43aac6b into fabric8io:master Jan 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants