UNPKG

@hashgraph/solo

Version:

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

149 lines (148 loc) 8.93 kB
import * as x509 from '@peculiar/x509'; import { type AccountId } from '@hiero-ledger/sdk'; import { type IP, type NodeAlias, type NodeAliases, type NodeId } from '../types/aliases.js'; import { PodName } from '../integration/kube/resources/pod/pod-name.js'; import { GrpcProxyTlsEnums } from './enumerations.js'; import { type NamespaceName } from '../types/namespace/namespace-name.js'; import { type ClusterReferenceName, type ComponentId, type NamespaceNameAsString, type NodeAliasToAddressMapping, type PriorityMapping } from './../types/index.js'; import { type ConsensusNode } from './model/consensus-node.js'; export declare class Templates { static renderNetworkPodName(nodeAlias: NodeAlias): PodName; private static renderNetworkSvcName; static renderNetworkHeadlessSvcName(nodeAlias: NodeAlias): string; static renderNodeAliasFromNumber(number_: number): NodeAlias; static renderPostgresPodName(number_: number): PodName; static renderNodeAliasesFromCount(count: number, existingNodesCount: number): NodeAliases; static renderMirrorNodeDatabaseInitScriptUrl(release: string): string; static renderGossipPemPrivateKeyFile(nodeAlias: NodeAlias): string; static renderGossipPemPublicKeyFile(nodeAlias: NodeAlias): string; static renderTLSPemPrivateKeyFile(nodeAlias: NodeAlias): string; static renderTLSPemPublicKeyFile(nodeAlias: NodeAlias): string; static renderNodeAdminKeyName(nodeAlias: NodeAlias): string; static renderNodeFriendlyName(prefix: string, nodeAlias: NodeAlias, suffix?: string): string; static extractNodeAliasFromPodName(podName: PodName): NodeAlias; static prepareReleasePrefix(tag: string): string; /** * renders the name to be used to store the new account key as a Kubernetes secret * @param accountId * @returns the name of the Kubernetes secret to store the account key */ static renderAccountKeySecretName(accountId: AccountId | string): string; /** * renders the label selector to be used to fetch the new account key from the Kubernetes secret * @param accountId * @returns the label selector of the Kubernetes secret to retrieve the account key */ static renderAccountKeySecretLabelSelector(accountId: AccountId | string): string; /** * renders the label object to be used to store the new account key in the Kubernetes secret * @param accountId * @returns the label object to be used to store the new account key in the Kubernetes secret */ static renderAccountKeySecretLabelObject(accountId: AccountId | string): { 'solo.hedera.com/account-id': string; }; static renderDistinguishedName(nodeAlias: NodeAlias, state?: string, locality?: string, org?: string, orgUnit?: string, country?: string): x509.Name; static renderStagingDir(cacheDirectory: string, releaseTagOverride: string): string; static localInstallationExecutableForDependency(dependency: string, installationDirectory?: string): string; static renderFullyQualifiedNetworkPodName(namespace: NamespaceName, nodeAlias: NodeAlias): string; static renderFullyQualifiedNetworkSvcName(namespace: NamespaceName, nodeAlias: NodeAlias): string; static nodeIdFromNodeAlias(nodeAlias: NodeAlias): NodeId; static renderComponentIdFromNodeId(nodeId: NodeId): ComponentId; static renderComponentIdFromNodeAlias(nodeAlias: NodeAlias): ComponentId; static renderNodeIdFromComponentId(componentId: ComponentId): NodeId; static renderGossipKeySecretName(nodeAlias: NodeAlias): string; static renderGossipKeySecretLabelObject(nodeAlias: NodeAlias): { 'solo.hedera.com/node-name': string; }; /** * Creates the secret name based on the node alias type * * @param nodeAlias - node alias * @param type - whether is for gRPC or gRPC Web ( Haproxy or Envoy ) * * @returns the appropriate secret name */ static renderGrpcTlsCertificatesSecretName(nodeAlias: NodeAlias, type: GrpcProxyTlsEnums): string; /** * Creates the secret labels based on the node alias type * * @param nodeAlias - node alias * @param type - whether is for gRPC or gRPC Web ( Haproxy or Envoy ) * * @returns the appropriate secret labels */ static renderGrpcTlsCertificatesSecretLabelObject(nodeAlias: NodeAlias, type: GrpcProxyTlsEnums): Record<string, string>; static parseNodeAliasToIpMapping(unparsed: string): Record<NodeAlias, IP>; /** * Parses a comma-separated string into a mapping of node aliases → address/port. * * Accepted input formats: * 1) Explicit alias → address[:port] * Each entry provides the node alias and the target address, optionally with a port. * Example: "node1=127.0.0.1:8080,node2=127.0.0.1:8081" * * 2) Explicit alias → address (no port) * Same as above, but if the port is omitted it defaults to 8080. * Example: "node1=localhost,node2=localhost:8081" * * 3) Address[:port] only (no aliases) * Aliases are inferred from the `nodes` array by index order. * If the port is omitted, it defaults to 8080. * Example: "localhost,127.0.0.2:8081" * * @param unparsed - Input string describing alias/address[:port] mappings. * @param nodes - Used to infer aliases when not explicitly provided. * @returns Record keyed by NodeAlias with resolved address and port. * * @throws SoloError if an alias cannot be inferred. */ static parseNodeAliasToAddressAndPortMapping(unparsed: string, nodes: ConsensusNode[]): NodeAliasToAddressMapping; static parseNodeAliasToDomainNameMapping(unparsed: string): Record<NodeAlias, string>; /** * Renders the fully qualified domain name for a consensus node. We support the following variables for templating * in the dnsConsensusNodePattern: {nodeAlias}, {nodeId}, {namespace}, {cluster} * * The end result will be `${dnsConsensusNodePattern}.${dnsBaseDomain}`. * For example, if the dnsConsensusNodePattern is `network-{nodeAlias}-svc.{namespace}.svc` and the dnsBaseDomain is `cluster.local`, * the fully qualified domain name will be `network-{nodeAlias}-svc.{namespace}.svc.cluster.local`. * @param nodeAlias - the alias of the consensus node * @param nodeId - the id of the consensus node * @param namespace - the namespace of the consensus node * @param cluster - the cluster of the consensus node * @param dnsBaseDomain - the base domain of the cluster * @param dnsConsensusNodePattern - the pattern to use for the consensus node */ static renderConsensusNodeFullyQualifiedDomainName(nodeAlias: string, nodeId: number, namespace: NamespaceNameAsString, cluster: ClusterReferenceName, dnsBaseDomain: string, dnsConsensusNodePattern: string): string; /** * @param serviceName - name of the service * @param namespace - the pattern to use for the consensus node * @param dnsBaseDomain - the base domain of the cluster */ static renderSvcFullyQualifiedDomainName(serviceName: string, namespace: NamespaceNameAsString, dnsBaseDomain: string): string; static renderRelayLabels(id: ComponentId, legacyReleaseName?: string): string[]; static renderHaProxyLabels(id: ComponentId): string[]; static renderMirrorNodeLabels(id: ComponentId, legacyReleaseName?: string): string[]; static renderMirrorIngressControllerLabels(): string[]; static renderEnvoyProxyLabels(id: ComponentId): string[]; static renderExplorerLabels(id: ComponentId, legacyReleaseName?: string): string[]; static renderConsensusNodeLabels(id: ComponentId): string[]; static renderBlockNodeLabels(id: ComponentId, legacyReleaseName?: string): string[]; static renderExplorerName(id: ComponentId): string; static renderRelayName(id: ComponentId): string; static renderBlockNodeName(id: ComponentId): string; static renderMirrorNodeName(id: ComponentId): string; static renderConfigMapRemoteConfigLabels(): string[]; static renderNodeLabelsFromNodeAlias(nodeAlias: NodeAlias): string[]; static renderNodeSvcLabelsFromNodeId(nodeId: NodeId): string[]; /** * Build label selectors for deployment refresh by component type. */ static renderComponentLabelSelectors(componentType: string, id: ComponentId): string[]; static parseExternalBlockAddress(raw: string): [string, number]; static parseBlockNodePriorityMapping(rawString: string, nodes: ConsensusNode[]): Record<NodeAlias, number>; /** * @param rawString - the raw string from the unparsed [flags.blockNodeMapping, flags.externalBlockNodeMapping] * @param fallbackBlockNodeIds - either block node IDs or external block node IDs */ static parseConsensusNodePriorityMapping(rawString: string, fallbackBlockNodeIds: ComponentId[]): PriorityMapping[]; }