//native
type Linode = {
token: string;
};
/**
* Update a node pool
* Updates a node pool's count, labels and taints, and autoscaler configuration.
*/
export async function main(
auth: Linode,
apiVersion: "v4" | "v4beta",
clusterId: string,
poolId: string,
body: {
autoscaler?: { enabled?: false | true; max?: number; min?: number };
count?: number;
labels?: {};
taints?: {
effect: "NoSchedule" | "PreferNoSchedule" | "NoExecute";
key: string;
value: string;
}[];
},
) {
const url = new URL(
`https://api.linode.com/${apiVersion}/lke/clusters/${clusterId}/pools/${poolId}`,
);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago