connect tailscale node status through platform gateway
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2026-07-08 17:13:52 +09:00
parent 52d53b0462
commit fddf70c985
2 changed files with 64 additions and 0 deletions
+10
View File
@@ -10,4 +10,14 @@ export class TailscaleController {
listNodes() {
return this.tailscaleService.listNodes();
}
@Get('routes')
listRoutes() {
return this.tailscaleService.listRoutes();
}
@Get('acl')
getAcl() {
return this.tailscaleService.getAcl();
}
}
+54
View File
@@ -63,6 +63,60 @@ export class TailscaleService {
}
}
async listRoutes() {
if (!this.gatewayUrl || !this.gatewayToken) {
return {
routes: [],
source: 'platform-gateway',
error: 'PLATFORM_GATEWAY_URL 또는 PLATFORM_GATEWAY_TOKEN이 설정되어 있지 않습니다.',
};
}
try {
const body = await this.request<unknown>('/api/admin/tailscale/routes');
const routes = isRecord(body) && Array.isArray(body.routes) ? body.routes : [];
return {
routes,
source: 'platform-gateway',
fetchedAt: new Date().toISOString(),
};
} catch (error) {
return {
routes: [],
source: 'platform-gateway',
error: error instanceof Error ? error.message : 'Platform Gateway Tailscale Route API 요청이 실패했습니다.',
};
}
}
async getAcl() {
if (!this.gatewayUrl || !this.gatewayToken) {
return {
policy: { groups: {}, tagOwners: {}, acls: [] },
source: 'platform-gateway',
error: 'PLATFORM_GATEWAY_URL 또는 PLATFORM_GATEWAY_TOKEN이 설정되어 있지 않습니다.',
};
}
try {
const body = await this.request<unknown>('/api/admin/tailscale/acl');
const policy = isRecord(body) && isRecord(body.policy)
? body.policy
: { groups: {}, tagOwners: {}, acls: [] };
return {
policy,
source: 'platform-gateway',
fetchedAt: new Date().toISOString(),
};
} catch (error) {
return {
policy: { groups: {}, tagOwners: {}, acls: [] },
source: 'platform-gateway',
error: error instanceof Error ? error.message : 'Platform Gateway Tailscale ACL API 요청이 실패했습니다.',
};
}
}
private async request<T>(path: string): Promise<T> {
const response = await fetch(`${this.gatewayUrl}${path}`, {
headers: {