Home / API Documentation / Platform management / Clusters / Cluster base operation / Differentiated update clusters

Differentiated update clusters

Requests

HTTP request

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

partially update the specified Cluster

Path parameters

Name Type Required Description
name string Truename of the Cluster

Query parameters

Name Type Required Description
dryRun string FalseWhen present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
fieldManager string FalsefieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).
force boolean FalseForce is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.
pretty string FalseIf 'true', then the output is pretty printed.

Request body

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

Sample request

Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.

{
   "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"
   }
 }

Responses

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

Status code: 200

OK

Sample response

Cluster is a Kubernetes cluster in

{
   "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"
   }
 }

Parameters

Name Type Description
apiVersion string See common parameters
kind string See common parameters
metadata object See common parameters
spec object ClusterSpec is a description of a cluster.
Path: spec
spec.clusterCIDR string ClusterCIDR is used to set a separated CIDR for k8s pod
Path: spec.clusterCIDR
spec.displayName string DisplayName is the display name of the cluster.
Path: spec.displayName
spec.dnsDomain string DNSDomain is the dns domain used by k8s services. Defaults to "cluster.local".
Path: spec.dnsDomain
spec.features object ClusterFeature records the features that are enabled by the cluster.
Path: spec.features
features.enableMasterSchedule boolean enable master node schedule or not
Path: spec.features.enableMasterSchedule
features.files array files
Path: spec.features.files
features.files[] object
Path: spec.features.files[]
files[].dst string destination file, only support regular file
Path: spec.features.files[].dst
files[].src string source file, only support regular file
Path: spec.features.files[].src
features.ha object
Path: spec.features.ha
ha.thirdParty object
Path: spec.features.ha.thirdParty
thirdParty.vip string virtual IP of the HA
Path: spec.features.ha.thirdParty.vip
thirdParty.vport integer (int32) virtual port of the HA
Path: spec.features.ha.thirdParty.vport
features.ipvs boolean ipvs on-off
Path: spec.features.ipvs
features.skipConditions array SkipConditions is a set of conditions that needs to be skipped
Path: spec.features.skipConditions
features.skipConditions[] string
Path: spec.features.skipConditions[]
features.upgrade object
Path: spec.features.upgrade
upgrade.mode string Upgrade mode, default value is Auto.
Path: spec.features.upgrade.mode
upgrade.strategy object UpgradeStrategy used to control the upgrade process.
Path: spec.features.upgrade.strategy
strategy.drainNodeBeforeUpgrade boolean Whether drain node before upgrade. Draining node before upgrade is recommended. But not all pod running as cows, a few running as pets. If your pod can not accept be expelled from current node, this value should be false.
Path: spec.features.upgrade.strategy.drainNodeBeforeUpgrade
strategy.maxUnready string (int-or-string) IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number.
Path: spec.features.upgrade.strategy.maxUnready
spec.finalizers array Finalizers is an opaque list of values that must be empty to permanently remove object from storage.
Path: spec.finalizers
spec.finalizers[] string
Path: spec.finalizers[]
spec.machines array cluster machine, represent master nodes in the cluster
Path: spec.machines
spec.machines[] object ClusterMachine is the master machine definition of cluster.
Path: spec.machines[]
machines[].displayName string displayName
Path: spec.machines[].displayName
machines[].ip string
Path: spec.machines[].ip
machines[].ipv6 string ipv6
Path: spec.machines[].ipv6
machines[].labels object
Path: spec.machines[].labels
machines[].networkDevice string networkDevice
Path: spec.machines[].networkDevice
machines[].password string (byte)
Path: spec.machines[].password
machines[].port integer (int32)
Path: spec.machines[].port
machines[].proxy object MachineProxy is the proxy to connect Machine's ssh.
Path: spec.machines[].proxy
machines[].publicIP string publicIP
Path: spec.machines[].publicIP
machines[].role string master/node
Path: spec.machines[].role
machines[].username string
Path: spec.machines[].username
spec.networkDevice string network device
Path: spec.networkDevice
spec.properties object ClusterProperty records the attribute information of the cluster.
Path: spec.properties
properties.maxNodePodNum integer (int32) max number of node pod
Path: spec.properties.maxNodePodNum
spec.serviceCIDR string ServiceCIDR is used to set a separated CIDR for k8s service, it's exclusive with MaxClusterServiceNum.
Path: spec.serviceCIDR
spec.tenantID string tenant id
Path: spec.tenantID
spec.type string cluster type, baremetal or imported
Path: spec.type
spec.version string cluster version
Path: spec.version
status object ClusterStatus represents information about the status of a cluster.
Path: status
status.phase string cluster phase
Path: status.phase

Other status codes

Status code: 401

Unauthorized