misc: make it work with gateway

This commit is contained in:
Sheen Capadngan
2025-05-29 02:01:17 +08:00
parent 918911f2e4
commit 8cae92f29e
@@ -80,10 +80,11 @@ export const KubernetesProvider = ({ gatewayService }: TKubernetesProviderDTO):
}; };
const url = new URL(providerInputs.url); const url = new URL(providerInputs.url);
const k8sHost = `${url.protocol}//${url.hostname}`;
const k8sPort = url.port ? Number(url.port) : 443; const k8sPort = url.port ? Number(url.port) : 443;
if (providerInputs.gatewayId) { if (providerInputs.gatewayId) {
const k8sHost = url.hostname;
await $gatewayProxyWrapper( await $gatewayProxyWrapper(
{ {
gatewayId: providerInputs.gatewayId, gatewayId: providerInputs.gatewayId,
@@ -93,6 +94,7 @@ export const KubernetesProvider = ({ gatewayService }: TKubernetesProviderDTO):
serviceAccountGetCallback serviceAccountGetCallback
); );
} else { } else {
const k8sHost = `${url.protocol}//${url.hostname}`;
await serviceAccountGetCallback(k8sHost, k8sPort); await serviceAccountGetCallback(k8sHost, k8sPort);
} }
@@ -132,13 +134,14 @@ export const KubernetesProvider = ({ gatewayService }: TKubernetesProviderDTO):
const url = new URL(providerInputs.url); const url = new URL(providerInputs.url);
const k8sHost = `${url.protocol}//${url.hostname}`; const k8sHost = `${url.protocol}//${url.hostname}`;
const k8sGatewayHost = url.hostname;
const k8sPort = url.port ? Number(url.port) : 443; const k8sPort = url.port ? Number(url.port) : 443;
const tokenData = providerInputs.gatewayId const tokenData = providerInputs.gatewayId
? await $gatewayProxyWrapper( ? await $gatewayProxyWrapper(
{ {
gatewayId: providerInputs.gatewayId, gatewayId: providerInputs.gatewayId,
targetHost: k8sHost, targetHost: k8sGatewayHost,
targetPort: k8sPort targetPort: k8sPort
}, },
tokenRequestCallback tokenRequestCallback