interface K8 {
    copyFrom(
        podName: `network-node${number}-0`,
        containerName: string,
        srcPath: string,
        destDir: string,
    ): Promise<unknown>;
    copyTo(
        podName: `network-node${number}-0`,
        containerName: string,
        srcPath: string,
        destDir: string,
        filter?: TarCreateFilter,
    ): Promise<boolean>;
    createNamespace(name: string): Promise<boolean>;
    createNamespacedConfigMap(
        name: string,
        labels: Record<string, string>,
        data: Record<string, string>,
    ): Promise<boolean>;
    createNamespacedLease(
        namespace: string,
        leaseName: string,
        holderName: string,
        durationSeconds: any,
    ): Promise<V1Lease>;
    createSecret(
        name: string,
        namespace: string,
        secretType: string,
        data: Record<string, string>,
        labels: Record<string, string>,
        recreate: boolean,
    ): Promise<boolean>;
    deleteNamespace(name: string): Promise<boolean>;
    deleteNamespacedConfigMap(
        name: string,
        namespace: string,
    ): Promise<boolean>;
    deleteNamespacedLease(name: string, namespace: string): Promise<V1Status>;
    deletePvc(name: string, namespace: string): Promise<boolean>;
    deleteSecret(name: string, namespace: string): Promise<boolean>;
    execContainer(
        podName: string,
        containerName: string,
        command: string | string[],
    ): Promise<string>;
    getClusters(): string[];
    getContextNames(): string[];
    getCurrentClusterName(): string;
    getCurrentContext(): string;
    getCurrentContextNamespace(): string;
    getNamespacedConfigMap(name: string): Promise<V1ConfigMap>;
    getNamespaces(): Promise<string[]>;
    getNodeLogs(namespace: string): Promise<unknown[]>;
    getNodeStatesFromPod(
        namespace: string,
        nodeAlias: string,
    ): Promise<unknown[]>;
    getPodByName(name: string): Promise<V1Pod>;
    getPodsByLabel(labels: string[]): Promise<any>;
    getSecret(
        namespace: string,
        labelSelector: string,
    ): Promise<
        {
            data: Record<string, string>;
            labels: Record<string, string>;
            name: string;
            namespace: string;
            type: string;
        },
    >;
    getSecretsByLabel(labels: string[]): Promise<any>;
    getSvcByName(name: string): Promise<V1Service>;
    hasDir(
        podName: string,
        containerName: string,
        destPath: string,
    ): Promise<boolean>;
    hasFile(
        podName: `network-node${number}-0`,
        containerName: string,
        destPath: string,
        filters?: object,
    ): Promise<boolean>;
    hasNamespace(namespace: string): Promise<any>;
    isCertManagerInstalled(): Promise<boolean>;
    isIngressControllerInstalled(): Promise<boolean>;
    isMinioInstalled(namespace: string): Promise<boolean>;
    isPrometheusInstalled(namespace: string): Promise<boolean>;
    isRemoteConfigPresentInAnyNamespace(): Promise<boolean>;
    killPod(podName: string, namespace: string): Promise<void>;
    listDir(
        podName: `network-node${number}-0`,
        containerName: string,
        destPath: string,
    ): Promise<any[] | TDirectoryData[]>;
    listPvcsByNamespace(
        namespace: string,
        labels?: string[],
    ): Promise<string[]>;
    listSecretsByNamespace(
        namespace: string,
        labels?: string[],
    ): Promise<string[]>;
    listSvcs(namespace: string, labels: string[]): Promise<V1Service[]>;
    mkdir(
        podName: `network-node${number}-0`,
        containerName: string,
        destPath: string,
    ): Promise<string>;
    namespaces(): Namespaces;
    portForward(
        podName: `network-node${number}-0`,
        localPort: number,
        podPort: number,
    ): Promise<ExtendedNetServer>;
    readNamespacedLease(
        leaseName: string,
        namespace: string,
        timesCalled?: any,
    ): Promise<any>;
    renewNamespaceLease(
        leaseName: string,
        namespace: string,
        lease: V1Lease,
    ): Promise<V1Lease>;
    replaceNamespacedConfigMap(
        name: string,
        labels: Record<string, string>,
        data: Record<string, string>,
    ): Promise<boolean>;
    setCurrentContext(context: string): void;
    stopPortForward(
        server: ExtendedNetServer,
        maxAttempts?: any,
        timeout?: any,
    ): Promise<void>;
    testContextConnection(context: string): Promise<boolean>;
    transferNamespaceLease(
        lease: V1Lease,
        newHolderName: string,
    ): Promise<V1Lease>;
    waitForPodReady(
        labels?: string[],
        podCount?: any,
        maxAttempts?: any,
        delay?: any,
        namespace?: string,
    ): Promise<V1Pod[]>;
    waitForPods(
        phases?: any,
        labels?: string[],
        podCount?: any,
        maxAttempts?: any,
        delay?: any,
        podItemPredicate?: (items: V1Pod) => boolean,
        namespace?: string,
    ): Promise<V1Pod[]>;
}

