⛲
OpenSt­ack 源码­分析之 Magnum
  • 前言
  • 整体结构
  • contrib
  • doc
  • etc
  • magnum
    • api
      • controllers
        • v1
        • base.py
        • link.py
        • root.py
      • middleware
        • auth_token.py
        • parsable_error.py
      • app.py
      • auth.py
      • config.py
      • hooks.py
    • cloud
      • nova_driver.py
    • cmd
      • api.py
      • conductor.py
      • db_manage.py
      • template_manage.py
    • common
      • pythonk8sclient
        • client
        • templates
        • README.rst
      • clients.py
      • config.py
      • context.py
      • docker_utils.py
      • exception.py
      • k8s_manifest.py
      • magnum_keystoneclient.py
      • paths.py
      • policy.py
      • rpc.py
      • rpc_service.py
      • safe_utils.py
      • service.py
      • short_id.py
      • urlfetch.py
      • utils.py
      • yamlutils.py
    • conductor
      • handlers
        • common
        • bay_conductor.py
        • conductor_listener.py
        • docker_conductor.py
        • kube.py
      • tasks
        • heat_tasks.py
        • init.py
      • api.py
      • bay_lock.py
      • config.py
      • template_definition.py
    • db
      • sqlalchemy
        • alembic
        • alembic.ini
        • api.py
        • migration.py
        • models.py
      • api.py
      • migration.py
    • locale
      • magnum-log-critical.pot
      • magnum-log-error.pot
      • magnum-log-info.pot
      • magnum-log-warning.pot
      • magnum.pot
    • objects
      • base.py
      • bay.py
      • baylock.py
      • baymodel.py
      • container.py
      • fields.py
      • node.py
      • pod.py
      • replicationcontroller.py
      • service.py
      • utils.py
      • init.py
    • openstack
      • common
        • _i18n.py
        • cliutils.py
        • eventlet_backdoor.py
        • local.py
        • loopingcall.py
        • periodic_task.py
        • service.py
        • systemd.py
        • threadgroup.py
        • utils.py
        • versionutils.py
    • public
      • css
        • style.css
    • templates
      • docker-swarm
        • fragments
        • COPYING
        • README.md
        • swarm.yaml
        • swarmnode.yaml
      • heat-kubernetes
        • elements
        • fragments
        • COPYING
        • kubecluster-coreos.yaml
        • kubecluster-fedora-ironic.yaml
        • kubecluster.yaml
        • kubeminion.yaml
        • kubenode-coreos.yaml
        • kubenode-fedora-ironic.yaml
        • README.md
    • tests
      • contrib
        • post_test_hook.sh
      • functional
        • test_magnum_python_client.py
        • test_templates.py
      • unit
        • api
        • common
        • conductor
        • db
        • objects
      • base.py
      • config.py
      • conf_fixture.py
      • fakes.py
      • utils.py
    • base.py
    • config.py
    • i18n.py
    • MANIFEST.in
    • opts.py
    • version.py
  • specs
  • tools
  • 架构
Powered by GitBook
On this page
  • init.py
  • base.py
  • bay.py
  • baymodel.py
  • collection.py
  • container.py
  • node.py
  • pod.py
  • replicationcontroller.py
  • service.py
  • types.py
  • utils.py

Was this helpful?

  1. magnum
  2. api
  3. controllers

v1

第一个版本的实现。

init.py

  • APIBase:API 基础类。

  • Controller:API 根控制器,包括对各种资源(bay、baymodel、container、node、pod、replicationcontroller、service 等)的控制器。

  • MediaType:继承自 APIBase,代表媒体类型。

  • V1:继承自 APIBase,代表 v1 版本的 API,各种 URL 到资源的映射。

base.py

两个 Kubernetes 相关的基础类。

  • K8sPatchType:代表 Kubernetes 的 PatchType。

  • K8sResourceBase:代表 Kubernetes 的资源基础类。

bay.py

  • Bay:代表一个 bay 资源的 API。

  • BayCollection:代表一组 bay 资源的 API。

  • BayPatchType:代表一个 bay 的 patchtype 资源的 API。

  • BaysController:对 Bay 资源进行控制的 REST 控制器,提供 CRUD 接口。

baymodel.py

  • BayModel:代表一个 baymodel 资源的 API。

  • BayModelCollection:代表一组 baymodel 资源的 API。

  • BayModelPatchType:代表一个 baymodel 的 patchtype 资源的 API。

  • BayModelsController:对 Baymodel 资源进行控制的 REST 控制器,提供 CRUD 接口。

collection.py

Collection 类,继承自 base.APIBase。提供对后继子网资源的获取方法。

container.py

对容器相关的一些类,包括容器、容器集合、容器控制器、日志控制器、暂停控制器、重启控制器。分别响应对容器的各种 API 请求。

node.py

代表节点相关的 API 的请求。

pod.py

pod 是 Kubernetes 中的概念。代表 pod 相关的 API 的请求。

replicationcontroller.py

replicationcontroller 是 Kubernetes 中的概念。代表 replicationcontroller 相关的 API 的请求。

service.py

service 是 Kubernetes 中的概念。这里实现对 service 相关的 APi 的响应。

types.py

各种类型的类定义。

utils.py

API 相关的常见操作。包括修改 URL、根据 uuid 获取 RPC 资源以及 OpenStack 资源等。

PreviouscontrollersNextbase.py

Last updated 5 years ago

Was this helpful?