Skip to content

Commit

Permalink
Merge pull request #896 from areed/nameserver-web
Browse files Browse the repository at this point in the history
Update web server type for kurl.nameserver
  • Loading branch information
areed authored Nov 12, 2020
2 parents 9e21f58 + e9e1379 commit 1070643
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
33 changes: 33 additions & 0 deletions web/src/client/kurl_test.ts
Original file line number Diff line number Diff line change
@@ -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`));
});
});
2 changes: 2 additions & 0 deletions web/src/installers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ export interface KurlConfig {
privateAddress?: string;
publicAddress?: string;
task?: string;
nameserver?: string;
}

export const kurlConfigSchema = {
Expand All @@ -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,
};
Expand Down
9 changes: 9 additions & 0 deletions web/src/test/installers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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");
});
});
});

0 comments on commit 1070643

Please sign in to comment.