91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

構建API Server的詳細步驟

發布時間:2021-09-09 13:39:29 來源:億速云 閱讀:218 作者:chen 欄目:云計算

本篇內容介紹了“構建API Server的詳細步驟”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!

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

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

   // api server的config結構

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

   if err != nil {

      return nil, err

   }

 

   // extension server的config結構

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

   if err != nil {

      return nil, err

   }

 

   // 1. 創建api extensions server

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

   if err != nil {

      return nil, err

   }

 

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

   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. 創建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

}

當中,三個server創建的過程大體類似。以下是API Server創建方法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創建APIServer對應的GenericAPIServer對象

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

   if err != nil {

      return nil, err

   }

 

   ....

   m := &Master{

      GenericAPIServer: s,

   }

 

   // 將所有REST資源(Pods/Deployments)的Storage接口實現類都install到master內含的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

}

經過以上幾個步驟,API Server就完成了所有資源的install,可以開始監聽并響應請求。

“構建API Server的詳細步驟”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

高要市| 上虞市| 县级市| 子洲县| 锦屏县| 罗源县| 双桥区| 鸡西市| 抚宁县| 筠连县| 龙口市| 威宁| 太白县| 诸城市| 上饶市| 凤城市| 措勤县| 临沂市| 太仆寺旗| 绥江县| 顺平县| 红安县| 堆龙德庆县| 炉霍县| 景宁| 拜泉县| 汝阳县| 砚山县| 尉犁县| 兴海县| 清水河县| 敖汉旗| 安西县| 沙田区| 蓝田县| 保山市| 闸北区| 嘉荫县| 都兰县| 新蔡县| 武川县|