UNPKG

@hashgraph/solo

Version:

An opinionated CLI tool to deploy and manage private Hedera Networks.

243 lines (242 loc) 15.3 kB
import { type AccountManager } from '../../core/account-manager.js'; import { type ConfigManager } from '../../core/config-manager.js'; import { type OneShotState } from '../../core/one-shot-state.js'; import { type KeyManager } from '../../core/key-manager.js'; import { type ProfileManager } from '../../core/profile-manager.js'; import { type PlatformInstaller } from '../../core/platform-installer.js'; import { type K8Factory } from '../../integration/kube/k8-factory.js'; import { type ChartManager } from '../../core/chart-manager.js'; import { type CertificateManager } from '../../core/certificate-manager.js'; import { Zippy } from '../../core/zippy.js'; import { type SoloLogger } from '../../core/logging/solo-logger.js'; import { type AnyListrContext, type AnyObject, type ArgvStruct, type ConfigBuilder, type NodeAlias, type NodeAliases, type SkipCheck } from '../../types/aliases.js'; import { NodeStatusCodes, NodeSubcommandType } from '../../core/enumerations.js'; import { type Lock } from '../../core/lock/lock.js'; import { NamespaceName } from '../../types/namespace/namespace-name.js'; import { PodReference } from '../../integration/kube/resources/pod/pod-reference.js'; import { type DeploymentName, type SoloListrTask, type SoloListrTaskWrapper } from '../../types/index.js'; import { type GitClient } from '../../integration/git/git-client.js'; import { type NodeAddContext } from './config-interfaces/node-add-context.js'; import { type NodeDestroyContext } from './config-interfaces/node-destroy-context.js'; import { type NodeUpdateContext } from './config-interfaces/node-update-context.js'; import { type NodeStatesContext } from './config-interfaces/node-states-context.js'; import { type NodeUpgradeContext } from './config-interfaces/node-upgrade-context.js'; import { type NodeRefreshContext } from './config-interfaces/node-refresh-context.js'; import { type NodeStopContext } from './config-interfaces/node-stop-context.js'; import { type NodeFreezeContext } from './config-interfaces/node-freeze-context.js'; import { type NodeStartContext } from './config-interfaces/node-start-context.js'; import { type NodeRestartContext } from './config-interfaces/node-restart-context.js'; import { type NodeSetupContext } from './config-interfaces/node-setup-context.js'; import { type NodeKeysContext } from './config-interfaces/node-keys-context.js'; import { type CheckedNodesContext } from './config-interfaces/node-common-config-class.js'; import { type RemoteConfigRuntimeStateApi } from '../../business/runtime-state/api/remote-config-runtime-state-api.js'; import { type ComponentFactoryApi } from '../../core/config/remote/api/component-factory-api.js'; import { type LocalConfigRuntimeState } from '../../business/runtime-state/config/local/local-config-runtime-state.js'; import { LockManager } from '../../core/lock/lock-manager.js'; import { type NodeConnectionsContext } from './config-interfaces/node-connections-context.js'; import { NodeCollectJfrLogsContext } from './config-interfaces/node-collect-jfr-logs-context.js'; import { PackageDownloader } from '../../core/package-downloader.js'; import { type ConfigProvider } from '../../data/configuration/api/config-provider.js'; import { type SoloEventBus } from '../../core/events/solo-event-bus.js'; export type LeaseWrapper = { lease: Lock; }; export declare class NodeCommandTasks { private readonly logger; private readonly accountManager; private readonly configManager; private readonly k8Factory; private readonly platformInstaller; private readonly keyManager; private readonly profileManager; private readonly chartManager; private readonly certificateManager; private readonly remoteConfig; private readonly localConfig; private readonly componentFactory; private readonly oneShotState; private readonly zippy; private readonly downloader; private readonly gitClient; private readonly eventBus; private readonly soloConfig; constructor(logger: SoloLogger, accountManager: AccountManager, configManager: ConfigManager, k8Factory: K8Factory, platformInstaller: PlatformInstaller, keyManager: KeyManager, profileManager: ProfileManager, chartManager: ChartManager, certificateManager: CertificateManager, remoteConfig: RemoteConfigRuntimeStateApi, localConfig: LocalConfigRuntimeState, componentFactory: ComponentFactoryApi, oneShotState: OneShotState, zippy: Zippy, downloader: PackageDownloader, gitClient: GitClient, configProvider: ConfigProvider, eventBus: SoloEventBus); private getFileUpgradeId; private _prepareUpgradeZip; private _uploadUpgradeZip; private copyLocalBuildPathToNode; private validateNodePvcsForLocalBuildPath; private _uploadPlatformSoftware; private _fetchPlatformSoftware; private _checkNodeActivenessTask; checkNetworkNodeActiveness(namespace: NamespaceName, nodeAlias: NodeAlias, task: SoloListrTaskWrapper<AnyListrContext>, title: string, status?: NodeStatusCodes, maxAttempts?: number, delay?: number, timeout?: number, context?: string): Promise<PodReference>; /** Return task for check if node proxies are ready */ private _checkNodesProxiesTask; /** * When generating multiple all aliases are read from config.nodeAliases, * When generating a single key the alias in config.nodeAlias is used */ private _generateGossipKeys; /** * When generating multiple all aliases are read from config.nodeAliases, * When generating a single key the alias in config.nodeAlias is used */ private _generateGrpcTlsKeys; copyGrpcTlsCertificates(): SoloListrTask<NodeAddContext>; private _addStake; prepareUpgradeZip(): SoloListrTask<AnyListrContext>; loadAdminKey(): SoloListrTask<NodeUpdateContext | NodeUpgradeContext | NodeDestroyContext>; checkExistingNodesStakedAmount(): SoloListrTask<NodeUpdateContext | NodeAddContext | NodeDestroyContext | NodeUpgradeContext>; sendPrepareUpgradeTransaction(): SoloListrTask<NodeUpdateContext | NodeAddContext | NodeDestroyContext | NodeUpgradeContext>; sendFreezeUpgradeTransaction(): SoloListrTask<NodeUpdateContext | NodeAddContext | NodeDestroyContext | NodeUpgradeContext>; sendFreezeTransaction(): SoloListrTask<NodeFreezeContext>; /** Download generated config files and key files from the network node, * This function should only be called when updating or destroying a node * */ downloadNodeGeneratedFilesForDynamicAddressBook(): SoloListrTask<NodeUpdateContext | NodeAddContext | NodeDestroyContext>; downloadNodeUpgradeFiles(): SoloListrTask<NodeUpgradeContext>; private taskCheckNetworkNodePods; /** Check if the network node pod is running */ private checkNetworkNodePod; loadConfiguration(argv: ArgvStruct, leaseWrapper: LeaseWrapper, leaseManager: LockManager, validateRemoteConfig?: boolean): { title: string; task: () => Promise<void>; }; /** * Resolve the active node aliases and their service map for the given namespace/deployment. * Nodes whose accountId equals {@link constants.IGNORED_NODE_ACCOUNT_ID} are excluded. * * Shared by {@link getExistingNodeAliases} (non-task callers) and * {@link identifyExistingNodes} (Listr task) to avoid duplicating the * `getNodeServiceMap` + filter loop in both places. */ private resolveExistingNodes; getExistingNodeAliases(namespace: NamespaceName, deployment: DeploymentName): Promise<NodeAliases>; identifyExistingNodes(): SoloListrTask<CheckedNodesContext>; uploadStateFiles(skip: SkipCheck | boolean, stateFileDirectory?: string): { title: string; task: (context_: any) => Promise<void>; skip: boolean | SkipCheck; }; identifyNetworkPods(maxAttempts?: number): { title: string; task: (context_: any, task: any) => any; }; fetchPlatformSoftware(aliasesField: string): SoloListrTask<NodeUpgradeContext | NodeUpdateContext | NodeAddContext | NodeDestroyContext | NodeRefreshContext | NodeSetupContext>; populateServiceMap(): SoloListrTask<NodeAddContext | NodeDestroyContext>; setupNetworkNodes(nodeAliasesProperty: string, isGenesis: boolean): SoloListrTask<NodeUpdateContext | NodeAddContext | NodeDestroyContext | NodeRefreshContext>; setupNetworkNodeFolders(): SoloListrTask<NodeSetupContext>; showUserMessages(): SoloListrTask<NodeStartContext>; waitForTss(): SoloListrTask<NodeStartContext>; setGrpcWebEndpoint(nodeAliasesProperty: string, subcommandType: NodeSubcommandType): SoloListrTask<NodeStartContext>; private generateNodeOverridesJson; /** * Generate genesis network json file * @param namespace - namespace * @param consensusNodes - consensus nodes * @param keysDirectory - keys directory * @param stagingDirectory - staging directory * @param domainNamesMapping */ private generateGenesisNetworkJson; prepareStagingDirectory(nodeAliasesProperty: string): SoloListrTask<AnyListrContext>; startNodes(nodeAliasesProperty: string): SoloListrTask<AnyListrContext>; /** * Build the command used by `consensus node start` to restart the network-node service. * Delegate lifecycle handling entirely to solo-container so Solo stays orchestration-only. */ private buildStartNetworkNodeCommand; /** * Build the command used by `consensus node stop` to stop the network-node service. * Delegate lifecycle handling entirely to solo-container so Solo stays orchestration-only. */ private buildStopNetworkNodeCommand; enablePortForwarding(enablePortForwardHaProxy?: boolean): SoloListrTask<AnyListrContext>; checkAllNodesAreActive(nodeAliasesProperty: string): SoloListrTask<AnyListrContext>; checkAllNodesAreFrozen(nodeAliasesProperty: string): SoloListrTask<AnyListrContext>; checkNodeProxiesAreActive(): SoloListrTask<NodeStartContext | NodeRefreshContext | NodeRestartContext>; /** * Returns a task that checks node activeness and proxy readiness in parallel, reducing total * start time by running both independent checks concurrently instead of sequentially. */ checkNodesAndProxiesAreActive(nodeAliasesProperty: string): SoloListrTask<NodeStartContext | NodeRefreshContext | NodeRestartContext>; checkAllNodeProxiesAreActive(): SoloListrTask<NodeUpdateContext | NodeAddContext | NodeDestroyContext | NodeUpgradeContext>; triggerStakeWeightCalculate<T extends { config: AnyObject; }>(transactionType: NodeSubcommandType): SoloListrTask<T>; addNodeStakes(): SoloListrTask<NodeStartContext>; stakeNewNode(): SoloListrTask<NodeAddContext>; emitNodeStartedEvent(): SoloListrTask<NodeAddContext>; stopNodes(nodeAliasesProperty: string): SoloListrTask<NodeStopContext | NodeFreezeContext | NodeDestroyContext>; finalize(): SoloListrTask<AnyListrContext>; dumpNetworkNodesSaveState(): SoloListrTask<NodeRefreshContext>; getNodeLogsAndConfigs(excludeSensitiveData?: boolean, outputDirectory?: string): SoloListrTask<NodeUpdateContext | NodeAddContext | NodeDestroyContext | NodeUpgradeContext>; private isDefaultFlagValue; upgradeNodeConfigurationFilesWithChart(): SoloListrTask<NodeUpgradeContext>; getHelmChartValues(outputDirectory?: string): SoloListrTask<AnyListrContext>; private checkLocalPort; private getComponentData; private extractDataFromGroup; private validateComponentData; testAccountCreation(): SoloListrTask<NodeConnectionsContext>; prepareDiagnosticsData(): SoloListrTask<NodeConnectionsContext>; validateLocalPorts(): SoloListrTask<AnyListrContext>; testRelay(): SoloListrTask<NodeConnectionsContext>; fetchAccountFromExplorer(): SoloListrTask<NodeConnectionsContext>; getNodeStateFiles(): SoloListrTask<NodeStatesContext>; checkPVCsEnabled(): SoloListrTask<AnyListrContext>; determineNewNodeAccountNumber(): SoloListrTask<NodeAddContext>; generateGossipKeys(): SoloListrTask<NodeKeysContext>; generateGossipKey(): SoloListrTask<NodeAddContext>; generateGrpcTlsKeys(): SoloListrTask<NodeKeysContext>; generateGrpcTlsKey(): SoloListrTask<NodeAddContext>; loadSigningKeyCertificate(): SoloListrTask<NodeAddContext>; computeMTLSCertificateHash(): SoloListrTask<NodeAddContext>; prepareGossipEndpoints(): SoloListrTask<NodeAddContext>; private parseGossipFqdnRestricted; private getGossipFqdnRestricted; refreshNodeList(): SoloListrTask<NodeDestroyContext>; prepareGrpcServiceEndpoints(): SoloListrTask<NodeAddContext>; sendNodeUpdateTransaction(): SoloListrTask<NodeUpdateContext>; copyNodeKeysToSecrets(nodeListOverride?: string): SoloListrTask<NodeUpdateContext | NodeAddContext | NodeDestroyContext>; addWrapsLib(): SoloListrTask<NodeAddContext>; updateChartWithConfigMap(title: string, transactionType: NodeSubcommandType, skip?: SkipCheck | boolean): SoloListrTask<NodeDestroyContext | NodeAddContext | NodeUpdateContext>; /** * Builds the values args for update: * - Updates the selected node * - Keep the rest the same */ private prepareValuesArgForNodeUpdate; /** * Builds the values args for add: * - Adds the new node * - Keeps the rest the same */ private prepareValuesArgForNodeAdd; /** * Builds the values args for delete: * - Remove the specified node * - Keeps the rest the same */ private prepareValuesArgForNodeDestroy; saveContextData(argv: ArgvStruct, targetFile: string, parser: (context_: AnyListrContext) => AnyObject): SoloListrTask<NodeUpdateContext | NodeAddContext | NodeDestroyContext>; loadContextData(argv: ArgvStruct, targetFile: string, parser: (context_: AnyListrContext, contextData: AnyObject) => void): SoloListrTask<AnyListrContext>; killNodes(transactionType?: NodeSubcommandType): SoloListrTask<NodeDestroyContext | NodeAddContext>; killNodesAndUpdateConfigMap(): SoloListrTask<NodeUpdateContext>; checkNodePodsAreRunning(): SoloListrTask<NodeUpdateContext | NodeAddContext | NodeDestroyContext>; sleep(title: string, milliseconds: number): SoloListrTask<AnyListrContext>; downloadLastState(): SoloListrTask<NodeAddContext>; uploadStateToNewNode(): SoloListrTask<NodeAddContext>; sendNodeDeleteTransaction(): SoloListrTask<NodeDestroyContext>; sendNodeCreateTransaction(): SoloListrTask<NodeAddContext>; initialize(argv: ArgvStruct, configInit: ConfigBuilder, lease?: Lock, shouldLoadNodeClient?: boolean, validateRemoteConfig?: boolean): SoloListrTask<AnyListrContext>; addNewConsensusNodeToRemoteConfig(): SoloListrTask<NodeAddContext>; updateBlockNodesJson(): SoloListrTask<NodeAddContext>; downloadHieroComponentLogs(customOutputDirectory?: string): SoloListrTask<AnyListrContext>; analyzeCollectedDiagnostics(customOutputDirectory?: string, namespaceName?: string): SoloListrTask<AnyListrContext>; reportActivePortForwards(): SoloListrTask<AnyListrContext>; private findActivePortForwardProcesses; private downloadPodLogs; private downloadBlockNodeLogFiles; downloadJavaFlightRecorderLogs(): SoloListrTask<NodeCollectJfrLogsContext>; }