From my space turn over, space address http://user.qzone.qq.com/29185807/blog/1458208552 Source version for v1.1.1 stable version Start file K8s.io/kubernetes/cmd/kube-apiserver/apiserver.go from function main
We enter the Server.go in the K8s.io/kubernetes/cmd/kube-apiserver/app catalogue.
We see a lot of parameters in apiserver and we don't care about it for a while. Newapiserver also just do some parameter assignment.
Let's look at the run function specifically There is a place for
The resolution of NEWETCD is:
A ETCD client is generated and encapsulated by Etcdhelper. And then register it in the Apigroup. Storagedestinations.addapigroup ("", Etcdstorage) In the following master initialization, Apigroup is assigned to config
Followed by
Let's keep looking at the code in master K8s.io\kubernetes\pkg\master\master.go The new function mainly makes some parameter assignment, then defines the RESTful container. About restful this follow-up analysis.
We just need to see master.init.
Init in the storagedestinations from the previous registered in the Apigroup, which is the variable etcdstorage etcdhelper structure body A podstorage is generated here. Continue tracking K8s.io\kubernetes\pkg\registry\pod\etcd\etcd.go In Newstorage This function is actually a encapsulation of the ETCDGENERIC.ETCD. And the most important parameter etcdhelper passed to Etcdgeneric. Storage member variable for ETCD
We'll keep tracking. K8s.io\kubernetes\pkg\registry\generic\etcd
In this case, there are some function object variables, and one of the most important is storage Let's take the CREATE function for example Hao Haohua QQ Crescent moon Lonely Road length 29185807 March 17, 2016 (Copyright statement: This article for the author original, if you need to reprint, please notify me, and indicate the source and author.) Reproduced without authorization, reserve the right to pursue its infringement. )
|