Skip to content

Commit f37c6d8

Browse files
fix: hard coded resource file (#2711)
Signed-off-by: Jeffrey Tang <[email protected]>
1 parent 67ee0d4 commit f37c6d8

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/commands/cluster/tasks.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import {RemoteConfigRuntimeState} from '../../business/runtime-state/config/remo
3030
import * as versions from '../../../version.js';
3131
import * as fs from 'node:fs';
3232
import * as yaml from 'yaml';
33-
import {PathEx} from '../../business/utils/path-ex.js';
3433

3534
@injectable()
3635
export class ClusterCommandTasks {
@@ -365,8 +364,7 @@ export class ClusterCommandTasks {
365364
} catch {
366365
// ClusterRole doesn't exist, create it
367366
try {
368-
const templatePath = PathEx.join(process.cwd(), 'resources', 'templates', 'pod-monitor-role.yaml');
369-
const yamlContent = fs.readFileSync(templatePath, 'utf8');
367+
const yamlContent = fs.readFileSync(constants.POD_MONITOR_ROLE_TEMPLATE, 'utf8');
370368
const clusterRole = yaml.parse(yamlContent);
371369

372370
await k8.rbac().createClusterRole(clusterRole);

src/core/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ export const MIRROR_NODE_VALUES_FILE = PathEx.joinWithRealPath(RESOURCES_DIR, 'm
189189
export const MIRROR_NODE_VALUES_FILE_HEDERA = PathEx.joinWithRealPath(RESOURCES_DIR, 'mirror-node-values-hedera.yaml');
190190
export const INGRESS_CONTROLLER_VALUES_FILE = PathEx.joinWithRealPath(RESOURCES_DIR, 'ingress-controller-values.yaml');
191191
export const BLOCK_NODE_VALUES_FILE = PathEx.joinWithRealPath(RESOURCES_DIR, 'block-node-values.yaml');
192+
export const POD_MONITOR_ROLE_TEMPLATE = PathEx.joinWithRealPath(RESOURCES_DIR, 'templates', 'pod-monitor-role.yaml');
192193
export const NODE_LOG_FAILURE_MSG = 'failed to download logs from pod';
193194
export const ONE_SHOT_WITH_BLOCK_NODE = getEnvironmentVariable('ONE_SHOT_WITH_BLOCK_NODE') || 'false';
194195
/**

0 commit comments

Comments
 (0)