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 resource pruning in k8s plugin #5455

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

Warashi
Copy link
Contributor

@Warashi Warashi commented Dec 26, 2024

What this PR does:

as title

Why we need it:

to prune the resources which removed in the git repository

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 <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Copy link

codecov bot commented Dec 26, 2024

Codecov Report

Attention: Patch coverage is 42.35808% with 132 lines in your changes missing coverage. Please review.

Project coverage is 26.16%. Comparing base (792015b) to head (85ba187).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
.../app/pipedv1/plugin/kubernetes/provider/kubectl.go 0.00% 77 Missing ⚠️
...app/pipedv1/plugin/kubernetes/deployment/server.go 65.51% 16 Missing and 4 partials ⚠️
...app/pipedv1/plugin/kubernetes/provider/manifest.go 15.00% 17 Missing ⚠️
...g/app/pipedv1/plugin/kubernetes/provider/loader.go 0.00% 13 Missing ⚠️
...app/pipedv1/plugin/kubernetes/provider/resource.go 90.56% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5455      +/-   ##
==========================================
+ Coverage   26.15%   26.16%   +0.01%     
==========================================
  Files         456      457       +1     
  Lines       48992    49285     +293     
==========================================
+ Hits        12814    12896      +82     
- Misses      35156    35363     +207     
- Partials     1022     1026       +4     

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

Comment on lines 89 to 90
// Set the namespace for all manifests.
manifests[i].body.SetNamespace(input.Namespace)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need this to ensure the loaded manifests' namespaces are matched with applied resource.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, we have to check the input.Namespace is empty or not.

Comment on lines +92 to +98
// Add builtin labels and annotations for tracking application live state.
manifests[i].AddLabels(map[string]string{
LabelManagedBy: ManagedByPiped,
LabelPiped: input.PipedID,
LabelApplication: input.AppID,
LabelCommitHash: input.CommitHash,
})
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 want these labels to retrieve live resources when pruning the resources.

Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
@Warashi Warashi marked this pull request as ready for review December 26, 2024 07:47
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.

1 participant