Implemented by

Methods

  • Copy a file from a container

    It overwrites any existing file at the destination directory

    Parameters

    • podName: `network-node${number}-0`
    • containerName: string
    • srcPath: string

      source file path in the container

    • destDir: string

      destination directory in the local

    Returns Promise<unknown>

  • Copy a file into a container

    It overwrites any existing file inside the container at the destination directory

    Parameters

    • podName: `network-node${number}-0`
    • containerName: string
    • srcPath: string

      source file path in the local

    • destDir: string

      destination directory in the container

    • Optionalfilter: TarCreateFilter

      the filter to pass to tar to keep or skip files or directories

    Returns Promise<boolean>

    a Promise that performs the copy operation

  • Parameters

    • name: string

      for the config name

    • labels: Record<string, string>

      for the config metadata

    • data: Record<string, string>

      to contain in the config

    Returns Promise<boolean>

  • Parameters

    • namespace: string
    • leaseName: string
    • holderName: string
    • durationSeconds: any

    Returns Promise<V1Lease>

  • creates a new Kubernetes secret with the provided attributes

    Parameters

    • name: string

      the name of the new secret

    • namespace: string

      the namespace to store the secret

    • secretType: string

      the secret type

    • data: Record<string, string>

      the secret, any values of a key:value pair must be base64 encoded

    • labels: Record<string, string>

      the label to use for future label selector queries

    • recreate: boolean

      if we should first run delete in the case that there the secret exists from a previous install

    Returns Promise<boolean>

    whether the secret was created successfully

  • Delete a namespace

    Parameters

    • name: string

      name of the namespace

    Returns Promise<boolean>

  • Parameters

    • name: string
    • namespace: string

    Returns Promise<boolean>

  • Parameters

    • name: string
    • namespace: string

    Returns Promise<V1Status>

  • Delete a persistent volume claim

    Parameters

    • name: string

      the name of the persistent volume claim to delete

    • namespace: string

      the namespace of the persistent volume claim to delete

    Returns Promise<boolean>

    true if the persistent volume claim was deleted

  • Delete a secret from the namespace

    Parameters

    • name: string

      the name of the existing secret

    • namespace: string

      the namespace to store the secret

    Returns Promise<boolean>

    whether the secret was deleted successfully

  • Invoke sh command within a container and return the console output as string

    Parameters

    • podName: string
    • containerName: string
    • command: string | string[]

      sh commands as an array to be run within the containerName (e.g 'ls -la /opt/hgcapp')

    Returns Promise<string>

    console output as string

  • Parameters

    • name: string

      name of the configmap

    Returns Promise<V1ConfigMap>

    the configmap if found

    SoloError - if the response if not found or the response is not OK

  • Download logs files from all network pods and save to local solo log directory

    Parameters

    • namespace: string

      the namespace of the network

    Returns Promise<unknown[]>

    a promise that resolves when the logs are downloaded

  • Download state files from a pod

    Parameters

    • namespace: string

      the namespace of the network

    • nodeAlias: string

      the pod name

    Returns Promise<unknown[]>

    a promise that resolves when the state files are downloaded

  • Get a podName by name

    Parameters

    • name: string

      podName name

    Returns Promise<V1Pod>

  • Get pods by labels

    Parameters

    • labels: string[]

      list of labels

    Returns Promise<any>

  • retrieve the secret of the given namespace and label selector, if there is more than one, it returns the first

    Parameters

    • namespace: string

      the namespace of the secret to search for

    • labelSelector: string

      the label selector used to fetch the Kubernetes secret

    Returns Promise<
        {
            data: Record<string, string>;
            labels: Record<string, string>;
            name: string;
            namespace: string;
            type: string;
        },
    >

    a custom secret object with the relevant attributes, the values of the data key:value pair objects must be base64 decoded

  • Get secrets by labels

    Parameters

    • labels: string[]

      list of labels

    Returns Promise<any>

  • Get a svc by name

    Parameters

    • name: string

      svc name

    Returns Promise<V1Service>

  • Check if a directory path exists in the container

    Parameters

    • podName: string
    • containerName: string
    • destPath: string

      path inside the container

    Returns Promise<boolean>

  • Check if a filepath exists in the container

    Parameters

    • podName: `network-node${number}-0`
    • containerName: string
    • destPath: string

      path inside the container

    • Optionalfilters: object

      an object with metadata fields and value

    Returns Promise<boolean>

  • Returns true if a namespace exists with the given name

    Parameters

    • namespace: string

      namespace name

    Returns Promise<any>

  • Check if cert-manager is installed inside any namespace.

    Returns Promise<boolean>

    if cert-manager is found

  • Check if the ingress controller is installed inside any namespace.

    Returns Promise<boolean>

    if ingress controller is found

  • Check if minio is installed inside the namespace.

    Parameters

    • namespace: string

    Returns Promise<boolean>

    if minio is found

  • Get a pod by name and namespace, will check every 1 second until the pod is no longer found. Can throw a SoloError if there is an error while deleting the pod.

    Parameters

    • podName: string

      the name of the pod

    • namespace: string

      the namespace of the pod

    Returns Promise<void>

  • List files and directories in a container

    It runs ls -la on the specified path and returns a list of object containing the entries. For example: [{ directory: false, owner: hedera, group: hedera, size: 121, modifiedAt: Jan 15 13:50 name: config.txt }]

    Parameters

    • podName: `network-node${number}-0`
    • containerName: string
    • destPath: string

      path inside the container

    Returns Promise<any[] | TDirectoryData[]>

    a promise that returns array of directory entries, custom object

  • Get a list of persistent volume claim names for the given namespace

    Parameters

    • namespace: string

      the namespace of the persistent volume claims to return

    • Optionallabels: string[]

      labels

    Returns Promise<string[]>

    list of persistent volume claim names

  • Get a list of secrets for the given namespace

    Parameters

    • namespace: string

      the namespace of the secrets to return

    • Optionallabels: string[]

      labels

    Returns Promise<string[]>

    list of secret names

  • Parameters

    • namespace: string
    • labels: string[]

    Returns Promise<V1Service[]>

  • Parameters

    • podName: `network-node${number}-0`
    • containerName: string
    • destPath: string

    Returns Promise<string>

  • Port forward a port from a pod to localhost

    This simple server just forwards traffic from itself to a service running in kubernetes -> localhost:localPort -> port-forward-tunnel -> kubernetes-pod:targetPort

    Parameters

    • podName: `network-node${number}-0`
    • localPort: number
    • podPort: number

    Returns Promise<ExtendedNetServer>

  • Parameters

    • leaseName: string
    • namespace: string
    • OptionaltimesCalled: any

    Returns Promise<any>

  • Parameters

    • leaseName: string
    • namespace: string
    • lease: V1Lease

    Returns Promise<V1Lease>

  • Parameters

    • name: string

      for the config name

    • labels: Record<string, string>

      for the config metadata

    • data: Record<string, string>

      to contain in the config

    Returns Promise<boolean>

  • Stop the port forwarder server

    Parameters

    • server: ExtendedNetServer

      an instance of server returned by portForward method

    • OptionalmaxAttempts: any

      the maximum number of attempts to check if the server is stopped

    • Optionaltimeout: any

      the delay between checks in milliseconds

    Returns Promise<void>

  • Parameters

    • lease: V1Lease
    • newHolderName: string

    Returns Promise<V1Lease>

  • Check if pod is ready

    Parameters

    • Optionallabels: string[]

      pod labels

    • OptionalpodCount: any

      number of pod expected

    • OptionalmaxAttempts: any

      maximum attempts to check

    • Optionaldelay: any

      delay between checks in milliseconds

    • Optionalnamespace: string

      namespace

    Returns Promise<V1Pod[]>

  • Parameters

    • Optionalphases: any
    • Optionallabels: string[]
    • OptionalpodCount: any
    • OptionalmaxAttempts: any
    • Optionaldelay: any
    • OptionalpodItemPredicate: (items: V1Pod) => boolean
    • Optionalnamespace: string

    Returns Promise<V1Pod[]>