Add application migration workflow.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
keyhan
2026-05-19 00:31:29 +03:30
parent fda8384a5c
commit 41a276d16d
14 changed files with 1145 additions and 6 deletions
@@ -0,0 +1,42 @@
import * as k8s from '@kubernetes/client-node';
function normalizeNoProxyValue(value?: string): string[] {
return (value || '')
.split(',')
.map((entry) => entry.trim().replace(/^['"]|['"]$/g, ''))
.filter(Boolean);
}
function appendNoProxyEntries(envKey: 'NO_PROXY' | 'no_proxy', entries: string[]): void {
const existing = normalizeNoProxyValue(process.env[envKey]);
if (existing.includes('*')) {
return;
}
const merged = new Set(existing);
for (const entry of entries) {
merged.add(entry);
}
process.env[envKey] = Array.from(merged).join(',');
}
export function registerKubeconfigNoProxy(kubeconfig: string): string[] {
const kc = new k8s.KubeConfig();
kc.loadFromString(kubeconfig);
const cluster = kc.getCurrentCluster() || kc.getClusters()[0];
if (!cluster?.server) {
return [];
}
const url = new URL(cluster.server);
const entries = new Set<string>();
entries.add(url.hostname);
entries.add(url.host);
appendNoProxyEntries('NO_PROXY', Array.from(entries));
appendNoProxyEntries('no_proxy', Array.from(entries));
return Array.from(entries);
}