|
| 1 | +package v1alpha1 |
| 2 | + |
| 3 | +import ( |
| 4 | + "k8s.io/apimachinery/pkg/api/resource" |
| 5 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 6 | +) |
| 7 | + |
| 8 | +// +genclient |
| 9 | +// +genclient:noStatus |
| 10 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 11 | + |
| 12 | +// TrafficSplit allows users to incrementally direct percentages of traffic |
| 13 | +// between various services. It will be used by clients such as ingress |
| 14 | +// controllers or service mesh sidecars to split the outgoing traffic to |
| 15 | +// different destinations. |
| 16 | +type TrafficSplit struct { |
| 17 | + metav1.TypeMeta `json:",inline"` |
| 18 | + // Standard object's metadata. |
| 19 | + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata |
| 20 | + // +optional |
| 21 | + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` |
| 22 | + |
| 23 | + // Specification of the desired behavior of the traffic split. |
| 24 | + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status |
| 25 | + // +optional |
| 26 | + Spec TrafficSplitSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` |
| 27 | + |
| 28 | + // Most recently observed status of the pod. |
| 29 | + // This data may not be up to date. |
| 30 | + // Populated by the system. |
| 31 | + // Read-only. |
| 32 | + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status |
| 33 | + // +optional |
| 34 | + //Status Status `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` |
| 35 | +} |
| 36 | + |
| 37 | +// TrafficSplitSpec is the specification for a TrafficSplit |
| 38 | +type TrafficSplitSpec struct { |
| 39 | + Service string `json:"service,omitempty"` |
| 40 | + Backends []TrafficSplitBackend `json:"backends,omitempty"` |
| 41 | +} |
| 42 | + |
| 43 | +// TrafficSplitBackend defines a backend |
| 44 | +type TrafficSplitBackend struct { |
| 45 | + Service string `json:"service,omitempty"` |
| 46 | + Weight *resource.Quantity `json:"weight,omitempty"` |
| 47 | +} |
| 48 | + |
| 49 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 50 | + |
| 51 | +type TrafficSplitList struct { |
| 52 | + metav1.TypeMeta `json:",inline"` |
| 53 | + metav1.ListMeta `json:"metadata"` |
| 54 | + |
| 55 | + Items []TrafficSplit `json:"items"` |
| 56 | +} |
0 commit comments