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 adding config hash annotation to deployments #5418

Merged
merged 6 commits into from
Dec 13, 2024

Conversation

Warashi
Copy link
Contributor

@Warashi Warashi commented Dec 13, 2024

What this PR does:

Implement annotateConfigHash to use Kubernetes sync

Why we need it:

We add this annotation to ensure that the workload should be restarted when one of its configurations changes.

Which issue(s) this PR fixes:

Part of #4980

Does this PR introduce a user-facing change?:

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

Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
// that are referenced by the workload.
// This appending ensures that the workload should be restarted when
// one of its configurations changed.
func annotateConfigHash(manifests []provider.Manifest) 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.

I almost copied from below.

func annotateConfigHash(manifests []provider.Manifest) error {

"github.com/pipe-cd/pipecd/pkg/app/pipedv1/plugin/kubernetes/provider"
)

func TestAnnotateConfigHash(t *testing.T) {
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 almost copied from below and added a testcase for Secrets

func TestAnnotateConfigHash(t *testing.T) {

Copy link

codecov bot commented Dec 13, 2024

Codecov Report

Attention: Patch coverage is 72.50000% with 22 lines in your changes missing coverage. Please review.

Project coverage is 25.95%. Comparing base (b178d40) to head (ab992d6).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
...p/pipedv1/plugin/kubernetes/deployment/annotate.go 69.35% 13 Missing and 6 partials ⚠️
...app/pipedv1/plugin/kubernetes/provider/manifest.go 70.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5418      +/-   ##
==========================================
+ Coverage   25.90%   25.95%   +0.04%     
==========================================
  Files         450      451       +1     
  Lines       48565    48731     +166     
==========================================
+ Hits        12582    12649      +67     
- Misses      34994    35081      +87     
- Partials      989     1001      +12     

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

@Warashi Warashi marked this pull request as ready for review December 13, 2024 03:36
@@ -90,6 +90,16 @@ func MakeResourceKey(obj *unstructured.Unstructured) ResourceKey {
return k
}

func (k ResourceKey) IsDeployment() bool {
Copy link
Member

Choose a reason for hiding this comment

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

Could you add test for this 👀

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.

Let's go 🚀

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.

👍

@Warashi Warashi merged commit 702b984 into master Dec 13, 2024
16 of 18 checks passed
@Warashi Warashi deleted the k8s-plugin-annotate-config-hash-2 branch December 13, 2024 05:18
@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