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

Add function to find ConfigMaps and Secrets in manifests #5319

Merged
merged 2 commits into from
Nov 13, 2024

Conversation

Warashi
Copy link
Contributor

@Warashi Warashi commented Nov 8, 2024

What this PR does:

This PR adds the function findConfigs to find ConfigMaps and Secrets in manifests.

Why we need it:

To determine sync strategies, we need to find updated ConfigMaps or Secrets. This PR adds functionalities for finding these candidates.

Which issue(s) this PR fixes:

Part of #4980

Does this PR introduce a user-facing change?: No

  • How are users affected by this change:
  • Is this breaking change:
  • How to migrate (if breaking change):

Copy link

codecov bot commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 55.55556% with 8 lines in your changes missing coverage. Please review.

Project coverage is 25.28%. Comparing base (b5089af) to head (dedd8fc).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
...app/pipedv1/plugin/kubernetes/provider/resource.go 0.00% 8 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5319   +/-   ##
=======================================
  Coverage   25.28%   25.28%           
=======================================
  Files         444      444           
  Lines       47554    47572   +18     
=======================================
+ Hits        12022    12028    +6     
- Misses      34590    34601   +11     
- Partials      942      943    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -156,3 +156,16 @@ func findUpdatedWorkloads(olds, news []provider.Manifest) []workloadPair {
}
return pairs
}

func findConfigs(manifests []provider.Manifest) map[provider.ResourceKey]provider.Manifest {
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Should we add a function comment like "findConfigs returns ConfigMap and Secret resources" to the head of this function? TBH, I don't actually like this implementation (even the original method) since we have to mention that this function returns both ConfigMap and Secret resources while its name makes the reader think it only returns config.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@khanhtc1202
I got your point. How about renaming this as findConfigsAndSecrets?

Copy link
Member

Choose a reason for hiding this comment

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

That sounds nice 👍 @Warashi

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I renamed it and added a comment.
dedd8fc

ffjlabo
ffjlabo previously approved these changes Nov 11, 2024
Copy link
Member

@ffjlabo ffjlabo left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@khanhtc1202 khanhtc1202 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks 👍

@Warashi Warashi merged commit 1763f92 into master Nov 13, 2024
18 checks passed
@Warashi Warashi deleted the k8s-plugin-find-configs branch November 13, 2024 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants