-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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
separate discovery from the apiserver #43003
separate discovery from the apiserver #43003
Conversation
type legacyRootAPIDiscoveryHandler struct { | ||
// DiscoveryAddresses is used to build cluster IPs for discovery. | ||
discoveryAddresses DiscoveryAddresses | ||
|
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.
nit: empty lines
Haven't done a line-by-line review, but overall this looks good! |
df2fbd7
to
4f9e8d2
Compare
4f9e8d2
to
2a36ef9
Compare
Rebased. @liggitt yes, I preserved the discovery ordering tests. |
2a36ef9
to
73f00d6
Compare
rebased again. bump. |
73f00d6
to
bdcdf5c
Compare
@ncdc rebased again |
|
||
// AddApiWebService adds a service to return the supported api versions at the legacy /api. | ||
func (s *legacyRootAPIDiscoveryHandler) WebService() *restful.WebService { | ||
// Because in release 1.1, /api returns response with empty APIVersion, we |
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.
Remove this comment since you have it a few lines up?
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.
Remove this comment since you have it a few lines up?
done
"k8s.io/apiserver/pkg/endpoints/handlers/responsewriters" | ||
) | ||
|
||
type DiscoveryGroupManager interface { |
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.
godoc please
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 package is discovery
, call this GroupManager
?
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 package is discovery, call this GroupManager?
sure.
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.
And AddGroup + RemoveGroup
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.
godoc please
Since the package is discovery, call this GroupManager
And AddGroup + RemoveGroup
done
) | ||
|
||
// legacyRootAPIDiscoveryHandler creates a webservice serving api group discovery. | ||
// Note: during the server runtime apiGroups might 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.
What exactly does this note mean?
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 exactly does this note mean?
Doesn't belong here. Will remove.
|
||
// apiGroupDiscoveryHandler creates a webservice serving the supported versions, preferred version, and name | ||
// of a group. E.g., such a web service will be registered at /apis/extensions. | ||
type apiGroupDiscoveryHandler struct { |
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.
Theme: remove discovery from names? apiGroupHandler
group metav1.APIGroup | ||
} | ||
|
||
func NewAPIGroupDiscoveryHandler(serializer runtime.NegotiatedSerializer, group metav1.APIGroup) *apiGroupDiscoveryHandler { |
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.
Theme: remove discovery from names? NewAPIGroupHandler
|
||
// legacyRootAPIDiscoveryHandler creates a webservice serving api group discovery. | ||
// Note: during the server runtime apiGroups might change. | ||
type legacyRootAPIDiscoveryHandler struct { |
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.
Theme: remove discovery from names? legacyRootAPIHandler
|
||
// rootAPIsDiscoveryHandler creates a webservice serving api group discovery. | ||
// Note: during the server runtime apiGroups might change. | ||
type rootAPIsDiscoveryHandler struct { |
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.
Theme: remove discovery from names? rootAPIsHandler
} | ||
|
||
// rootAPIsDiscoveryHandler creates a webservice serving api group discovery. | ||
// Note: during the server runtime apiGroups might 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.
Is this comment appropriate here? If so, what is it saying exactly?
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.
Is this comment appropriate here? If so, what is it saying exactly?
This list of API groups is not fixed and (at least currently) this is accomplished by mutating the handler itself. You cannot safely cache this information.
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.
Is this comment appropriate here? If so, what is it saying exactly?
Clarified comment
bdcdf5c
to
0fb85cb
Compare
Comments addressed. |
apiGroupsForDiscovery map[string]metav1.APIGroup | ||
apiGroupNamesForDiscovery []string | ||
// RootDiscoveryConfig serves /apis | ||
RootDiscoveryConfig discovery.GroupManager |
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.
s/RootDiscoveryConfig/DiscoveryGroupManager/
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.
s/RootDiscoveryConfig/DiscoveryGroupManager/
done
0fb85cb
to
e099f5e
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, sttts
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Automatic merge from submit-queue (batch tested with PRs 45227, 43003, 45231) |
This decouples the API discovery handlers from the core API server code. It separates the code into a new package and clarifies interfaces with existing TPR code.
@kubernetes/sig-api-machinery-pr-reviews