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
xds: de-experimentalize xDS apis required for psm security #4753
Changes from 4 commits
3178d5b
e8eddd6
8d2f042
e044d95
76af5d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ | |
|
||
// Package connectivity defines connectivity semantics. | ||
// For details, see https://github.com/grpc/grpc/blob/master/doc/connectivity-semantics-and-api.md. | ||
// All APIs in this package are experimental. | ||
package connectivity | ||
|
||
import ( | ||
|
@@ -61,3 +60,32 @@ const ( | |
// Shutdown indicates the ClientConn has started shutting down. | ||
Shutdown | ||
) | ||
|
||
// ServingMode indicates the current mode of operation of the server. | ||
// | ||
// Only xDS enabled gRPC servers currently report their serving mode. | ||
type ServingMode int | ||
|
||
const ( | ||
// ServingModeStarting indicates that the server is starting up. | ||
ServingModeStarting ServingMode = iota | ||
// ServingModeServing indicates that the server contains all required | ||
// configuration and is serving RPCs. | ||
ServingModeServing | ||
// ServingModeNotServing indicates that the server is not accepting new | ||
// connections. Existing connections will be closed gracefully, allowing | ||
// in-progress RPCs to complete. A server enters this mode when it does not | ||
// contain the required configuration to serve RPCs. | ||
ServingModeNotServing | ||
) | ||
|
||
func (s ServingMode) String() string { | ||
switch s { | ||
case ServingModeNotServing: | ||
return "not-serving" | ||
case ServingModeServing: | ||
return "serving" | ||
default: | ||
return "starting" | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This shows some inconsistencies now between here and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
} |
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.
This actually promotes an xDS only concept to a gRPC concept.
The concern is that in the future we may change the meanings of these terms in a non-xDS gRPC server. But with the 3 values we have now, that seems unlikely.
starting
with our current API. If our API is to take a port instead of a listener, the state afterNewServer
, before thenet.Listen()
would beServingModeStarting
NotServing
is after gracefulstop, before stop?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.
Even with our current API taking a
net.Listener
, we could have astarting
state afterNewServer
and before we callAccept()
. It is very fleeting though.Sounds about right.
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 happens at "stop", then? It no longer has any serving mode? I'd think the
NotServing
state continues after "stop", 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.
We have a
starting
. So should we also add astopped
(definitely notstopping
).Or we can add them when needed.
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.
The only difference I wanted to highlight was that in
NotServing
mode, we accept and close the connection without performing any I/O (this is a limitation of our API, since we accept anet.Listener
). Once stop is complete, we don't even accept the connection.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.
Or "no new connections" is what I thought. Existing connections may allow new streams.
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.
"no new streams" and "no new connections" are different.
GracefulStop also sends GOAWAYs, so it won't accept new streams.
completely-NotServing
vsalmost-NotServing
? 🙈