@hashgraph/solo
Version:
An opinionated CLI tool to deploy and manage private Hedera Networks.
47 lines (46 loc) • 2.55 kB
TypeScript
import { type Container } from '../../../resources/container/container.js';
import { type TDirectoryData } from '../../../t-directory-data.js';
import { type ContainerReference } from '../../../resources/container/container-reference.js';
import { type KubeConfig } from '@kubernetes/client-node';
import { type Pods } from '../../../resources/pod/pods.js';
import { type TarCreateFilter } from '../../../../../types/aliases.js';
import type * as stream from 'node:stream';
export declare class K8ClientContainer implements Container {
private readonly kubeConfig;
private readonly containerReference;
private readonly pods;
private readonly kubectlInstallationDirectory;
private readonly logger;
constructor(kubeConfig: KubeConfig, containerReference: ContainerReference, pods: Pods, kubectlInstallationDirectory: string);
private getContext;
/**
* Waits until the pod for this container reference is visible in the API before
* `copyTo`, `copyFrom`, or `execContainer`.
*
* Uses {@link Pods.waitForPodByReference} and maps failures to
* {@link IllegalArgumentError} with the pod name.
*
* @param maxAttempts - forwarded to {@link Pods.waitForPodByReference} (default 20)
* @param delayMs - forwarded to {@link Pods.waitForPodByReference} (default 3000 ms)
*/
private waitForPod;
private execKubectl;
/**
* Execute `kubectl cp` with retries and optional verification.
*
* @param source - kubectl cp source, e.g. `<ns>/<pod>:/path` or `/local/path`
* @param destination - kubectl cp destination, e.g. `/local/path` or `<ns>/<pod>:/path`
* @param containerName - name of the container for -c flag
* @param verifyPath - local filesystem path to verify after copy (usually the destination for copyFrom)
* @param expectedSize - optional expected file size for strict verification
*/
private execKubectlCp;
private toKubectlSafePath;
copyFrom(sourcePath: string, destinationDirectory: string): Promise<boolean>;
copyTo(sourcePath: string, destinationDirectory: string, filter?: TarCreateFilter): Promise<boolean>;
execContainer(cmd: string | string[], outputPassThroughStream?: stream.PassThrough, errorPassThroughStream?: stream.PassThrough): Promise<string>;
hasDir(destinationPath: string): Promise<boolean>;
hasFile(destinationPath: string, filters?: object): Promise<boolean>;
listDir(destinationPath: string): Promise<TDirectoryData[]>;
mkdir(destinationPath: string): Promise<string>;
}