From e9e13792f3800d19cda1d9ee8c35d2359d34d7bf Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Thu, 12 Nov 2020 23:14:35 +0000 Subject: [PATCH] Update web server type for kurl.nameserver --- web/src/client/kurl_test.ts | 33 +++++++++++++++++++++++++++++++++ web/src/installers/index.ts | 2 ++ web/src/test/installers.ts | 9 +++++++++ 3 files changed, 44 insertions(+) create mode 100644 web/src/client/kurl_test.ts diff --git a/web/src/client/kurl_test.ts b/web/src/client/kurl_test.ts new file mode 100644 index 0000000000..6dc7740746 --- /dev/null +++ b/web/src/client/kurl_test.ts @@ -0,0 +1,33 @@ +import * as path from "path"; +import {describe, it} from "mocha"; +import {expect} from "chai"; +import { KurlClient } from "./"; +import { Installer } from "../installers"; + +const kurlURL = process.env.KURL_URL || "http://localhost:30092"; +const client = new KurlClient(kurlURL); + +const spec = ` +spec: + kubernetes: + version: latest + weave: + version: latest + docker: + version: latest + kurl: + nameserver: 8.8.8.8 +`; + +describe("script with kurl config", () => { + it("200", async () => { + const uri = await client.postInstaller(spec); + + expect(uri).to.match(/dcd3038/); + + const script = await client.getInstallScript("dcd3038"); + + expect(script).to.match(new RegExp(`kurl:`)); + expect(script).to.match(new RegExp(`nameserver: 8.8.8.8`)); + }); +}); diff --git a/web/src/installers/index.ts b/web/src/installers/index.ts index b95140ffd2..0aa5565d92 100644 --- a/web/src/installers/index.ts +++ b/web/src/installers/index.ts @@ -309,6 +309,7 @@ export interface KurlConfig { privateAddress?: string; publicAddress?: string; task?: string; + nameserver?: string; } export const kurlConfigSchema = { @@ -323,6 +324,7 @@ export const kurlConfigSchema = { noProxy: { type: "boolean", flag: "no-proxy" , description: "Don’t detect or configure a proxy" }, privateAddress: { type: "string", flag: "private-address" , description: "The local address of the host (different for each host in the cluster)" }, publicAddress: { type: "string", flag: "public-address" , description: "The public address of the host (different for each host in the cluster), will be added as a CNAME to the k8s API server cert so you can use kubectl with this address" }, + nameserver: { type: "string" }, }, additionalProperties: false, }; diff --git a/web/src/test/installers.ts b/web/src/test/installers.ts index 048b425912..d0bbcbe7f6 100644 --- a/web/src/test/installers.ts +++ b/web/src/test/installers.ts @@ -91,6 +91,7 @@ spec: noProxy: false privateAddress: 10.38.1.1 publicAddress: 101.38.1.1 + nameserver: 8.8.8.8 collectd: version: 0.0.1 certManager: @@ -776,4 +777,12 @@ spec: expect(hasMetricsServer).to.equal(true); }); }); + + describe("kurl.nameserver", () => { + it("should parse the nameserver", () => { + const i = Installer.parse(everyOption); + + expect(i.spec.kurl.nameserver).to.equal("8.8.8.8"); + }); + }); });