-
Notifications
You must be signed in to change notification settings - Fork 156
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 initialization of piped service client in k8s plugin #5387
Conversation
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 ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5387 +/- ##
==========================================
- Coverage 25.85% 25.84% -0.02%
==========================================
Files 447 448 +1
Lines 48233 48261 +28
==========================================
Hits 12472 12472
- Misses 34790 34818 +28
Partials 971 971 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanna ask one point
apiPort: 10000, | ||
gracePeriod: 30 * time.Second, | ||
apiPort: 10000, | ||
pipedPluginServicePort: 9087, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[ASK] Where does 9087
come from?
Do other plugins need to avoid using 9087
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for not commenting about this.
This comes from the default of pipedv1's plugin service port.
pipecd/pkg/app/pipedv1/cmd/piped/piped.go
Line 103 in 4986dd5
pluginServicePort: 9087, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got it, thank you.
I think it'd be better to avoid hard coding (e.g., by using const) because all plugins need to specify 9087 directly.
If it's not easy now, let's do it in another PR later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I came to one idea.
The piped will always specify the port when invoking the plugin.
Then, making the default -1
and the plugin raises the error if the piped doesn't specify the port.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems good!
You mean a piped passes the piped's port to each plugin, right? If not passed, an error will occur by -1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes 👍🏻
I realized the way to pass this port must be the same across all the plugins.
We have to discuss how to pass it (e.g., as a command option or an environment variable, and these names, too).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Warashi Thank you!
Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Left a commet.
if s.pipedPluginServicePort == -1 { | ||
input.Logger.Error("piped-plugin-service-port is required") | ||
return errors.New("piped-plugin-service-port is required") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use MarkFlagRequired
to require the flag 👀
https://pkg.go.dev/github.com/spf13/cobra#MarkFlagRequired
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then the following line is unnecessary, right?
pipedPluginServicePort: -1, // default as error value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, that's right. I'll change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. fixed on this commit
2d1da06
Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
Signed-off-by: Shinnosuke Sawada-Dazai <shin@warashi.dev>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
What this PR does:
as title
Why we need it:
We need the piped's plugin service client to call the APIs.
Which issue(s) this PR fixes:
Part of #4980
Does this PR introduce a user-facing change?: No