From my space turn over, space address http://user.qzone.qq.com/29185807/blog/1458270203
And then an article.
We're back in k8s.io\kubernetes\pkg\master\master.go.
Func (M *master) init (c *config) {
From the code, it generates a lot of storage,podstorage,eventstorage,nodestorage.
These storage are then registered in master's storage variable, which is the restful route, but not the restful routing format.
So where are these routes registered?
Let's keep looking down the code.
or the Init function, we see the API_V1 (). Installrest. This is where the storage route is converted to a restful route and registered in the Handlercontainer
Besides, there's a extensions installrest.
We're going to look back now, there are two important variables Mux,handlercontainer
These two variables are assigned when master initializes (the function is new)
and hook the MUX to the container.
We go back to init.
We see that after the API has been registered, it is the initialization of handler (HTTP handler), in fact handler is mentioned above MUX
Master's initialization is over, and now we're going to go back to K8s.io\kubernetes\cmd\kube-apiserver\app\server.go's run function.
At the end of the run function, you can see clearly that the handle in master is tied to the httpserver. And then a httpserver started.
Hao Haohua
QQ Crescent moon Lonely Road length 29185807
March 18, 2016 (Copyright: This article is original for the author, if you need to reprint, please notify me, and indicate the source and author. Reproduced without authorization, reserve the right to pursue its infringement. )