Skip to content

Commit 01aa3bf

Browse files
committed
Remove references to postgres add-on
1 parent dc91262 commit 01aa3bf

File tree

4 files changed

+2
-96
lines changed

4 files changed

+2
-96
lines changed

examples/create-postgres.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/clusters.spec.ts

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { VendorPortalApi } from "./configuration";
22
import { createCluster, createClusterWithLicense, upgradeCluster, pollForStatus } from ".";
3-
import { Addon, Cluster, ClusterPort, StatusError, createAddonObjectStore, createAddonPostgres, exposeClusterPort, pollForAddonStatus } from "./clusters";
3+
import { Addon, Cluster, ClusterPort, StatusError, createAddonObjectStore, exposeClusterPort, pollForAddonStatus } from "./clusters";
44
import * as mockttp from "mockttp";
55

66
describe("ClusterService", () => {
@@ -226,29 +226,6 @@ describe("Cluster Add-ons", () => {
226226
expect(addon.object_store).toEqual(expectedAddon.addon.object_store);
227227
});
228228

229-
test("should return postgres add-on", async () => {
230-
const clusterId = "1234abcd";
231-
const expectedAddon = {
232-
addon: {
233-
id: "abcd1234",
234-
status: "applied",
235-
postgres: {
236-
uri: "postgres://postgres:1234@test:5432",
237-
version: "16.2",
238-
instance_type: "db.t3.micro",
239-
disk_gib: 200
240-
}
241-
}
242-
};
243-
244-
await mockServer.forPost(`/cluster/${clusterId}/addons/postgres`).thenReply(201, JSON.stringify(expectedAddon));
245-
246-
const addon: Addon = await createAddonPostgres(apiClient, clusterId);
247-
expect(addon.id).toEqual(expectedAddon.addon.id);
248-
expect(addon.status).toEqual(expectedAddon.addon.status);
249-
expect(addon.postgres).toEqual(expectedAddon.addon.postgres);
250-
});
251-
252229
test("should eventually return success with expected status", async () => {
253230
const clusterId = "1234abcd";
254231
const expectedAddon = { id: "1234abcd", status: "ready" };

src/clusters.ts

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -330,47 +330,6 @@ export async function createAddonObjectStore(vendorPortalApi: VendorPortalApi, c
330330
return addon;
331331
}
332332

333-
export async function createAddonPostgres(vendorPortalApi: VendorPortalApi, clusterId: string, version?: string, instanceType?: string, diskGib?: number): Promise<Addon> {
334-
const http = await vendorPortalApi.client();
335-
336-
const uri = `${vendorPortalApi.endpoint}/cluster/${clusterId}/addons/postgres`;
337-
338-
const reqBody = {};
339-
if (version) {
340-
reqBody["version"] = version;
341-
}
342-
if (instanceType) {
343-
reqBody["instance_type"] = instanceType;
344-
}
345-
if (diskGib) {
346-
reqBody["disk_gib"] = diskGib;
347-
}
348-
const res = await http.post(uri, JSON.stringify(reqBody));
349-
if (res.message.statusCode != 201) {
350-
let body = "";
351-
try {
352-
body = await res.readBody();
353-
} catch (err) {
354-
// ignore
355-
}
356-
throw new Error(`Failed to queue add-on create: Server responded with ${res.message.statusCode}: ${body}`);
357-
}
358-
359-
const body: any = JSON.parse(await res.readBody());
360-
361-
var addon: Addon = { id: body.addon.id, status: body.addon.status };
362-
if (body.addon.postgres) {
363-
addon.postgres = {
364-
uri: body.addon.postgres.uri,
365-
version: body.addon.postgres.version,
366-
instance_type: body.addon.postgres.instance_type,
367-
disk_gib: body.addon.postgres.disk_gib
368-
};
369-
}
370-
371-
return addon;
372-
}
373-
374333
export async function pollForAddonStatus(vendorPortalApi: VendorPortalApi, clusterId: string, addonId: string, expectedStatus: string, timeout: number = 120, sleeptimeMs: number = 5000): Promise<Addon> {
375334
// get add-ons from the api, look for the status of the id to be ${status}
376335
// if it's not ${status}, sleep for 5 seconds and try again

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export { VendorPortalApi } from "./configuration";
22
export { getApplicationDetails } from "./applications";
33
export { Channel, createChannel, getChannelDetails, archiveChannel } from "./channels";
4-
export { ClusterVersion, createCluster, createClusterWithLicense, pollForStatus, getKubeconfig, removeCluster, upgradeCluster, getClusterVersions, createAddonObjectStore, createAddonPostgres, pollForAddonStatus, exposeClusterPort } from "./clusters";
4+
export { ClusterVersion, createCluster, createClusterWithLicense, pollForStatus, getKubeconfig, removeCluster, upgradeCluster, getClusterVersions, createAddonObjectStore, pollForAddonStatus, exposeClusterPort } from "./clusters";
55
export { KubernetesDistribution, archiveCustomer, createCustomer, getUsedKubernetesDistributions } from "./customers";
66
export { Release, CompatibilityResult, createRelease, createReleaseFromChart, promoteRelease, reportCompatibilityResult } from "./releases";

0 commit comments

Comments
 (0)