首页 / API 文档 / 平台管理 / 集群管理 / 集群基础操作 / 差异化更新集群

差异化更新集群

请求信息

请求行

PATCH /apis/platform.tkestack.io/v1/clusters/{name}

差异化更新指定的集群。

请求行参数

名称 类型 是否必填项 描述
name string 集群的名称。

请求参数

名称 类型 是否必填项 描述
dryRun string 当该参数出现时,表示不应该持久化修改。一个无效的或无法识别的 dryRun 指令将导致错误响应,并且不会进一步处理请求。有效值为:All,将处理所有的试运行阶段。
fieldManager string fieldManager 是与进行这些更改的角色或实体相关联的名称。 该值必须少于或少于128个字符,并且只能包含可打印的字符。
force boolean 将“强制”应用请求。 这意味着用户将重新获取其他人拥有的冲突字段。 对于未应用的 PATCH 请求,必须取消设置强制标志。
pretty string 如果为 true,则会将返回结果输出成适合打印的格式。

请求体

Content-Type application/json-patch+json, application/merge-patch+json, application/strategic-merge-patch+json, application/apply-patch+yaml

请求体示例

Patch 方法,为了给 Kubernetes Patch 请求体一个具体的名称和类型。

{
   "apiVersion": "platform.tkestack.io/v1",
   "kind": "Cluster",
   "metadata": {
     "annotations": {
       "cpaas.io/network-type": "kube-ovn"
     },
     "name": "cluster-name"
   },
   "spec": {
     "clusterCIDR": "10.199.0.0/16",
     "displayName": "Global",
     "dnsDomain": "cluster.local",
     "features": {
       "enableMasterSchedule": true,
       "files": [
         {
           "dst": "/etc/kubernetes/audit/policy.yaml",
           "src": "/app/provider/baremetal/audit/policy.yaml"
         }
       ],
       "ha": {
         "thirdParty": {
           "vip": "192.168.1.100",
           "vport": 6443
         }
       },
       "ipvs": true,
       "skipConditions": [
         "EnsureGalaxy"
       ]
     },
     "machines": [
       {
         "displayName": "",
         "ip": "192.168.1.101",
         "ipv6": "",
         "labels": {
           "node-role.kubernetes.io/master": "",
           "nvidia-device-enable": "false"
         },
         "networkDevice": "",
         "password": "cGFzc3dvcmQ=",
         "port": 22,
         "proxy": {},
         "publicIP": "",
         "role": "",
         "username": "root"
       },
       {
         "displayName": "",
         "ip": "192.168.1.102",
         "ipv6": "",
         "labels": {
           "node-role.kubernetes.io/master": "",
           "nvidia-device-enable": "false"
         },
         "networkDevice": "",
         "password": "cGFzc3dvcmQ=",
         "port": 22,
         "proxy": {},
         "publicIP": "",
         "role": "",
         "username": "root"
       },
       {
         "displayName": "",
         "ip": "192.168.1.103",
         "ipv6": "",
         "labels": {
           "node-role.kubernetes.io/master": "",
           "nvidia-device-enable": "false"
         },
         "networkDevice": "",
         "password": "cGFzc3dvcmQ=",
         "port": 22,
         "proxy": {},
         "publicIP": "",
         "role": "",
         "username": "root"
       }
     ],
     "networkDevice": "eth0",
     "properties": {
       "maxNodePodNum": 256
     },
     "serviceCIDR": "10.96.0.0/12",
     "tenantID": "default",
     "type": "Baremetal",
     "version": "1.19.9"
   }
 }

返回信息

Content-Type application/json, application/yaml, application/vnd.kubernetes.protobuf

状态码: 200

OK

返回体示例

Kubernetes 集群。

