feat(base-images): add managed base image bundles with cache retention, hosted manifests, and opt-in integration boot testing
This commit is contained in:
+38
-1
@@ -12,7 +12,44 @@ export class VMConfig {
|
||||
public config: IMicroVMConfig;
|
||||
|
||||
constructor(config: IMicroVMConfig) {
|
||||
this.config = config;
|
||||
this.config = this.cloneConfig(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep internal normalization from mutating the caller's config object.
|
||||
*/
|
||||
private cloneConfig(config: IMicroVMConfig): IMicroVMConfig {
|
||||
return {
|
||||
...config,
|
||||
bootSource: config.bootSource ? { ...config.bootSource } : config.bootSource,
|
||||
machineConfig: config.machineConfig ? { ...config.machineConfig } : config.machineConfig,
|
||||
drives: config.drives?.map((drive) => ({
|
||||
...drive,
|
||||
rateLimiter: drive.rateLimiter ? this.cloneRateLimiter(drive.rateLimiter) : undefined,
|
||||
})),
|
||||
networkInterfaces: config.networkInterfaces?.map((iface) => ({
|
||||
...iface,
|
||||
rxRateLimiter: iface.rxRateLimiter ? this.cloneRateLimiter(iface.rxRateLimiter) : undefined,
|
||||
txRateLimiter: iface.txRateLimiter ? this.cloneRateLimiter(iface.txRateLimiter) : undefined,
|
||||
})),
|
||||
vsock: config.vsock ? { ...config.vsock } : undefined,
|
||||
balloon: config.balloon ? { ...config.balloon } : undefined,
|
||||
mmds: config.mmds ? {
|
||||
...config.mmds,
|
||||
networkInterfaces: config.mmds.networkInterfaces
|
||||
? [...config.mmds.networkInterfaces]
|
||||
: config.mmds.networkInterfaces,
|
||||
} : undefined,
|
||||
logger: config.logger ? { ...config.logger } : undefined,
|
||||
metrics: config.metrics ? { ...config.metrics } : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
private cloneRateLimiter(rateLimiter: IRateLimiter): IRateLimiter {
|
||||
return {
|
||||
bandwidth: rateLimiter.bandwidth ? { ...rateLimiter.bandwidth } : undefined,
|
||||
ops: rateLimiter.ops ? { ...rateLimiter.ops } : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user