@@ -6,10 +6,24 @@ import * as needle from 'needle';
66
77const clusterName = 'kind' ;
88
9- export async function createCluster ( ) : Promise < void > {
9+ export async function setupTester ( ) : Promise < void > {
1010 const osDistro = platform ( ) ;
1111 await download ( osDistro ) ;
12- await createKindCluster ( clusterName ) ;
12+ }
13+
14+ export async function createCluster ( ) : Promise < void > {
15+ // available tags may be viewed at https://hub.docker.com/r/kindest/node/tags
16+ const kindImageTag = 'latest' ;
17+ console . log ( `Creating cluster "${ clusterName } " with Kind image tag ${ kindImageTag } ...` ) ;
18+
19+ let kindImageArgument = '' ;
20+ if ( kindImageTag !== 'latest' ) {
21+ // not specifying the "--image" argument tells Kind to pick the latest image
22+ // which does not necessarily have the "latest" tag
23+ kindImageArgument = `--image="kindest/node:${ kindImageTag } "` ;
24+ }
25+ await exec ( `./kind create cluster --name="${ clusterName } " ${ kindImageArgument } ` ) ;
26+ console . log ( `Created cluster ${ clusterName } !` ) ;
1327}
1428
1529export async function deleteCluster ( ) : Promise < void > {
@@ -61,17 +75,3 @@ async function download(osDistro: string): Promise<void> {
6175 console . log ( 'KinD downloaded!' ) ;
6276 }
6377}
64-
65- // available tags may be viewed at https://hub.docker.com/r/kindest/node/tags
66- async function createKindCluster ( clusterName , kindImageTag = 'latest' ) : Promise < void > {
67- console . log ( `Creating cluster "${ clusterName } " with Kind image tag ${ kindImageTag } ...` ) ;
68-
69- let kindImageArgument = '' ;
70- if ( kindImageTag !== 'latest' ) {
71- // not specifying the "--image" argument tells Kind to pick the latest image
72- // which does not necessarily have the "latest" tag
73- kindImageArgument = `--image="kindest/node:${ kindImageTag } "` ;
74- }
75- await exec ( `./kind create cluster --name="${ clusterName } " ${ kindImageArgument } ` ) ;
76- console . log ( `Created cluster ${ clusterName } !` ) ;
77- }
0 commit comments