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

Implement hashing functions for Kubernetes manifests and add tests #5417

Merged
merged 1 commit into from
Dec 13, 2024

Conversation

Warashi
Copy link
Contributor

@Warashi Warashi commented Dec 13, 2024

What this PR does:

I copied hashing functions implemented in the current Kubernetes platform provider to the Kubernetes plugin.

Why we need it:

To implement annotateConfigHash, we need functions to hash configmaps and secrets.

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):

Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
limitations under the License.
*/

package provider
Copy link
Contributor Author

Choose a reason for hiding this comment

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

// See the License for the specific language governing permissions and
// limitations under the License.

package provider
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link

codecov bot commented Dec 13, 2024

Codecov Report

Attention: Patch coverage is 64.51613% with 33 lines in your changes missing coverage. Please review.

Project coverage is 25.89%. Comparing base (a8527d2) to head (489d265).
Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
...g/app/pipedv1/plugin/kubernetes/provider/hasher.go 64.70% 20 Missing and 10 partials ⚠️
...app/pipedv1/plugin/kubernetes/provider/manifest.go 62.50% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5417      +/-   ##
==========================================
+ Coverage   25.81%   25.89%   +0.08%     
==========================================
  Files         449      450       +1     
  Lines       48472    48565      +93     
==========================================
+ Hits        12513    12576      +63     
- Misses      34981    35000      +19     
- Partials      978      989      +11     

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

Comment on lines +42 to +45
// ConvertToStructuredObject converts the manifest into a structured Kubernetes object.
// The provided interface should be a pointer to a concrete Kubernetes type (e.g. *v1.Pod).
// It first marshals the manifest to JSON and then unmarshals it into the provided object.
func (m Manifest) ConvertToStructuredObject(o interface{}) error {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMHO, I want to implement without this function, but it's tough to keep compatibility without this.

@Warashi Warashi marked this pull request as ready for review December 13, 2024 01:24
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.

👍

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.

👌

@Warashi Warashi merged commit b178d40 into master Dec 13, 2024
18 checks passed
@Warashi Warashi deleted the k8s-plugin-annotate-config-hash branch December 13, 2024 01:54
@github-actions github-actions bot mentioned this pull request Jan 21, 2025
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