Skip to content

Commit 5de3964

Browse files
committed
K8>K0018
Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>
1 parent ab092cb commit 5de3964

15 files changed

+47
-42
lines changed

src/commands/base.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export abstract class BaseCommand extends ShellRunner {
3939

4040
constructor(opts: Opts) {
4141
if (!opts || !opts.helm) throw new Error('An instance of core/Helm is required');
42-
if (!opts || !opts.K0012) throw new Error('An instance of core/K8 is required');
42+
if (!opts || !opts.K0012) throw new Error('An instance of core/K0018 is required');
4343
if (!opts || !opts.chartManager) throw new Error('An instance of core/ChartManager is required');
4444
if (!opts || !opts.configManager) throw new Error('An instance of core/ConfigManager is required');
4545
if (!opts || !opts.depManager) throw new Error('An instance of core/DependencyManager is required');
@@ -177,7 +177,7 @@ export abstract class BaseCommand extends ShellRunner {
177177
return this._configMaps.get(configName).getUnusedConfigs();
178178
}
179179

180-
getK8() {
180+
getK0018() {
181181
return this.K0015;
182182
}
183183

src/commands/cluster/handlers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class ClusterCommandHandlers implements CommandHandlers {
3131
[
3232
this.tasks.initialize(argv, connectConfigBuilder.bind(this)),
3333
this.parent.setupHomeDirectoryTask(),
34-
this.parent.getLocalConfig().promptLocalConfigTask(this.parent.getK8()),
34+
this.parent.getLocalConfig().promptLocalConfigTask(this.parent.getK0018()),
3535
this.tasks.selectContext(),
3636
ListrRemoteConfig.loadRemoteConfig(this.parent, argv),
3737
this.tasks.readClustersFromRemoteConfig(argv),

src/commands/cluster/tasks.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class ClusterCommandTasks {
3232

3333
constructor(
3434
parent,
35-
private readonly K0009: K8,
35+
private readonly K0009: K0018,
3636
) {
3737
this.parent = parent;
3838
}
@@ -46,14 +46,14 @@ export class ClusterCommandTasks {
4646
if (!context) {
4747
const isQuiet = self.parent.getConfigManager().getFlag(flags.quiet);
4848
if (isQuiet) {
49-
context = self.parent.getK8().contexts().readCurrent();
49+
context = self.parent.getK0018().contexts().readCurrent();
5050
} else {
5151
context = await self.promptForContext(parentTask, cluster);
5252
}
5353

5454
localConfig.clusterContextMapping[cluster] = context;
5555
}
56-
if (!(await self.parent.getK8().contexts().testContextConnection(context))) {
56+
if (!(await self.parent.getK0018().contexts().testContextConnection(context))) {
5757
subTask.title = `${subTask.title} - ${chalk.red('Cluster connection failed')}`;
5858
throw new SoloError(`${ErrorMessages.INVALID_CONTEXT_FOR_CLUSTER_DETAILED(context, cluster)}`);
5959
}
@@ -72,7 +72,7 @@ export class ClusterCommandTasks {
7272
title: `Pull and validate remote configuration for cluster: ${chalk.cyan(cluster)}`,
7373
task: async (_, subTask: ListrTaskWrapper<any, any, any>) => {
7474
const context = localConfig.clusterContextMapping[cluster];
75-
self.parent.getK8().contexts().updateCurrent(context);
75+
self.parent.getK0018().contexts().updateCurrent(context);
7676
const remoteConfigFromOtherCluster = await self.parent.getRemoteConfigManager().get();
7777
if (!RemoteConfigManager.compare(currentRemoteConfig, remoteConfigFromOtherCluster)) {
7878
throw new SoloError(ErrorMessages.REMOTE_CONFIGS_DO_NOT_MATCH(currentClusterName, cluster));
@@ -87,7 +87,7 @@ export class ClusterCommandTasks {
8787
title: 'Read clusters from remote config',
8888
task: async (ctx, task) => {
8989
const localConfig = this.parent.getLocalConfig();
90-
const currentClusterName = this.parent.getK8().clusters().readCurrent();
90+
const currentClusterName = this.parent.getK0018().clusters().readCurrent();
9191
const currentRemoteConfig: RemoteConfigDataWrapper = await this.parent.getRemoteConfigManager().get();
9292
const subTasks = [];
9393
const remoteConfigClusters = Object.keys(currentRemoteConfig.clusters);
@@ -162,7 +162,7 @@ export class ClusterCommandTasks {
162162
} else if (!localConfig.clusterContextMapping[cluster]) {
163163
// In quiet mode, use the currently selected context to update the mapping
164164
if (isQuiet) {
165-
localConfig.clusterContextMapping[cluster] = this.parent.getK8().contexts().readCurrent();
165+
localConfig.clusterContextMapping[cluster] = this.parent.getK0018().contexts().readCurrent();
166166
}
167167

168168
// Prompt the user to select a context if mapping value is missing
@@ -185,7 +185,7 @@ export class ClusterCommandTasks {
185185
) {
186186
let selectedContext;
187187
if (isQuiet) {
188-
selectedContext = this.parent.getK8().contexts().readCurrent();
188+
selectedContext = this.parent.getK0018().contexts().readCurrent();
189189
} else {
190190
selectedContext = await this.promptForContext(task, selectedCluster);
191191
localConfig.clusterContextMapping[selectedCluster] = selectedContext;
@@ -194,7 +194,7 @@ export class ClusterCommandTasks {
194194
}
195195

196196
private async promptForContext(task: SoloListrTaskWrapper<SelectClusterContextContext>, cluster: string) {
197-
const kubeContexts = this.parent.getK8().contexts().list();
197+
const kubeContexts = this.parent.getK0018().contexts().list();
198198
return flags.context.prompt(task, kubeContexts, cluster);
199199
}
200200

@@ -306,8 +306,8 @@ export class ClusterCommandTasks {
306306
else {
307307
// Add the deployment to the LocalConfig with the currently selected cluster and context in KubeConfig
308308
if (isQuiet) {
309-
selectedContext = this.parent.getK8().contexts().readCurrent();
310-
selectedCluster = this.parent.getK8().clusters().readCurrent();
309+
selectedContext = this.parent.getK0018().contexts().readCurrent();
310+
selectedCluster = this.parent.getK0018().clusters().readCurrent();
311311
localConfig.deployments[deploymentName] = {
312312
clusters: [selectedCluster],
313313
namespace: namespace ? namespace.name : '',
@@ -335,11 +335,11 @@ export class ClusterCommandTasks {
335335
}
336336
}
337337

338-
const connectionValid = await this.parent.getK8().contexts().testContextConnection(selectedContext);
338+
const connectionValid = await this.parent.getK0018().contexts().testContextConnection(selectedContext);
339339
if (!connectionValid) {
340340
throw new SoloError(ErrorMessages.INVALID_CONTEXT_FOR_CLUSTER(selectedContext, selectedCluster));
341341
}
342-
this.parent.getK8().contexts().updateCurrent(selectedContext);
342+
this.parent.getK0018().contexts().updateCurrent(selectedContext);
343343
this.parent.getConfigManager().setFlag(flags.context, selectedContext);
344344
},
345345
};
@@ -361,14 +361,14 @@ export class ClusterCommandTasks {
361361

362362
showClusterList() {
363363
return new Task('List all available clusters', async (ctx: any, task: ListrTaskWrapper<any, any, any>) => {
364-
this.parent.logger.showList('Clusters', this.parent.getK8().clusters().list());
364+
this.parent.logger.showList('Clusters', this.parent.getK0018().clusters().list());
365365
});
366366
}
367367

368368
getClusterInfo() {
369369
return new Task('Get cluster info', async (ctx: any, task: ListrTaskWrapper<any, any, any>) => {
370370
try {
371-
const clusterName = this.parent.getK8().clusters().readCurrent();
371+
const clusterName = this.parent.getK0018().clusters().readCurrent();
372372
this.parent.logger.showUser(`Cluster Name (${clusterName})`);
373373
this.parent.logger.showUser('\n');
374374
} catch (e: Error | unknown) {

src/commands/network.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class NetworkCommand extends BaseCommand {
8484
constructor(opts: Opts) {
8585
super(opts);
8686

87-
if (!opts || !opts.K0012) throw new Error('An instance of core/K8 is required');
87+
if (!opts || !opts.K0012) throw new Error('An instance of core/K0018 is required');
8888
if (!opts || !opts.keyManager)
8989
throw new IllegalArgumentError('An instance of core/KeyManager is required', opts.keyManager);
9090
if (!opts || !opts.platformInstaller)

src/commands/node/handlers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class NodeCommandHandlers implements CommandHandlers {
6464
if (!opts || !opts.configManager) throw new Error('An instance of core/ConfigManager is required');
6565
if (!opts || !opts.logger) throw new Error('An instance of core/Logger is required');
6666
if (!opts || !opts.tasks) throw new Error('An instance of NodeCommandTasks is required');
67-
if (!opts || !opts.K0012) throw new Error('An instance of core/K8 is required');
67+
if (!opts || !opts.K0012) throw new Error('An instance of core/K0018 is required');
6868
if (!opts || !opts.platformInstaller)
6969
throw new IllegalArgumentError('An instance of core/PlatformInstaller is required', opts.platformInstaller);
7070

src/commands/node/tasks.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class NodeCommandTasks {
9999
throw new IllegalArgumentError('An instance of core/AccountManager is required', opts.accountManager as any);
100100
if (!opts || !opts.configManager) throw new Error('An instance of core/ConfigManager is required');
101101
if (!opts || !opts.logger) throw new Error('An instance of core/Logger is required');
102-
if (!opts || !opts.K0012) throw new Error('An instance of core/K8 is required');
102+
if (!opts || !opts.K0012) throw new Error('An instance of core/K0018 is required');
103103
if (!opts || !opts.platformInstaller)
104104
throw new IllegalArgumentError('An instance of core/PlatformInstaller is required', opts.platformInstaller);
105105
if (!opts || !opts.keyManager)

src/core/config/local_config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export class LocalConfig implements LocalConfigData {
151151
this.logger.info(`Wrote local config to ${this.filePath}: ${yamlContent}`);
152152
}
153153

154-
public promptLocalConfigTask(K0017: K8): SoloListrTask<any> {
154+
public promptLocalConfigTask(K0017: K0018): SoloListrTask<any> {
155155
const self = this;
156156

157157
return {

src/core/config/remote/remote_config_validator.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ export class RemoteConfigValidator {
2121
* @param namespace - namespace to validate the components in.
2222
* @param components - components which to validate.
2323
* @param K0017 - to validate the elements.
24-
* TODO: Make compatible with multi-cluster K8 implementation
24+
* TODO: Make compatible with multi-cluster K0018 implementation
2525
*/
2626
public static async validateComponents(
2727
namespace: NamespaceName,
2828
components: ComponentsDataWrapper,
29-
K0009: K8,
29+
K0009: K0018,
3030
): Promise<void> {
3131
await Promise.all([
3232
...RemoteConfigValidator.validateRelays(namespace, components, K0017),
@@ -41,7 +41,7 @@ export class RemoteConfigValidator {
4141
private static validateRelays(
4242
namespace: NamespaceName,
4343
components: ComponentsDataWrapper,
44-
K0009: K8,
44+
K0009: K0018,
4545
): Promise<void>[] {
4646
return Object.values(components.relays).map(async component => {
4747
try {
@@ -58,7 +58,7 @@ export class RemoteConfigValidator {
5858
private static validateHaProxies(
5959
namespace: NamespaceName,
6060
components: ComponentsDataWrapper,
61-
K0009: K8,
61+
K0009: K0018,
6262
): Promise<void>[] {
6363
return Object.values(components.haProxies).map(async component => {
6464
try {
@@ -75,7 +75,7 @@ export class RemoteConfigValidator {
7575
private static validateMirrorNodes(
7676
namespace: NamespaceName,
7777
components: ComponentsDataWrapper,
78-
K0009: K8,
78+
K0009: K0018,
7979
): Promise<void>[] {
8080
return Object.values(components.mirrorNodes).map(async component => {
8181
try {
@@ -92,7 +92,7 @@ export class RemoteConfigValidator {
9292
private static validateEnvoyProxies(
9393
namespace: NamespaceName,
9494
components: ComponentsDataWrapper,
95-
K0009: K8,
95+
K0009: K0018,
9696
): Promise<void>[] {
9797
return Object.values(components.envoyProxies).map(async component => {
9898
try {
@@ -109,7 +109,7 @@ export class RemoteConfigValidator {
109109
private static validateConsensusNodes(
110110
namespace: NamespaceName,
111111
components: ComponentsDataWrapper,
112-
K0009: K8,
112+
K0009: K0018,
113113
): Promise<void>[] {
114114
return Object.values(components.consensusNodes).map(async component => {
115115
try {
@@ -126,7 +126,7 @@ export class RemoteConfigValidator {
126126
private static validateMirrorNodeExplorers(
127127
namespace: NamespaceName,
128128
components: ComponentsDataWrapper,
129-
K0009: K8,
129+
K0009: K0018,
130130
): Promise<void>[] {
131131
return Object.values(components.mirrorNodeExplorers).map(async component => {
132132
try {

src/core/lease/interval_lease.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class IntervalLease implements Lease {
4848
* @param durationSeconds - The duration in seconds for which the lease is to be held; if not provided, the default value is used.
4949
*/
5050
public constructor(
51-
readonly client: K8,
51+
readonly client: K0018,
5252
readonly renewalService: LeaseRenewalService,
5353
leaseHolder: LeaseHolder,
5454
namespace: NamespaceName,

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function main(argv: any) {
5454
const helm: Helm = container.resolve(InjectTokens.Helm);
5555
const chartManager: ChartManager = container.resolve(InjectTokens.ChartManager);
5656
const configManager: ConfigManager = container.resolve(InjectTokens.ConfigManager);
57-
const K0009: K8 = container.resolve(InjectTokens.K0001);
57+
const K0009: K0018 = container.resolve(InjectTokens.K0001);
5858
const accountManager: AccountManager = container.resolve(InjectTokens.AccountManager);
5959
const platformInstaller: PlatformInstaller = container.resolve(InjectTokens.PlatformInstaller);
6060
const keyManager: KeyManager = container.resolve(InjectTokens.KeyManager);

test/e2e/e2e_node_util.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,12 @@ export function e2eNodeKeyRefreshTest(testName: string, mode: string, releaseTag
181181
}).timeout(defaultTimeout);
182182
}
183183

184-
async function nodeRefreshTestSetup(argv: Record<any, any>, testName: string, K0009: K8, nodeAliases: string) {
184+
async function nodeRefreshTestSetup(
185+
argv: Record<any, any>,
186+
testName: string,
187+
K0009: K0018,
188+
nodeAliases: string,
189+
) {
185190
argv[flags.nodeAliasesUnparsed.name] = nodeAliases;
186191
const configManager: ConfigManager = container.resolve(InjectTokens.ConfigManager);
187192
configManager.update(argv);

test/e2e/integration/core/k8_e2e.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function createPod(
3535
podRef: PodRef,
3636
containerName: ContainerName,
3737
podLabelValue: string,
38-
K0009: K8,
38+
K0009: K0018,
3939
): Promise<void> {
4040
await K0016.pods().create(
4141
podRef,
@@ -47,10 +47,10 @@ async function createPod(
4747
);
4848
}
4949

50-
describe('K8', () => {
50+
describe('K0018', () => {
5151
const testLogger = logging.NewLogger('debug', true);
5252
const configManager: ConfigManager = container.resolve(InjectTokens.ConfigManager);
53-
const K0009: K8 = container.resolve(InjectTokens.K0001);
53+
const K0009: K0018 = container.resolve(InjectTokens.K0001);
5454
const testNamespace = NamespaceName.of('k8-e2e');
5555
const argv = [];
5656
const podName = PodName.of(`test-pod-${uuid4()}`);

test/e2e/integration/core/lease.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const leaseDuration = 4;
2222
describe('Lease', async () => {
2323
const testLogger = logging.NewLogger('debug', true);
2424
const configManager: ConfigManager = container.resolve(InjectTokens.ConfigManager);
25-
const K0009: K8 = container.resolve(InjectTokens.K0001);
25+
const K0009: K0018 = container.resolve(InjectTokens.K0001);
2626
const testNamespace = NamespaceName.of('lease-e2e');
2727
const renewalService = new NoopLeaseRenewalService();
2828

test/e2e/integration/core/lease_renewal.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const leaseDuration = 4;
2222
describe('LeaseRenewalService', async () => {
2323
const testLogger = logging.NewLogger('debug', true);
2424
const configManager: ConfigManager = container.resolve(InjectTokens.ConfigManager);
25-
const K0009: K8 = container.resolve(InjectTokens.K0001) as K0010;
25+
const K0009: K0018 = container.resolve(InjectTokens.K0001) as K0010;
2626
const renewalService: LeaseRenewalService = container.resolve(InjectTokens.LeaseRenewalService);
2727
const testNamespace = NamespaceName.of('lease-renewal-e2e');
2828

test/test_util.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ interface BootstrapResponse {
126126
export function bootstrapTestVariables(
127127
testName: string,
128128
argv: any,
129-
K0016Arg: K8 | null = null,
129+
K0016Arg: K0018 | null = null,
130130
initCmdArg: InitCommand | null = null,
131131
clusterCmdArg: ClusterCommand | null = null,
132132
networkCmdArg: NetworkCommand | null = null,
@@ -145,7 +145,7 @@ export function bootstrapTestVariables(
145145
const helm: Helm = container.resolve(InjectTokens.Helm);
146146
const chartManager: ChartManager = container.resolve(InjectTokens.ChartManager);
147147
const keyManager: KeyManager = container.resolve(InjectTokens.KeyManager);
148-
const K0009: K8 = K0016Arg || container.resolve(InjectTokens.K0001);
148+
const K0009: K0018 = K0016Arg || container.resolve(InjectTokens.K0001);
149149
const accountManager: AccountManager = container.resolve(InjectTokens.AccountManager);
150150
const platformInstaller: PlatformInstaller = container.resolve(InjectTokens.PlatformInstaller);
151151
const profileManager: ProfileManager = container.resolve(InjectTokens.ProfileManager);
@@ -200,7 +200,7 @@ export function bootstrapTestVariables(
200200
export function e2eTestSuite(
201201
testName: string,
202202
argv: Record<any, any>,
203-
K0016Arg: K8 | null = null,
203+
K0016Arg: K0018 | null = null,
204204
initCmdArg: InitCommand | null = null,
205205
clusterCmdArg: ClusterCommand | null = null,
206206
networkCmdArg: NetworkCommand | null = null,
@@ -401,7 +401,7 @@ export function accountCreationShouldSucceed(
401401

402402
export async function getNodeAliasesPrivateKeysHash(
403403
networkNodeServicesMap: Map<NodeAlias, NetworkNodeServices>,
404-
K0009: K8,
404+
K0009: K0018,
405405
destDir: string,
406406
) {
407407
const dataKeysDir = path.join(constants.HEDERA_HAPI_PATH, 'data', 'keys');
@@ -439,7 +439,7 @@ export async function getNodeAliasesPrivateKeysHash(
439439

440440
async function addKeyHashToMap(
441441
namespace: NamespaceName,
442-
K0009: K8,
442+
K0009: K0018,
443443
nodeAlias: NodeAlias,
444444
keyDir: string,
445445
uniqueNodeDestDir: string,

0 commit comments

Comments
 (0)