Skip to main content

Update

Updates the specified Kubernetes cluster.

import {
cloudApi,
decodeMessage,
serviceClients,
Session,
waitForOperation,
} from "@yandex-cloud/nodejs-sdk";

const Cluster = cloudApi.dataproc.cluster.Cluster;
const HadoopConfig_Service = cloudApi.dataproc.cluster.HadoopConfig_Service;
const UpdateClusterRequest =
cloudApi.dataproc.cluster_service.UpdateClusterRequest;

(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.ClusterServiceClient);

const operation = await client.update(
UpdateClusterRequest.fromPartial({
// clusterId: "clusterId",
// updateMask: {
// paths: ["paths"]
// },
// description: "description",
// labels: {"key": "labels"},
// configSpec: {
// subclustersSpec: [{
// id: "id",
// name: "name",
// resources: {
// resourcePresetId: "resourcePresetId",
// diskTypeId: "diskTypeId",
// diskSize: 0
// },
// hostsCount: 0,
// autoscalingConfig: {
// maxHostsCount: 0,
// preemptible: true,
// measurementDuration: {
// seconds: 0,
// nanos: 0
// },
// warmupDuration: {
// seconds: 0,
// nanos: 0
// },
// stabilizationDuration: {
// seconds: 0,
// nanos: 0
// },
// cpuUtilizationTarget: 0,
// decommissionTimeout: 0
// }
// }],
// hadoop: {
// services: [HadoopConfig_Service.HDFS],
// properties: {"key": "properties"},
// sshPublicKeys: ["sshPublicKeys"],
// initializationActions: [{
// uri: "uri",
// args: ["args"],
// timeout: 0
// }]
// }
// },
// name: "name",
// serviceAccountId: "serviceAccountId",
// bucket: "bucket",
// decommissionTimeout: 0,
// uiProxy: true,
// securityGroupIds: ["securityGroupIds"],
// deletionProtection: true,
// logGroupId: "logGroupId"
})
);
const finishedOp = await waitForOperation(operation, session);

if (finishedOp.response) {
const result = decodeMessage<typeof Cluster>(finishedOp.response);
console.log(result);
}
})();

UpdateClusterRequest​

clusterId : string​

ID of the Kubernetes cluster to update. To get the Kubernetes cluster ID use a ClusterService.List request.

updateMask : google.protobuf.FieldMask​
name : string​

Name of the Kubernetes cluster. The name must be unique within the folder.

description : string​

Description of the Kubernetes cluster.

labels : string​

Resource labels as key:value pairs.

Existing set of labels is completely replaced by the provided set.

One of internetGateway​

  • gatewayIpv4Address : string​

    Gateway IPv4 address.

masterSpec : MasterUpdateSpec​

Specification of the master update.

serviceAccountId : string​

Service account to be used for provisioning Compute Cloud and VPC resources for Kubernetes cluster. Selected service account should have edit role on the folder where the Kubernetes cluster will be located and on the folder where selected network resides.

nodeServiceAccountId : string​

Service account to be used by the worker nodes of the Kubernetes cluster to access Container Registry or to push node logs and metrics.

networkPolicy : NetworkPolicy​
ipAllocationPolicy : IPAllocationPolicy​

MasterUpdateSpec​

version : UpdateVersionSpec​

Specification of the master update.

maintenancePolicy : MasterMaintenancePolicy​

Maintenance policy of the master.

securityGroupIds : string​

Master security groups.

masterLogging : MasterLogging​

Cloud Logging for master components.

locations : LocationSpec​

Update master instance locations.

externalV6AddressSpec : ExternalAddressSpec​

Specification of parameters for external IPv6 networking.

NetworkPolicy​

Provider​
  • PROVIDER_UNSPECIFIED

  • CALICO

provider : Provider​

IPAllocationPolicy​

clusterIpv4CidrBlock : string​

CIDR block. IP range for allocating pod addresses.

It should not overlap with any subnet in the network the Kubernetes cluster located in. Static routes will be set up for this CIDR blocks in node subnets.

nodeIpv4CidrMaskSize : int64​

