-
Notifications
You must be signed in to change notification settings - Fork 950
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
refactor: make CRI Stream Server share http server with pouchd #2214
Conversation
39743fc
to
d6ab819
Compare
Codecov Report
@@ Coverage Diff @@
## master #2214 +/- ##
==========================================
- Coverage 66.57% 66.36% -0.22%
==========================================
Files 208 208
Lines 16744 16837 +93
==========================================
+ Hits 11148 11174 +26
- Misses 4273 4321 +48
- Partials 1323 1342 +19
|
main.go
Outdated
@@ -69,7 +69,7 @@ func setupFlags(cmd *cobra.Command) { | |||
flagSet := cmd.Flags() | |||
|
|||
flagSet.StringVar(&cfg.HomeDir, "home-dir", "/var/lib/pouch", "Specify root dir of pouchd") | |||
flagSet.StringArrayVarP(&cfg.Listen, "listen", "l", []string{"unix:///var/run/pouchd.sock"}, "Specify listening addresses of Pouchd") | |||
flagSet.StringArrayVarP(&cfg.Listen, "listen", "l", []string{"unix:///var/run/pouchd.sock", "tcp://0.0.0.0:4243"}, "Specify listening addresses of Pouchd") |
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.
By default, tcp://0.0.0.0:4243
is set in pouchd
? I do not think it is a good way.
Shall we still set the default value to be unix socket, and if user needs to expand the CRI within the one port, he needs to add a tcp address when startup of pouchd. Here I am afraid we need to add more explanation of the comment Specify listening addresses of Pouchd
, and it is too general and hard for others to understand the real functionality of it.
In addition, I am just here to double check if we still support to set the two different port in pouchd for configuration, one for container api port, the other for cri stream server port?
cri/v1alpha2/cri.go
Outdated
@@ -57,7 +58,7 @@ const ( | |||
// Address and port of stream server. | |||
// TODO: specify them in the parameters of pouchd. | |||
streamServerAddress = "" | |||
streamServerPort = "10011" | |||
streamServerPort = "4243" |
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.
could we share same port with pouch daemon or create other option like what @allencloud says?
cri/criservice.go
Outdated
if err := <-errChan; err != nil { | ||
return err | ||
} | ||
if err := <-errChan; err != nil { |
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.
are we need the 2 in make(chan error, 2)
here?
f9c95c2
to
429f381
Compare
I just refactored this PR. Now we could specify two stream server related options with pouchd.
NOTE: in this condition, we should specify a tcp socket in pouchd and the port should be same with
The @allencloud @fuweid WDYT? |
7ac7b2a
to
fb10eab
Compare
I adjust the mechanism again.
|
1a71c73
to
d39c8e1
Compare
2e7c784
to
3069db2
Compare
cri/v1alpha1/cri.go
Outdated
@@ -57,7 +58,7 @@ const ( | |||
// Address and port of stream server. | |||
// TODO: specify them in the parameters of pouchd. | |||
streamServerAddress = "" | |||
streamServerPort = "10010" | |||
streamServerPort = "4243" |
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 think we should keep 10010 as default here.
streamServerPort := config.CriConfig.StreamServerPort | ||
// If stream server reuse the pouchd's port, extract the port from pouchd's listening addresses. | ||
if config.CriConfig.StreamServerReusePort { | ||
streamServerAddress, streamServerPort = extractIPAndPortFromAddresses(config.Listen) |
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.
since the user maybe pass multiple tcp addresses, could we show the address and port which CRI stream uses?
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.
If the streamServerAddress we get is 0.0.0.0
, we will reacquire the concrete IP that the stream server will use in newStreamServer
, so I output the log there.
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, my mistake.
args: []string{"unix:///var/run/pouchd.sock", "tcp://0.0.0.0:4345"}, | ||
wantIP: "0.0.0.0", | ||
wantPort: "4345", | ||
}, |
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.
please add two tcp addresses case here
3069db2
to
6260902
Compare
Signed-off-by: YaoZengzeng <yaozengzeng@zju.edu.cn>
6260902
to
e5914d5
Compare
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
Signed-off-by: YaoZengzeng yaozengzeng@zju.edu.cn
Ⅰ. Describe what this PR did
If the CRI enabled, pouch will launch two http server, one for pouchd and another for stream server of CRI, so we will need two different port
However port is scarce resources in company which has large scale of data center.
So maybe it is a good idea that we reuse the same http server for pouchd and stream server which only one port is needed
Ⅱ. Does this pull request fix one issue?
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
No
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews