Skip to content

Refactor the k8s plugin#5381

Merged
Warashi merged 4 commits intomasterfrom
k8s-plugin-refactor-server
Dec 3, 2024
Merged

Refactor the k8s plugin#5381
Warashi merged 4 commits intomasterfrom
k8s-plugin-refactor-server

Conversation

@Warashi
Copy link
Member

@Warashi Warashi commented Dec 3, 2024

What this PR does:

  1. make the DeploymentService fields private and remove unused fields.
  2. add arguments of NewDeploymentService to make tool registry and log persister as arguments

Why we need it:

  1. Making the variable scope narrow is better
  2. we have to create gRPC conn for piped-side service, which may be done out of the initialization of DeploymentService. So we have to pass them as arguments.

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

…dencies

Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
@codecov
Copy link

codecov bot commented Dec 3, 2024

Codecov Report

Attention: Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.

Project coverage is 25.75%. Comparing base (04c1f35) to head (ee332f5).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
...app/pipedv1/plugin/kubernetes/deployment/server.go 0.00% 6 Missing ⚠️
...g/app/pipedv1/plugin/kubernetes/provider/loader.go 0.00% 4 Missing ⚠️
pkg/app/pipedv1/plugin/kubernetes/server.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5381      +/-   ##
==========================================
- Coverage   25.76%   25.75%   -0.02%     
==========================================
  Files         445      445              
  Lines       47947    47955       +8     
==========================================
- Hits        12355    12351       -4     
- Misses      34630    34641      +11     
- Partials      962      963       +1     

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

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.

Thank you for the refactor. I left imo comment 🙏

Comment on lines +71 to +76
toolRegistry toolRegistry,
logPersister logPersister,
) *DeploymentService {
return &DeploymentService{
RegexPool: regexpool.DefaultPool(),
Logger: logger.Named("planner"),
ToolRegistry: nil, // TODO: set the tool registry
logger: logger.Named("planner"),
loader: provider.NewLoader(toolregistry.NewRegistry(toolRegistry)),
Copy link
Member

Choose a reason for hiding this comment

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

IMO: How about changing the interface name of toolRegistry to toolClient?
At first, I was confused that it created a new tool Registry with tool registry.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree that it's confusing. I'll rename it as you suggested. Thanks.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ffjlabo
fixed on ee332f5
Thanks.

Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
@Warashi Warashi requested a review from ffjlabo December 3, 2024 01:59
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 1907301 into master Dec 3, 2024
@Warashi Warashi deleted the k8s-plugin-refactor-server branch December 3, 2024 02:22
@github-actions github-actions bot mentioned this pull request Jan 21, 2025
@github-actions github-actions bot mentioned this pull request Mar 25, 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