{
   "apiVersion": "platform.tkestack.io/v1",
   "kind": "Cluster",
   "metadata": {
     "annotations": {
       "cpaas.io/network-type": "kube-ovn",
       "platform.tkestack.io/galaxy-ipam-ip": "10.96.0.8",
       "platform.tkestack.io/gpu-quota-admission-ip": "10.96.0.9"
     },
     "name": "cluster-name",
     "resourceVersion": "23234",
     "selfLink": "/apis/platform.tkestack.io/v1/clusters/cluster-name",
     "uid": "6cc56a49-8ac3-45ea-916c-10fb35b94723"
   },
   "spec": {
     "clusterCIDR": "10.199.0.0/16",
     "displayName": "Global",
     "dnsDomain": "cluster.local",
     "features": {
       "enableMasterSchedule": true,
       "files": [
         {
           "dst": "/etc/kubernetes/audit/policy.yaml",
           "src": "/app/provider/baremetal/audit/policy.yaml"
         }
       ],
       "ha": {
         "thirdParty": {
           "vip": "192.168.1.100",
           "vport": 6443
         }
       },
       "ipvs": true,
       "skipConditions": [
         "EnsureGalaxy",
         "EnsureNvidiaDriver",
         "EnsureMetricsServer"
       ],
       "upgrade": {
         "mode": "Auto",
         "strategy": {
           "drainNodeBeforeUpgrade": false,
           "maxUnready": 0
         }
       }
     },
     "finalizers": [
       "cluster"
     ],
     "machines": [
       {
         "displayName": "",
         "ip": "192.168.1.101",
         "ipv6": "",
         "labels": {
           "node-role.kubernetes.io/master": "",
           "nvidia-device-enable": "false"
         },
         "networkDevice": "",
         "password": "cGFzc3dvcmQ=",
         "port": 22,
         "proxy": {},
         "publicIP": "",
         "role": "",
         "username": "root"
       },
       {
         "displayName": "",
         "ip": "192.168.1.102",
         "ipv6": "",
         "labels": {
           "node-role.kubernetes.io/master": "",
           "nvidia-device-enable": "false"
         },
         "networkDevice": "",
         "password": "cGFzc3dvcmQ=",
         "port": 22,
         "proxy": {},
         "publicIP": "",
         "role": "",
         "username": "root"
       },
       {
         "displayName": "",
         "ip": "192.168.1.103",
         "ipv6": "",
         "labels": {
           "node-role.kubernetes.io/master": "",
           "nvidia-device-enable": "false"
         },
         "networkDevice": "",
         "password": "cGFzc3dvcmQ=",
         "port": 22,
         "proxy": {},
         "publicIP": "",
         "role": "",
         "username": "root"
       }
     ],
     "networkDevice": "eth0",
     "properties": {
       "maxNodePodNum": 256
     },
     "serviceCIDR": "10.96.0.0/12",
     "tenantID": "default",
     "type": "Baremetal",
     "version": "1.19.9"
   },
   "status": {
     "phase": "Running"
   }
 }

返回体说明

