mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-24 21:50:00 +08:00
Massive refactor (#165)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { Kubectl } from "../types/kubectl";
|
||||
|
||||
const trafficSplitAPIVersionPrefix = "split.smi-spec.io";
|
||||
|
||||
export async function getTrafficSplitAPIVersion(
|
||||
kubectl: Kubectl
|
||||
): Promise<string> {
|
||||
const result = await kubectl.executeCommand("api-versions");
|
||||
const trafficSplitAPIVersion = result.stdout
|
||||
.split("\n")
|
||||
.find((version) => version.startsWith(trafficSplitAPIVersionPrefix));
|
||||
|
||||
if (!trafficSplitAPIVersion) {
|
||||
throw new Error("Unable to find traffic split api version");
|
||||
}
|
||||
|
||||
return trafficSplitAPIVersion;
|
||||
}
|
||||
Reference in New Issue
Block a user