import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
task_id_list = client.cloud.k8s.clusters.update(
cluster_name="my-cluster",
project_id=1,
region_id=7,
)
print(task_id_list.tasks)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cloud"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
taskIDList, err := client.Cloud.K8S.Clusters.Update(
context.TODO(),
"my-cluster",
cloud.K8SClusterUpdateParams{
ProjectID: gcore.Int(1),
RegionID: gcore.Int(7),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", taskIDList.Tasks)
}
curl --request PATCH \
--url https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"add_ons": {
"slurm": {
"enabled": true,
"file_share_id": "cbc94d0e-06c6-4d12-9e86-9782ba14fc8c",
"ssh_key_ids": [
"25735292-bd97-44b0-a1af-d7eab876261d",
"efc01f3a-35b9-4385-89f9-e38439093ee7"
],
"worker_count": 2
}
},
"authentication": {
"oidc": {
"client_id": "kubernetes",
"groups_claim": "groups",
"groups_prefix": "oidc:",
"issuer_url": "https://accounts.provider.example",
"required_claims": {
"claim": "value"
},
"signing_algs": [
"RS256",
"RS512"
],
"username_claim": "sub",
"username_prefix": "oidc:"
}
},
"autoscaler_config": {
"scale-down-unneeded-time": "5m"
},
"cni": {
"cilium": {
"cni_exclusive": true,
"encryption": true,
"hubble_relay": true,
"hubble_ui": true,
"lb_acceleration": true,
"lb_mode": "snat",
"tunnel": "geneve"
},
"provider": "cilium"
},
"ddos_profile": {
"enabled": true,
"fields": [
{
"base_field": 10,
"field_value": [
45046,
45047
]
}
],
"profile_template": 29
},
"logging": {
"destination_region_id": 1,
"enabled": true,
"retention_policy": {
"period": 45
},
"topic_name": "my-log-name"
}
}
'const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
add_ons: {
slurm: {
enabled: true,
file_share_id: 'cbc94d0e-06c6-4d12-9e86-9782ba14fc8c',
ssh_key_ids: ['25735292-bd97-44b0-a1af-d7eab876261d', 'efc01f3a-35b9-4385-89f9-e38439093ee7'],
worker_count: 2
}
},
authentication: {
oidc: {
client_id: 'kubernetes',
groups_claim: 'groups',
groups_prefix: 'oidc:',
issuer_url: 'https://accounts.provider.example',
required_claims: {claim: 'value'},
signing_algs: ['RS256', 'RS512'],
username_claim: 'sub',
username_prefix: 'oidc:'
}
},
autoscaler_config: {'scale-down-unneeded-time': '5m'},
cni: {
cilium: {
cni_exclusive: true,
encryption: true,
hubble_relay: true,
hubble_ui: true,
lb_acceleration: true,
lb_mode: 'snat',
tunnel: 'geneve'
},
provider: 'cilium'
},
ddos_profile: {
enabled: true,
fields: [{base_field: 10, field_value: [45046, 45047]}],
profile_template: 29
},
logging: {
destination_region_id: 1,
enabled: true,
retention_policy: {period: 45},
topic_name: 'my-log-name'
}
})
};
fetch('https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'add_ons' => [
'slurm' => [
'enabled' => true,
'file_share_id' => 'cbc94d0e-06c6-4d12-9e86-9782ba14fc8c',
'ssh_key_ids' => [
'25735292-bd97-44b0-a1af-d7eab876261d',
'efc01f3a-35b9-4385-89f9-e38439093ee7'
],
'worker_count' => 2
]
],
'authentication' => [
'oidc' => [
'client_id' => 'kubernetes',
'groups_claim' => 'groups',
'groups_prefix' => 'oidc:',
'issuer_url' => 'https://accounts.provider.example',
'required_claims' => [
'claim' => 'value'
],
'signing_algs' => [
'RS256',
'RS512'
],
'username_claim' => 'sub',
'username_prefix' => 'oidc:'
]
],
'autoscaler_config' => [
'scale-down-unneeded-time' => '5m'
],
'cni' => [
'cilium' => [
'cni_exclusive' => true,
'encryption' => true,
'hubble_relay' => true,
'hubble_ui' => true,
'lb_acceleration' => true,
'lb_mode' => 'snat',
'tunnel' => 'geneve'
],
'provider' => 'cilium'
],
'ddos_profile' => [
'enabled' => true,
'fields' => [
[
'base_field' => 10,
'field_value' => [
45046,
45047
]
]
],
'profile_template' => 29
],
'logging' => [
'destination_region_id' => 1,
'enabled' => true,
'retention_policy' => [
'period' => 45
],
'topic_name' => 'my-log-name'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.patch("https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"add_ons\": {\n \"slurm\": {\n \"enabled\": true,\n \"file_share_id\": \"cbc94d0e-06c6-4d12-9e86-9782ba14fc8c\",\n \"ssh_key_ids\": [\n \"25735292-bd97-44b0-a1af-d7eab876261d\",\n \"efc01f3a-35b9-4385-89f9-e38439093ee7\"\n ],\n \"worker_count\": 2\n }\n },\n \"authentication\": {\n \"oidc\": {\n \"client_id\": \"kubernetes\",\n \"groups_claim\": \"groups\",\n \"groups_prefix\": \"oidc:\",\n \"issuer_url\": \"https://accounts.provider.example\",\n \"required_claims\": {\n \"claim\": \"value\"\n },\n \"signing_algs\": [\n \"RS256\",\n \"RS512\"\n ],\n \"username_claim\": \"sub\",\n \"username_prefix\": \"oidc:\"\n }\n },\n \"autoscaler_config\": {\n \"scale-down-unneeded-time\": \"5m\"\n },\n \"cni\": {\n \"cilium\": {\n \"cni_exclusive\": true,\n \"encryption\": true,\n \"hubble_relay\": true,\n \"hubble_ui\": true,\n \"lb_acceleration\": true,\n \"lb_mode\": \"snat\",\n \"tunnel\": \"geneve\"\n },\n \"provider\": \"cilium\"\n },\n \"ddos_profile\": {\n \"enabled\": true,\n \"fields\": [\n {\n \"base_field\": 10,\n \"field_value\": [\n 45046,\n 45047\n ]\n }\n ],\n \"profile_template\": 29\n },\n \"logging\": {\n \"destination_region_id\": 1,\n \"enabled\": true,\n \"retention_policy\": {\n \"period\": 45\n },\n \"topic_name\": \"my-log-name\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"add_ons\": {\n \"slurm\": {\n \"enabled\": true,\n \"file_share_id\": \"cbc94d0e-06c6-4d12-9e86-9782ba14fc8c\",\n \"ssh_key_ids\": [\n \"25735292-bd97-44b0-a1af-d7eab876261d\",\n \"efc01f3a-35b9-4385-89f9-e38439093ee7\"\n ],\n \"worker_count\": 2\n }\n },\n \"authentication\": {\n \"oidc\": {\n \"client_id\": \"kubernetes\",\n \"groups_claim\": \"groups\",\n \"groups_prefix\": \"oidc:\",\n \"issuer_url\": \"https://accounts.provider.example\",\n \"required_claims\": {\n \"claim\": \"value\"\n },\n \"signing_algs\": [\n \"RS256\",\n \"RS512\"\n ],\n \"username_claim\": \"sub\",\n \"username_prefix\": \"oidc:\"\n }\n },\n \"autoscaler_config\": {\n \"scale-down-unneeded-time\": \"5m\"\n },\n \"cni\": {\n \"cilium\": {\n \"cni_exclusive\": true,\n \"encryption\": true,\n \"hubble_relay\": true,\n \"hubble_ui\": true,\n \"lb_acceleration\": true,\n \"lb_mode\": \"snat\",\n \"tunnel\": \"geneve\"\n },\n \"provider\": \"cilium\"\n },\n \"ddos_profile\": {\n \"enabled\": true,\n \"fields\": [\n {\n \"base_field\": 10,\n \"field_value\": [\n 45046,\n 45047\n ]\n }\n ],\n \"profile_template\": 29\n },\n \"logging\": {\n \"destination_region_id\": 1,\n \"enabled\": true,\n \"retention_policy\": {\n \"period\": 45\n },\n \"topic_name\": \"my-log-name\"\n }\n}"
response = http.request(request)
puts response.read_body{
"tasks": [
"d478ae29-dedc-4869-82f0-96104425f565"
]
}{
"detail": "<string>",
"exception_class": "<string>",
"hint": "<string>",
"message": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"trace_id": "<string>",
"type": "internal-server-error",
"context": {
"allowed_methods": [
"<string>"
],
"blocking_count": 123,
"blocking_resources": [
{
"resource_id": "<string>",
"resource_type": "<string>",
"resource_name": "<string>"
}
],
"client_id": 123,
"operation": "<string>",
"project_id": 123,
"quotas": [
{
"available": 123,
"limit": 123,
"name": "<string>",
"overflow": 123,
"region_id": 123,
"requested": 123,
"resulting_usage": 123,
"scope": "global",
"unit": "<string>",
"usage": 123
}
],
"reason": "account",
"region_id": 123,
"resource_id": "<string>",
"resource_status": "<string>",
"resource_type": "<string>",
"retry_after": 123
},
"errors": [
{
"code": "<string>",
"detail": "<string>",
"loc": [
"<string>"
],
"ctx": {}
}
],
"info": null,
"invalid_fields": null
}{
"detail": "<string>",
"exception_class": "<string>",
"hint": "<string>",
"message": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"trace_id": "<string>",
"type": "internal-server-error",
"context": {
"allowed_methods": [
"<string>"
],
"blocking_count": 123,
"blocking_resources": [
{
"resource_id": "<string>",
"resource_type": "<string>",
"resource_name": "<string>"
}
],
"client_id": 123,
"operation": "<string>",
"project_id": 123,
"quotas": [
{
"available": 123,
"limit": 123,
"name": "<string>",
"overflow": 123,
"region_id": 123,
"requested": 123,
"resulting_usage": 123,
"scope": "global",
"unit": "<string>",
"usage": 123
}
],
"reason": "account",
"region_id": 123,
"resource_id": "<string>",
"resource_status": "<string>",
"resource_type": "<string>",
"retry_after": 123
},
"errors": [
{
"code": "<string>",
"detail": "<string>",
"loc": [
"<string>"
],
"ctx": {}
}
],
"info": null,
"invalid_fields": null
}{
"detail": "<string>",
"exception_class": "<string>",
"hint": "<string>",
"message": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"trace_id": "<string>",
"type": "internal-server-error",
"context": {
"allowed_methods": [
"<string>"
],
"blocking_count": 123,
"blocking_resources": [
{
"resource_id": "<string>",
"resource_type": "<string>",
"resource_name": "<string>"
}
],
"client_id": 123,
"operation": "<string>",
"project_id": 123,
"quotas": [
{
"available": 123,
"limit": 123,
"name": "<string>",
"overflow": 123,
"region_id": 123,
"requested": 123,
"resulting_usage": 123,
"scope": "global",
"unit": "<string>",
"usage": 123
}
],
"reason": "account",
"region_id": 123,
"resource_id": "<string>",
"resource_status": "<string>",
"resource_type": "<string>",
"retry_after": 123
},
"errors": [
{
"code": "<string>",
"detail": "<string>",
"loc": [
"<string>"
],
"ctx": {}
}
],
"info": null,
"invalid_fields": null
}{
"detail": "<string>",
"exception_class": "<string>",
"hint": "<string>",
"message": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"trace_id": "<string>",
"type": "internal-server-error",
"context": {
"allowed_methods": [
"<string>"
],
"blocking_count": 123,
"blocking_resources": [
{
"resource_id": "<string>",
"resource_type": "<string>",
"resource_name": "<string>"
}
],
"client_id": 123,
"operation": "<string>",
"project_id": 123,
"quotas": [
{
"available": 123,
"limit": 123,
"name": "<string>",
"overflow": 123,
"region_id": 123,
"requested": 123,
"resulting_usage": 123,
"scope": "global",
"unit": "<string>",
"usage": 123
}
],
"reason": "account",
"region_id": 123,
"resource_id": "<string>",
"resource_status": "<string>",
"resource_type": "<string>",
"retry_after": 123
},
"errors": [
{
"code": "<string>",
"detail": "<string>",
"loc": [
"<string>"
],
"ctx": {}
}
],
"info": null,
"invalid_fields": null
}{
"detail": "<string>",
"exception_class": "<string>",
"hint": "<string>",
"message": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"trace_id": "<string>",
"type": "internal-server-error",
"context": {
"allowed_methods": [
"<string>"
],
"blocking_count": 123,
"blocking_resources": [
{
"resource_id": "<string>",
"resource_type": "<string>",
"resource_name": "<string>"
}
],
"client_id": 123,
"operation": "<string>",
"project_id": 123,
"quotas": [
{
"available": 123,
"limit": 123,
"name": "<string>",
"overflow": 123,
"region_id": 123,
"requested": 123,
"resulting_usage": 123,
"scope": "global",
"unit": "<string>",
"usage": 123
}
],
"reason": "account",
"region_id": 123,
"resource_id": "<string>",
"resource_status": "<string>",
"resource_type": "<string>",
"retry_after": 123
},
"errors": [
{
"code": "<string>",
"detail": "<string>",
"loc": [
"<string>"
],
"ctx": {}
}
],
"info": null,
"invalid_fields": null
}{
"detail": "<string>",
"exception_class": "<string>",
"hint": "<string>",
"message": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"trace_id": "<string>",
"type": "internal-server-error",
"context": {
"allowed_methods": [
"<string>"
],
"blocking_count": 123,
"blocking_resources": [
{
"resource_id": "<string>",
"resource_type": "<string>",
"resource_name": "<string>"
}
],
"client_id": 123,
"operation": "<string>",
"project_id": 123,
"quotas": [
{
"available": 123,
"limit": 123,
"name": "<string>",
"overflow": 123,
"region_id": 123,
"requested": 123,
"resulting_usage": 123,
"scope": "global",
"unit": "<string>",
"usage": 123
}
],
"reason": "account",
"region_id": 123,
"resource_id": "<string>",
"resource_status": "<string>",
"resource_type": "<string>",
"retry_after": 123
},
"errors": [
{
"code": "<string>",
"detail": "<string>",
"loc": [
"<string>"
],
"ctx": {}
}
],
"info": null,
"invalid_fields": null
}{
"detail": "<string>",
"exception_class": "<string>",
"hint": "<string>",
"message": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"trace_id": "<string>",
"type": "internal-server-error",
"context": {
"allowed_methods": [
"<string>"
],
"blocking_count": 123,
"blocking_resources": [
{
"resource_id": "<string>",
"resource_type": "<string>",
"resource_name": "<string>"
}
],
"client_id": 123,
"operation": "<string>",
"project_id": 123,
"quotas": [
{
"available": 123,
"limit": 123,
"name": "<string>",
"overflow": 123,
"region_id": 123,
"requested": 123,
"resulting_usage": 123,
"scope": "global",
"unit": "<string>",
"usage": 123
}
],
"reason": "account",
"region_id": 123,
"resource_id": "<string>",
"resource_status": "<string>",
"resource_type": "<string>",
"retry_after": 123
},
"errors": [
{
"code": "<string>",
"detail": "<string>",
"loc": [
"<string>"
],
"ctx": {}
}
],
"info": null,
"invalid_fields": null
}Update k8s cluster
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
task_id_list = client.cloud.k8s.clusters.update(
cluster_name="my-cluster",
project_id=1,
region_id=7,
)
print(task_id_list.tasks)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cloud"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
taskIDList, err := client.Cloud.K8S.Clusters.Update(
context.TODO(),
"my-cluster",
cloud.K8SClusterUpdateParams{
ProjectID: gcore.Int(1),
RegionID: gcore.Int(7),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", taskIDList.Tasks)
}
curl --request PATCH \
--url https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"add_ons": {
"slurm": {
"enabled": true,
"file_share_id": "cbc94d0e-06c6-4d12-9e86-9782ba14fc8c",
"ssh_key_ids": [
"25735292-bd97-44b0-a1af-d7eab876261d",
"efc01f3a-35b9-4385-89f9-e38439093ee7"
],
"worker_count": 2
}
},
"authentication": {
"oidc": {
"client_id": "kubernetes",
"groups_claim": "groups",
"groups_prefix": "oidc:",
"issuer_url": "https://accounts.provider.example",
"required_claims": {
"claim": "value"
},
"signing_algs": [
"RS256",
"RS512"
],
"username_claim": "sub",
"username_prefix": "oidc:"
}
},
"autoscaler_config": {
"scale-down-unneeded-time": "5m"
},
"cni": {
"cilium": {
"cni_exclusive": true,
"encryption": true,
"hubble_relay": true,
"hubble_ui": true,
"lb_acceleration": true,
"lb_mode": "snat",
"tunnel": "geneve"
},
"provider": "cilium"
},
"ddos_profile": {
"enabled": true,
"fields": [
{
"base_field": 10,
"field_value": [
45046,
45047
]
}
],
"profile_template": 29
},
"logging": {
"destination_region_id": 1,
"enabled": true,
"retention_policy": {
"period": 45
},
"topic_name": "my-log-name"
}
}
'const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
add_ons: {
slurm: {
enabled: true,
file_share_id: 'cbc94d0e-06c6-4d12-9e86-9782ba14fc8c',
ssh_key_ids: ['25735292-bd97-44b0-a1af-d7eab876261d', 'efc01f3a-35b9-4385-89f9-e38439093ee7'],
worker_count: 2
}
},
authentication: {
oidc: {
client_id: 'kubernetes',
groups_claim: 'groups',
groups_prefix: 'oidc:',
issuer_url: 'https://accounts.provider.example',
required_claims: {claim: 'value'},
signing_algs: ['RS256', 'RS512'],
username_claim: 'sub',
username_prefix: 'oidc:'
}
},
autoscaler_config: {'scale-down-unneeded-time': '5m'},
cni: {
cilium: {
cni_exclusive: true,
encryption: true,
hubble_relay: true,
hubble_ui: true,
lb_acceleration: true,
lb_mode: 'snat',
tunnel: 'geneve'
},
provider: 'cilium'
},
ddos_profile: {
enabled: true,
fields: [{base_field: 10, field_value: [45046, 45047]}],
profile_template: 29
},
logging: {
destination_region_id: 1,
enabled: true,
retention_policy: {period: 45},
topic_name: 'my-log-name'
}
})
};
fetch('https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'add_ons' => [
'slurm' => [
'enabled' => true,
'file_share_id' => 'cbc94d0e-06c6-4d12-9e86-9782ba14fc8c',
'ssh_key_ids' => [
'25735292-bd97-44b0-a1af-d7eab876261d',
'efc01f3a-35b9-4385-89f9-e38439093ee7'
],
'worker_count' => 2
]
],
'authentication' => [
'oidc' => [
'client_id' => 'kubernetes',
'groups_claim' => 'groups',
'groups_prefix' => 'oidc:',
'issuer_url' => 'https://accounts.provider.example',
'required_claims' => [
'claim' => 'value'
],
'signing_algs' => [
'RS256',
'RS512'
],
'username_claim' => 'sub',
'username_prefix' => 'oidc:'
]
],
'autoscaler_config' => [
'scale-down-unneeded-time' => '5m'
],
'cni' => [
'cilium' => [
'cni_exclusive' => true,
'encryption' => true,
'hubble_relay' => true,
'hubble_ui' => true,
'lb_acceleration' => true,
'lb_mode' => 'snat',
'tunnel' => 'geneve'
],
'provider' => 'cilium'
],
'ddos_profile' => [
'enabled' => true,
'fields' => [
[
'base_field' => 10,
'field_value' => [
45046,
45047
]
]
],
'profile_template' => 29
],
'logging' => [
'destination_region_id' => 1,
'enabled' => true,
'retention_policy' => [
'period' => 45
],
'topic_name' => 'my-log-name'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.patch("https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"add_ons\": {\n \"slurm\": {\n \"enabled\": true,\n \"file_share_id\": \"cbc94d0e-06c6-4d12-9e86-9782ba14fc8c\",\n \"ssh_key_ids\": [\n \"25735292-bd97-44b0-a1af-d7eab876261d\",\n \"efc01f3a-35b9-4385-89f9-e38439093ee7\"\n ],\n \"worker_count\": 2\n }\n },\n \"authentication\": {\n \"oidc\": {\n \"client_id\": \"kubernetes\",\n \"groups_claim\": \"groups\",\n \"groups_prefix\": \"oidc:\",\n \"issuer_url\": \"https://accounts.provider.example\",\n \"required_claims\": {\n \"claim\": \"value\"\n },\n \"signing_algs\": [\n \"RS256\",\n \"RS512\"\n ],\n \"username_claim\": \"sub\",\n \"username_prefix\": \"oidc:\"\n }\n },\n \"autoscaler_config\": {\n \"scale-down-unneeded-time\": \"5m\"\n },\n \"cni\": {\n \"cilium\": {\n \"cni_exclusive\": true,\n \"encryption\": true,\n \"hubble_relay\": true,\n \"hubble_ui\": true,\n \"lb_acceleration\": true,\n \"lb_mode\": \"snat\",\n \"tunnel\": \"geneve\"\n },\n \"provider\": \"cilium\"\n },\n \"ddos_profile\": {\n \"enabled\": true,\n \"fields\": [\n {\n \"base_field\": 10,\n \"field_value\": [\n 45046,\n 45047\n ]\n }\n ],\n \"profile_template\": 29\n },\n \"logging\": {\n \"destination_region_id\": 1,\n \"enabled\": true,\n \"retention_policy\": {\n \"period\": 45\n },\n \"topic_name\": \"my-log-name\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"add_ons\": {\n \"slurm\": {\n \"enabled\": true,\n \"file_share_id\": \"cbc94d0e-06c6-4d12-9e86-9782ba14fc8c\",\n \"ssh_key_ids\": [\n \"25735292-bd97-44b0-a1af-d7eab876261d\",\n \"efc01f3a-35b9-4385-89f9-e38439093ee7\"\n ],\n \"worker_count\": 2\n }\n },\n \"authentication\": {\n \"oidc\": {\n \"client_id\": \"kubernetes\",\n \"groups_claim\": \"groups\",\n \"groups_prefix\": \"oidc:\",\n \"issuer_url\": \"https://accounts.provider.example\",\n \"required_claims\": {\n \"claim\": \"value\"\n },\n \"signing_algs\": [\n \"RS256\",\n \"RS512\"\n ],\n \"username_claim\": \"sub\",\n \"username_prefix\": \"oidc:\"\n }\n },\n \"autoscaler_config\": {\n \"scale-down-unneeded-time\": \"5m\"\n },\n \"cni\": {\n \"cilium\": {\n \"cni_exclusive\": true,\n \"encryption\": true,\n \"hubble_relay\": true,\n \"hubble_ui\": true,\n \"lb_acceleration\": true,\n \"lb_mode\": \"snat\",\n \"tunnel\": \"geneve\"\n },\n \"provider\": \"cilium\"\n },\n \"ddos_profile\": {\n \"enabled\": true,\n \"fields\": [\n {\n \"base_field\": 10,\n \"field_value\": [\n 45046,\n 45047\n ]\n }\n ],\n \"profile_template\": 29\n },\n \"logging\": {\n \"destination_region_id\": 1,\n \"enabled\": true,\n \"retention_policy\": {\n \"period\": 45\n },\n \"topic_name\": \"my-log-name\"\n }\n}"
response = http.request(request)
puts response.read_body{
"tasks": [
"d478ae29-dedc-4869-82f0-96104425f565"
]
}{
"detail": "<string>",
"exception_class": "<string>",
"hint": "<string>",
"message": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"trace_id": "<string>",
"type": "internal-server-error",
"context": {
"allowed_methods": [
"<string>"
],
"blocking_count": 123,
"blocking_resources": [
{
"resource_id": "<string>",
"resource_type": "<string>",
"resource_name": "<string>"
}
],
"client_id": 123,
"operation": "<string>",
"project_id": 123,
"quotas": [
{
"available": 123,
"limit": 123,
"name": "<string>",
"overflow": 123,
"region_id": 123,
"requested": 123,
"resulting_usage": 123,
"scope": "global",
"unit": "<string>",
"usage": 123
}
],
"reason": "account",
"region_id": 123,
"resource_id": "<string>",
"resource_status": "<string>",
"resource_type": "<string>",
"retry_after": 123
},
"errors": [
{
"code": "<string>",
"detail": "<string>",
"loc": [
"<string>"
],
"ctx": {}
}
],
"info": null,
"invalid_fields": null
}{
"detail": "<string>",
"exception_class": "<string>",
"hint": "<string>",
"message": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"trace_id": "<string>",
"type": "internal-server-error",
"context": {
"allowed_methods": [
"<string>"
],
"blocking_count": 123,
"blocking_resources": [
{
"resource_id": "<string>",
"resource_type": "<string>",
"resource_name": "<string>"
}
],
"client_id": 123,
"operation": "<string>",
"project_id": 123,
"quotas": [
{
"available": 123,
"limit": 123,
"name": "<string>",
"overflow": 123,
"region_id": 123,
"requested": 123,
"resulting_usage": 123,
"scope": "global",
"unit": "<string>",
"usage": 123
}
],
"reason": "account",
"region_id": 123,
"resource_id": "<string>",
"resource_status": "<string>",
"resource_type": "<string>",
"retry_after": 123
},
"errors": [
{
"code": "<string>",
"detail": "<string>",
"loc": [
"<string>"
],
"ctx": {}
}
],
"info": null,
"invalid_fields": null
}{
"detail": "<string>",
"exception_class": "<string>",
"hint": "<string>",
"message": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"trace_id": "<string>",
"type": "internal-server-error",
"context": {
"allowed_methods": [
"<string>"
],
"blocking_count": 123,
"blocking_resources": [
{
"resource_id": "<string>",
"resource_type": "<string>",
"resource_name": "<string>"
}
],
"client_id": 123,
"operation": "<string>",
"project_id": 123,
"quotas": [
{
"available": 123,
"limit": 123,
"name": "<string>",
"overflow": 123,
"region_id": 123,
"requested": 123,
"resulting_usage": 123,
"scope": "global",
"unit": "<string>",
"usage": 123
}
],
"reason": "account",
"region_id": 123,
"resource_id": "<string>",
"resource_status": "<string>",
"resource_type": "<string>",
"retry_after": 123
},
"errors": [
{
"code": "<string>",
"detail": "<string>",
"loc": [
"<string>"
],
"ctx": {}
}
],
"info": null,
"invalid_fields": null
}{
"detail": "<string>",
"exception_class": "<string>",
"hint": "<string>",
"message": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"trace_id": "<string>",
"type": "internal-server-error",
"context": {
"allowed_methods": [
"<string>"
],
"blocking_count": 123,
"blocking_resources": [
{
"resource_id": "<string>",
"resource_type": "<string>",
"resource_name": "<string>"
}
],
"client_id": 123,
"operation": "<string>",
"project_id": 123,
"quotas": [
{
"available": 123,
"limit": 123,
"name": "<string>",
"overflow": 123,
"region_id": 123,
"requested": 123,
"resulting_usage": 123,
"scope": "global",
"unit": "<string>",
"usage": 123
}
],
"reason": "account",
"region_id": 123,
"resource_id": "<string>",
"resource_status": "<string>",
"resource_type": "<string>",
"retry_after": 123
},
"errors": [
{
"code": "<string>",
"detail": "<string>",
"loc": [
"<string>"
],
"ctx": {}
}
],
"info": null,
"invalid_fields": null
}{
"detail": "<string>",
"exception_class": "<string>",
"hint": "<string>",
"message": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"trace_id": "<string>",
"type": "internal-server-error",
"context": {
"allowed_methods": [
"<string>"
],
"blocking_count": 123,
"blocking_resources": [
{
"resource_id": "<string>",
"resource_type": "<string>",
"resource_name": "<string>"
}
],
"client_id": 123,
"operation": "<string>",
"project_id": 123,
"quotas": [
{
"available": 123,
"limit": 123,
"name": "<string>",
"overflow": 123,
"region_id": 123,
"requested": 123,
"resulting_usage": 123,
"scope": "global",
"unit": "<string>",
"usage": 123
}
],
"reason": "account",
"region_id": 123,
"resource_id": "<string>",
"resource_status": "<string>",
"resource_type": "<string>",
"retry_after": 123
},
"errors": [
{
"code": "<string>",
"detail": "<string>",
"loc": [
"<string>"
],
"ctx": {}
}
],
"info": null,
"invalid_fields": null
}{
"detail": "<string>",
"exception_class": "<string>",
"hint": "<string>",
"message": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"trace_id": "<string>",
"type": "internal-server-error",
"context": {
"allowed_methods": [
"<string>"
],
"blocking_count": 123,
"blocking_resources": [
{
"resource_id": "<string>",
"resource_type": "<string>",
"resource_name": "<string>"
}
],
"client_id": 123,
"operation": "<string>",
"project_id": 123,
"quotas": [
{
"available": 123,
"limit": 123,
"name": "<string>",
"overflow": 123,
"region_id": 123,
"requested": 123,
"resulting_usage": 123,
"scope": "global",
"unit": "<string>",
"usage": 123
}
],
"reason": "account",
"region_id": 123,
"resource_id": "<string>",
"resource_status": "<string>",
"resource_type": "<string>",
"retry_after": 123
},
"errors": [
{
"code": "<string>",
"detail": "<string>",
"loc": [
"<string>"
],
"ctx": {}
}
],
"info": null,
"invalid_fields": null
}{
"detail": "<string>",
"exception_class": "<string>",
"hint": "<string>",
"message": "<string>",
"request_id": "<string>",
"status": 123,
"title": "<string>",
"trace_id": "<string>",
"type": "internal-server-error",
"context": {
"allowed_methods": [
"<string>"
],
"blocking_count": 123,
"blocking_resources": [
{
"resource_id": "<string>",
"resource_type": "<string>",
"resource_name": "<string>"
}
],
"client_id": 123,
"operation": "<string>",
"project_id": 123,
"quotas": [
{
"available": 123,
"limit": 123,
"name": "<string>",
"overflow": 123,
"region_id": 123,
"requested": 123,
"resulting_usage": 123,
"scope": "global",
"unit": "<string>",
"usage": 123
}
],
"reason": "account",
"region_id": 123,
"resource_id": "<string>",
"resource_status": "<string>",
"resource_type": "<string>",
"retry_after": 123
},
"errors": [
{
"code": "<string>",
"detail": "<string>",
"loc": [
"<string>"
],
"ctx": {}
}
],
"info": null,
"invalid_fields": null
}Authorizations
API key for authentication. Make sure to include the word apikey, followed by a single space and then your token.
Example: apikey 1234_abcdef
Path Parameters
Project ID
1
Region ID
7
Cluster name
"my-cluster"
Body
Cluster add-ons configuration
Show child attributes
Show child attributes
{ "slurm": { "enabled": true, "file_share_id": "cbc94d0e-06c6-4d12-9e86-9782ba14fc8c", "ssh_key_ids": [ "25735292-bd97-44b0-a1af-d7eab876261d", "efc01f3a-35b9-4385-89f9-e38439093ee7" ], "worker_count": 2 } }
Authentication settings
Show child attributes
Show child attributes
{ "oidc": { "client_id": "kubernetes", "groups_claim": "groups", "groups_prefix": "oidc:", "issuer_url": "https://accounts.provider.example", "required_claims": { "claim": "value" }, "signing_algs": ["RS256", "RS512"], "username_claim": "sub", "username_prefix": "oidc:" } }
Cluster autoscaler configuration.
It allows you to override the default cluster-autoscaler parameters provided by the platform with your preferred values.
Supported parameters (in alphabetical order):
- balance-similar-node-groups (boolean: true/false) - Detect similar node groups and balance the number of nodes between them.
- expander (string: random, most-pods, least-waste, price, priority, grpc) - Type of node group expander to be used in scale up. Specifying multiple values separated by commas will call the expanders in succession until there is only one option remaining.
- expendable-pods-priority-cutoff (float) - Pods with priority below cutoff will be expendable. They can be killed without any consideration during scale down and they don't cause scale up. Pods with null priority (PodPriority disabled) are non expendable.
- ignore-daemonsets-utilization (boolean: true/false) - Should CA ignore DaemonSet pods when calculating resource utilization for scaling down.
- max-empty-bulk-delete (integer) - Maximum number of empty nodes that can be deleted at the same time.
- max-graceful-termination-sec (integer) - Maximum number of seconds CA waits for pod termination when trying to scale down a node.
- max-node-provision-time (duration: e.g., '15m') - The default maximum time CA waits for node to be provisioned - the value can be overridden per node group.
- max-total-unready-percentage (float) - Maximum percentage of unready nodes in the cluster. After this is exceeded, CA halts operations.
- new-pod-scale-up-delay (duration: e.g., '10s') - Pods less than this old will not be considered for scale-up. Can be increased for individual pods through annotation.
- ok-total-unready-count (integer) - Number of allowed unready nodes, irrespective of max-total-unready-percentage.
- scale-down-delay-after-add (duration: e.g., '10m') - How long after scale up that scale down evaluation resumes.
- scale-down-delay-after-delete (duration: e.g., '10s') - How long after node deletion that scale down evaluation resumes.
- scale-down-delay-after-failure (duration: e.g., '3m') - How long after scale down failure that scale down evaluation resumes.
- scale-down-enabled (boolean: true/false) - Should CA scale down the cluster.
- scale-down-unneeded-time (duration: e.g., '10m') - How long a node should be unneeded before it is eligible for scale down.
- scale-down-unready-time (duration: e.g., '20m') - How long an unready node should be unneeded before it is eligible for scale down.
- scale-down-utilization-threshold (float) - The maximum value between the sum of cpu requests and sum of memory requests of all pods running on the node divided by node's corresponding allocatable resource, below which a node can be considered for scale down.
- scan-interval (duration: e.g., '10s') - How often cluster is reevaluated for scale up or down.
- skip-nodes-with-custom-controller-pods (boolean: true/false) - If true cluster autoscaler will never delete nodes with pods owned by custom controllers.
- skip-nodes-with-local-storage (boolean: true/false) - If true cluster autoscaler will never delete nodes with pods with local storage, e.g. EmptyDir or HostPath.
- skip-nodes-with-system-pods (boolean: true/false) - If true cluster autoscaler will never delete nodes with pods from kube-system (except for DaemonSet or mirror pods).
Show child attributes
Show child attributes
{ "scale-down-unneeded-time": "5m" }
Cluster CNI settings
Show child attributes
Show child attributes
{ "cilium": { "cni_exclusive": true, "encryption": true, "hubble_relay": true, "hubble_ui": true, "lb_acceleration": true, "lb_mode": "snat", "tunnel": "geneve" }, "provider": "cilium" }
Advanced DDoS Protection profile
Show child attributes
Show child attributes
{ "enabled": true, "fields": [ { "base_field": 10, "field_value": [45046, 45047] } ], "profile_template": 29 }
Logging configuration
Show child attributes
Show child attributes
{ "destination_region_id": 1, "enabled": true, "retention_policy": { "period": 45 }, "topic_name": "my-log-name" }
Response
OK
List of task IDs representing asynchronous operations. Use these IDs to monitor operation progress:
GET /v1/tasks/{task_id}- Check individual task status and details Poll task status until completion (FINISHED/ERROR) before proceeding with dependent operations.
["d478ae29-dedc-4869-82f0-96104425f565"]
Was this page helpful?