Service Mesh Interface (SMI) models.
Install with npm.
npm install @kubernetes-models/smi
import { TrafficSplit } from "@kubernetes-models/smi/split.smi-spec.io/v1alpha4/TrafficSplit";
// Create a new TrafficSplit
const split = new TrafficSplit({
metadata: { name: "example" },
spec: {
service: "example",
backends: [
{ service: "example-v1", weight: 90 },
{ service: "example-v2", weight: 10 }
]
}
});
// Validate against JSON schema
split.validate();
MIT