@@ -80,13 +80,13 @@ export async function updateKubeconfig(
80
80
ok ( "Kubeconfig has been updated. The current context should now be" , cyan ( name ) ) ;
81
81
}
82
82
83
- export async function createInstance ( instance : InstanceConfig ) {
83
+ export async function createInstance ( instance : InstanceConfig , signal : AbortSignal ) {
84
84
const { sshDirectoryPath, cpus, memoryGiBs, diskGiBs, image, name, bridged } = instance ;
85
85
86
86
await generateSshKeyPairIfNotExists ( instance ) ;
87
87
88
88
const sshPublicKey = await getSshPublicKey ( sshDirectoryPath ) ;
89
- const cloudInitConfig = createCloudInitConfig ( { sshPublicKey, instance } ) ;
89
+ const cloudInitConfig = await createCloudInitConfig ( { sshPublicKey, instance } ) ;
90
90
const tempDir = await Deno . makeTempDir ( ) ;
91
91
const cloudInitFilePath = joinPath ( tempDir , "cloud-init.yaml" ) ;
92
92
log ( "Generated cloud-init.yaml" ) ;
@@ -163,20 +163,22 @@ export async function createInstance(instance: InstanceConfig) {
163
163
// Ignore
164
164
}
165
165
166
- const ip = await multipassPostStart ( instance ) ;
166
+ const ip = await multipassPostStart ( instance , signal ) ;
167
167
168
- await updateKubeconfig ( { ip, instance } ) ;
168
+ if ( instance . isBootstrapInstance ) {
169
+ await updateKubeconfig ( { ip, instance } ) ;
170
+ }
169
171
}
170
172
171
173
export default createCliAction (
172
174
Type . Object ( {
173
175
config : InstanceConfigPathSchema ,
174
176
} ) ,
175
- async ( { config : configPath } ) => {
177
+ async ( { config : configPath } , _ , signal ) => {
176
178
const absoluteConfigPath = resolvePath ( configPath ) ;
177
179
const instance = await loadInstanceConfig ( absoluteConfigPath ) ;
178
180
179
- await createInstance ( instance ) ;
181
+ await createInstance ( instance , signal ) ;
180
182
181
183
return ExitCode . Zero ;
182
184
} ,
0 commit comments