Size of the masks that are assigned for each node in the cluster.

If not specified, 24 is used.

serviceIpv4CidrBlock : string​

CIDR block. IP range Kubernetes service Kubernetes cluster IP addresses will be allocated from.

It should not overlap with any subnet in the network the Kubernetes cluster located in.

clusterIpv6CidrBlock : string​

IPv6 range for allocating pod IP addresses.

serviceIpv6CidrBlock : string​

IPv6 range for allocating Kubernetes service IP addresses

UpdateVersionSpec​

One of specifier​

  • version : string​

    Request update to a newer version of Kubernetes (1.x -> 1.y).

  • latestRevision : bool​

    Request update to the latest revision for the current version.

MasterMaintenancePolicy​

autoUpgrade : bool​

If set to true, automatic updates are installed in the specified period of time with no interaction from the user. If set to false, automatic upgrades are disabled.

maintenanceWindow : MaintenanceWindow​

Maintenance window settings. Update will start at the specified time and last no more than the specified duration. The time is set in UTC.

MasterLogging​

enabled : bool​

Identifies whether Cloud Logging is enabled for master components.

One of destination​

The destination of master components' logs.

  • logGroupId : string​

    ID of the log group where logs of master components should be stored.

  • folderId : string​

    ID of the folder where logs should be stored (in default group).

auditEnabled : bool​

Identifies whether Cloud Logging is enabled for audit logs.

clusterAutoscalerEnabled : bool​

Identifies whether Cloud Logging is enabled for cluster-autoscaler.

kubeApiserverEnabled : bool​

Identifies whether Cloud Logging is enabled for kube-apiserver.

eventsEnabled : bool​

Identifies whether Cloud Logging is enabled for events.

LocationSpec​

zoneId : string​

ID of the availability zone where the master resides.

subnetId : string​

ID of the VPC network's subnet where the master resides. If not specified and there is a single subnet in specified zone, address in this subnet will be allocated.

ExternalAddressSpec​

address : string​

IP address.

MaintenanceWindow​

One of policy​

Maintenance policy.

  • anytime : AnytimeMaintenanceWindow​

    Updating the master at any time.

  • dailyMaintenanceWindow : DailyMaintenanceWindow​

    Updating the master on any day during the specified time window.

  • weeklyMaintenanceWindow : WeeklyMaintenanceWindow​

    Updating the master on selected days during the specified time window.

AnytimeMaintenanceWindow​

DailyMaintenanceWindow​

startTime : google.type.TimeOfDay​

Window start time, in the UTC timezone.

duration : google.protobuf.Duration​

Window duration.

WeeklyMaintenanceWindow​

daysOfWeek : DaysOfWeekMaintenanceWindow​

Days of the week and the maintenance window for these days when automatic updates are allowed.

DaysOfWeekMaintenanceWindow​

days : google.type.DayOfWeek​

Days of the week when automatic updates are allowed.

startTime : google.type.TimeOfDay​

Window start time, in the UTC timezone.

duration : google.protobuf.Duration​

Window duration.

Operation​

An Operation resource. For more information, see Operation.

id : string​

ID of the operation.

description : string​

Description of the operation. 0-256 characters long.

createdAt : google.protobuf.Timestamp​

Creation timestamp.

createdBy : string​

ID of the user or service account who initiated the operation.

modifiedAt : google.protobuf.Timestamp​

The time when the Operation resource was last modified.

done : bool​

If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available.

metadata : google.protobuf.Any​

Service-specific metadata associated with the operation. It typically contains the ID of the target resource that the operation is performed on. Any method that returns a long-running operation should document the metadata type, if any.

One of result​

The operation result. If done == false and there was no failure detected, neither error nor response is set. If done == false and there was a failure detected, error is set. If done == true, exactly one of error or response is set.

  • error : google.rpc.Status​

    The error result of the operation in case of failure or cancellation.

  • response : google.protobuf.Any​
    The normal response of the operation in case of success.

    If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is the standard Create/Update, the response should be the target resource of the operation. Any method that returns a long-running operation should document the response type, if any.