名称 类型 描述
apiVersion string 查看公共参数
kind string 查看公共参数
metadata object 查看公共参数
spec object 集群的描述。
字段路径:spec
spec.clusterCIDR string 容器网络的子网地址(CIDR 格式),例如:10.1.0.0/16,该地址应与节点子网不同。集群创建时的 Pod 可使用该网段内的 IP。
字段路径:spec.clusterCIDR
spec.displayName string 集群的显示名称。
字段路径:spec.displayName
spec.dnsDomain string DNSDomain 是被 k8s Service 使用的 DNS 域名。默认为 "cluster.local"。
字段路径:spec.dnsDomain
spec.features object ClusterFeature 记录了集群启用的特性。
字段路径:spec.features
features.enableMasterSchedule boolean 是否允许将应用调度到控制节点上。
字段路径:spec.features.enableMasterSchedule
features.files array 部署节点时额外复制的文件。
字段路径:spec.features.files
features.files[] object
字段路径:spec.features.files[]
files[].dst string 目标文件,只支持常规文件。
字段路径:spec.features.files[].dst
files[].src string 源文件,仅支持常规文件。
字段路径:spec.features.files[].src
features.ha object
字段路径:spec.features.ha
ha.thirdParty object
字段路径:spec.features.ha.thirdParty
thirdParty.vip string 第三方 HA(Highly Available) 的虚拟 IP。
字段路径:spec.features.ha.thirdParty.vip
thirdParty.vport integer (int32) 第三方 HA(Highly Available) 的虚拟端口。
字段路径:spec.features.ha.thirdParty.vport
features.ipvs boolean Ipvs 开关。
字段路径:spec.features.ipvs
features.skipConditions array SkipConditions 是一系列需要被跳过的状态。
字段路径:spec.features.skipConditions
features.skipConditions[] string
字段路径:spec.features.skipConditions[]
features.upgrade object
字段路径:spec.features.upgrade
upgrade.mode string 升级模式,默认值为 Auto。
字段路径:spec.features.upgrade.mode
upgrade.strategy object 用于控制升级过程的策略。
字段路径:spec.features.upgrade.strategy
strategy.drainNodeBeforeUpgrade boolean 升级前是否逐出节点上的 Pod。如果你的 Pod 不能接受被逐出当前节点,这个值应该是 false。
字段路径:spec.features.upgrade.strategy.drainNodeBeforeUpgrade
strategy.maxUnready string (int-or-string) IntOrString 是一种可以保存 int32 或 string 的类型。当在 JSON 或 YAML 编组和解组中使用时,它会生成或使用内部类型。例如,这允许您拥有一个可以接受名称或数字的 JSON 字段。
字段路径:spec.features.upgrade.strategy.maxUnready
spec.finalizers array 终结器是一个内部的值列表,必须为空才能从存储中永久删除对象。
字段路径:spec.finalizers
spec.finalizers[] string
字段路径:spec.finalizers[]
spec.machines array 集群节点,代表集群中的控制节点。
字段路径:spec.machines
spec.machines[] object ClusterMachine 是集群的 master 节点定义。
字段路径:spec.machines[]
machines[].displayName string 显示名称。
字段路径:spec.machines[].displayName
machines[].ip string
字段路径:spec.machines[].ip
machines[].ipv6 string IPV6 地址。
字段路径:spec.machines[].ipv6
machines[].labels object
字段路径:spec.machines[].labels
machines[].networkDevice string 网络设备(网卡)名称。
字段路径:spec.machines[].networkDevice
machines[].password string (byte)
字段路径:spec.machines[].password
machines[].port integer (int32)
字段路径:spec.machines[].port
machines[].proxy object 通过 SSH 服务访问节点的代理。
字段路径:spec.machines[].proxy
machines[].publicIP string 节点的公网 IP。
字段路径:spec.machines[].publicIP
machines[].role string 节点的类型,控制节点(master)/计算节点(node)。
字段路径:spec.machines[].role
machines[].username string
字段路径:spec.machines[].username
spec.networkDevice string 网卡设备。
字段路径:spec.networkDevice
spec.properties object ClusterProperty 记录了集群的属性信息。
字段路径:spec.properties
properties.maxNodePodNum integer (int32) 节点上允许调度的最大 Pod 数。
字段路径:spec.properties.maxNodePodNum
spec.serviceCIDR string Kubernetes Service 的网络地址范围(CIDR 格式),例如:10.96.0.0/12,不可与 Cluster CIDR 的网段重叠。与 MaxClusterServiceNum 互斥。
字段路径:spec.serviceCIDR
spec.tenantID string 租户 ID。
字段路径:spec.tenantID
spec.type string 集群类型,自建或接入。
字段路径:spec.type
spec.version string 集群的版本。
字段路径:spec.version
status object ClusterStatus 代表集群状态的信息。
字段路径:status
status.phase string 集群的执行进度阶段。
字段路径:status.phase

其他状态码

状态码: 401

Unauthorized