fix: resolve kubernetes import issue
This commit is contained in:
parent
803671de14
commit
9e32dd8ada
@ -8,7 +8,6 @@ import { ApiClient } from '~/server/headscale/api-client';
|
|||||||
import log from '~/utils/log';
|
import log from '~/utils/log';
|
||||||
import { HeadplaneConfig } from '../schema';
|
import { HeadplaneConfig } from '../schema';
|
||||||
import { Integration } from './abstract';
|
import { Integration } from './abstract';
|
||||||
import { isHeadscaleServeCmd } from './cmdline.ts';
|
|
||||||
|
|
||||||
// TODO: Upgrade to the new CoreV1Api from @kubernetes/client-node
|
// TODO: Upgrade to the new CoreV1Api from @kubernetes/client-node
|
||||||
type T = NonNullable<HeadplaneConfig['integration']>['kubernetes'];
|
type T = NonNullable<HeadplaneConfig['integration']>['kubernetes'];
|
||||||
@ -163,9 +162,11 @@ export default class KubernetesIntegration extends Integration<T> {
|
|||||||
try {
|
try {
|
||||||
log.debug('config', 'Reading %s', path);
|
log.debug('config', 'Reading %s', path);
|
||||||
const data = await readFile(path, 'utf8');
|
const data = await readFile(path, 'utf8');
|
||||||
if (isHeadscaleServeCmd(data)) {
|
if (!data.includes('headscale') && !data.includes('serve')) {
|
||||||
return pid;
|
throw new Error('Found PID without Headscale serve command');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return pid;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.debug('config', 'Failed to read %s: %s', path, error);
|
log.debug('config', 'Failed to read %s: %s', path, error);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user