成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

構(gòu)建APIServer的詳細(xì)步驟

本篇內(nèi)容介紹了“構(gòu)建API Server的詳細(xì)步驟”的有關(guān)知識,在實(shí)際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

成都創(chuàng)新互聯(lián)是一家專注于網(wǎng)站設(shè)計、成都網(wǎng)站制作與策劃設(shè)計,攸縣網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)十余年,網(wǎng)設(shè)計領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:攸縣等地區(qū)。攸縣做網(wǎng)站價格咨詢:18980820575

API Server利用GenericAPIServer框架依次創(chuàng)建了api_extension_server\api_server\aggregator_server來處理所有請求,server構(gòu)建的核心邏輯如下:

func CreateServerChain(runOptions *options.ServerRunOptions, stopCh <-chan struct{}) (*genericapiserver.GenericAPIServer, error) {

   // api server的config結(jié)構(gòu)

   kubeAPIServerConfig, sharedInformers, versionedInformers, insecureServingOptions, serviceResolver, err := CreateKubeAPIServerConfig(runOptions, nodeTunneler, proxyTransport)

   if err != nil {

      return nil, err

   }

 

   // extension server的config結(jié)構(gòu)

   apiExtensionsConfig, err := createAPIExtensionsConfig(*kubeAPIServerConfig.GenericConfig, versionedInformers, runOptions)

   if err != nil {

      return nil, err

   }

 

   // 1. 創(chuàng)建api extensions server

   apiExtensionsServer, err := createAPIExtensionsServer(apiExtensionsConfig, genericapiserver.EmptyDelegate)

   if err != nil {

      return nil, err

   }

 

   // 2. 創(chuàng)建api server,delegate到extensions server上(注意,第二個參數(shù))

   kubeAPIServer, err := CreateKubeAPIServer(kubeAPIServerConfig, apiExtensionsServer.GenericAPIServer, sharedInformers, versionedInformers)

   if err != nil {

      return nil, err

   }

 

   .....

 

   // otherwise go down the normal path of standing the aggregator up in front of the API server

   // this wires up openapi

   kubeAPIServer.GenericAPIServer.PrepareRun()

 

   // This will wire up openapi for extension api server

   apiExtensionsServer.GenericAPIServer.PrepareRun()

 

   ....

   // 3. 創(chuàng)建aggregator server, delegate到api server上

   aggregatorServer, err := createAggregatorServer(aggregatorConfig, kubeAPIServer.GenericAPIServer, apiExtensionsServer.Informers)

   if err != nil {

      // we don't need special handling for innerStopCh because the aggregator server doesn't create any go routines

      return nil, err

   }

 

   ....

   return aggregatorServer.GenericAPIServer, nil

}

當(dāng)中,三個server創(chuàng)建的過程大體類似。以下是API Server創(chuàng)建方法CreateKubeAPIServer的核心邏輯:

func CreateKubeAPIServer(kubeAPIServerConfig *master.Config, delegateAPIServer genericapiserver.DelegationTarget, sharedInformers informers.SharedInformerFactory, versionedInformers clientgoinformers.SharedInformerFactory) (*master.Master, error) {

   kubeAPIServer, err := kubeAPIServerConfig.Complete(versionedInformers).New(delegateAPIServer)

   if err != nil {

      return nil, err

   }

   kubeAPIServer.GenericAPIServer.AddPostStartHook("start-kube-apiserver-informers", func(context genericapiserver.PostStartHookContext) error {

      sharedInformers.Start(context.StopCh)

      return nil

   })

 

   return kubeAPIServer, nil

}

 

// kubeAPIServerConfig.Complete(versionedInformers).New(delegateAPIServer)中的New方法如下所示:

func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget) (*Master, error) {

   ...

 

   // 通過Config創(chuàng)建APIServer對應(yīng)的GenericAPIServer對象

   s, err := c.GenericConfig.New("kube-apiserver", delegationTarget)

   if err != nil {

      return nil, err

   }

 

   ....

   m := &Master{

      GenericAPIServer: s,

   }

 

   // 將所有REST資源(Pods/Deployments)的Storage接口實(shí)現(xiàn)類都install到master內(nèi)含的GenericAPIServer上

   restStorageProviders := []RESTStorageProvider{

      authenticationrest.RESTStorageProvider{Authenticator: c.GenericConfig.Authenticator},

      authorizationrest.RESTStorageProvider{Authorizer: c.GenericConfig.Authorizer, RuleResolver: c.GenericConfig.RuleResolver},

      autoscalingrest.RESTStorageProvider{},

      batchrest.RESTStorageProvider{},

      certificatesrest.RESTStorageProvider{},

      extensionsrest.RESTStorageProvider{},

      networkingrest.RESTStorageProvider{},

      policyrest.RESTStorageProvider{},

      rbacrest.RESTStorageProvider{Authorizer: c.GenericConfig.Authorizer},

      schedulingrest.RESTStorageProvider{},

      settingsrest.RESTStorageProvider{},

      storagerest.RESTStorageProvider{},

      // keep apps after extensions so legacy clients resolve the extensions versions of shared resource names.

      // See https://github.com/kubernetes/kubernetes/issues/42392

      appsrest.RESTStorageProvider{},

      admissionregistrationrest.RESTStorageProvider{},

   }

   m.InstallAPIs(c.ExtraConfig.APIResourceConfigSource, c.GenericConfig.RESTOptionsGetter, restStorageProviders...)

 

   ...

   return m, nil

}

經(jīng)過以上幾個步驟,API Server就完成了所有資源的install,可以開始監(jiān)聽并響應(yīng)請求。

“構(gòu)建API Server的詳細(xì)步驟”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!

分享名稱:構(gòu)建APIServer的詳細(xì)步驟
轉(zhuǎn)載來于:http://jinyejixie.com/article8/gdpcop.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計、網(wǎng)站排名、服務(wù)器托管、全網(wǎng)營銷推廣網(wǎng)站改版、網(wǎng)站維護(hù)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營
阳春市| 项城市| 宜兰县| 华安县| 峡江县| 嘉荫县| 临漳县| 古浪县| 莒南县| 白沙| 黄平县| 滕州市| 富蕴县| 石狮市| 个旧市| 定襄县| 静安区| 崇州市| 建水县| 柞水县| 瓦房店市| 揭西县| 中宁县| 环江| 铁岭市| 泰顺县| 讷河市| 二连浩特市| 甘肃省| 万山特区| 比如县| 道孚县| 中方县| 漳平市| 天津市| 青龙| 攀枝花市| 永新县| 西城区| 溆浦县| 南投县|