Skip to content

Commit

Permalink
Remove deprecated v1alpha1 Traceflow CRD
Browse files Browse the repository at this point in the history
Signed-off-by: Lan Luo <luola@vmware.com>
  • Loading branch information
luolanzone committed Apr 16, 2024
1 parent 441d84f commit 4f5b7f7
Show file tree
Hide file tree
Showing 14 changed files with 1 addition and 1,002 deletions.
2 changes: 1 addition & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ These are the CRDs currently available in `crd.antrea.io`.
| `NetworkPolicy` | v1beta1 | v1.13.0 | N/A | N/A |
| `SupportBundleCollection` | v1alpha1 | v1.10.0 | N/A | N/A |
| `Tier` | v1beta1 | v1.13.0 | N/A | N/A |
| `Traceflow` | v1alpha1 | v1.0.0 | v1.13.0 | N/A |
| `Traceflow` | v1beta1 | v1.13.0 | N/A | N/A |

### Other API groups
Expand Down Expand Up @@ -82,3 +81,4 @@ These are the API group versions which are currently available when using Antrea
| `ExternalEntity` | v1alpha1 | v0.10.0 | v0.11.0 | v2.0.0 |
| `NetworkPolicy` | v1alpha1 | v1.0.0 | v1.13.0 | v2.0.0 |
| `Tier` | v1alpha1 | v1.0.0 | v1.13.0 | v2.0.0 |
| `Traceflow` | v1alpha1 | v1.0.0 | v1.13.0 | v2.0.0 |
2 changes: 0 additions & 2 deletions pkg/apis/crd/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ func Resource(resource string) schema.GroupResource {
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(
SchemeGroupVersion,
&Traceflow{},
&TraceflowList{},
&ExternalNode{},
&ExternalNodeList{},
&SupportBundleCollection{},
Expand Down
190 changes: 0 additions & 190 deletions pkg/apis/crd/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,196 +92,6 @@ var SupportedDestinationTypes = []string{
DstTypeIPv4,
}

// Default timeout in seconds.
const DefaultTraceflowTimeout uint16 = 20

// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type Traceflow struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec TraceflowSpec `json:"spec,omitempty"`
Status TraceflowStatus `json:"status,omitempty"`
}

// TraceflowSpec describes the spec of the traceflow.
type TraceflowSpec struct {
Source Source `json:"source,omitempty"`
Destination Destination `json:"destination,omitempty"`
Packet Packet `json:"packet,omitempty"`
// LiveTraffic indicates the Traceflow is to trace the live traffic
// rather than an injected packet, when set to true. The first packet of
// the first connection that matches the packet spec will be traced.
LiveTraffic bool `json:"liveTraffic,omitempty"`
// DroppedOnly indicates only the dropped packet should be captured in a
// live-traffic Traceflow.
DroppedOnly bool `json:"droppedOnly,omitempty"`
// Timeout specifies the timeout of the Traceflow in seconds. Defaults
// to 20 seconds if not set.
Timeout uint16 `json:"timeout,omitempty"`
}

// Source describes the source spec of the traceflow.
type Source struct {
// Namespace is the source namespace.
Namespace string `json:"namespace,omitempty"`
// Pod is the source pod.
Pod string `json:"pod,omitempty"`
// IP is the source IPv4 or IPv6 address. IP as the source is supported
// only for live-traffic Traceflow.
IP string `json:"ip,omitempty"`
}

// Destination describes the destination spec of the traceflow.
type Destination struct {
// Namespace is the destination namespace.
Namespace string `json:"namespace,omitempty"`
// Pod is the destination pod, exclusive with destination service.
Pod string `json:"pod,omitempty"`
// Service is the destination service, exclusive with destination pod.
Service string `json:"service,omitempty"`
// IP is the destination IPv4 or IPv6 address.
IP string `json:"ip,omitempty"`
}

// IPHeader describes spec of an IPv4 header.
type IPHeader struct {
// SrcIP is the source IP.
SrcIP string `json:"srcIP,omitempty" yaml:"srcIP,omitempty"`
// Protocol is the IP protocol.
Protocol int32 `json:"protocol,omitempty" yaml:"protocol,omitempty"`
// TTL is the IP TTL.
TTL int32 `json:"ttl,omitempty" yaml:"ttl,omitempty"`
// Flags is the flags for IP.
Flags int32 `json:"flags,omitempty" yaml:"flags,omitempty"`
}

// IPv6Header describes spec of an IPv6 header.
type IPv6Header struct {
// SrcIP is the source IPv6.
SrcIP string `json:"srcIP,omitempty" yaml:"srcIP,omitempty"`
// NextHeader is the IPv6 protocol.
NextHeader *int32 `json:"nextHeader,omitempty" yaml:"nextHeader,omitempty"`
// HopLimit is the IPv6 Hop Limit.
HopLimit int32 `json:"hopLimit,omitempty" yaml:"hopLimit,omitempty"`
}

// TransportHeader describes spec of a TransportHeader.
type TransportHeader struct {
ICMP *ICMPEchoRequestHeader `json:"icmp,omitempty" yaml:"icmp,omitempty"`
UDP *UDPHeader `json:"udp,omitempty" yaml:"udp,omitempty"`
TCP *TCPHeader `json:"tcp,omitempty" yaml:"tcp,omitempty"`
}

// ICMPEchoRequestHeader describes spec of an ICMP echo request header.
type ICMPEchoRequestHeader struct {
// ID is the ICMPEchoRequestHeader ID.
ID int32 `json:"id,omitempty"`
// Sequence is the ICMPEchoRequestHeader sequence.
Sequence int32 `json:"sequence,omitempty"`
}

// UDPHeader describes spec of a UDP header.
type UDPHeader struct {
// SrcPort is the source port.
SrcPort int32 `json:"srcPort,omitempty"`
// DstPort is the destination port.
DstPort int32 `json:"dstPort,omitempty"`
}

// TCPHeader describes spec of a TCP header.
type TCPHeader struct {
// SrcPort is the source port.
SrcPort int32 `json:"srcPort,omitempty"`
// DstPort is the destination port.
DstPort int32 `json:"dstPort,omitempty"`
// Flags are flags in the header.
Flags int32 `json:"flags,omitempty"`
}

// Packet includes header info.
type Packet struct {
SrcIP string `json:"srcIP,omitempty"`
DstIP string `json:"dstIP,omitempty"`
// Length is the IP packet length (includes the IPv4 or IPv6 header length).
Length uint16 `json:"length,omitempty"`
// TODO: change type IPHeader to *IPHeader and correct all internal references
IPHeader IPHeader `json:"ipHeader,omitempty"`
IPv6Header *IPv6Header `json:"ipv6Header,omitempty"`
TransportHeader TransportHeader `json:"transportHeader,omitempty"`
}

// TraceflowStatus describes current status of the traceflow.
type TraceflowStatus struct {
// Phase is the Traceflow phase.
Phase TraceflowPhase `json:"phase,omitempty"`
// Reason is a message indicating the reason of the traceflow's current phase.
Reason string `json:"reason,omitempty"`
// StartTime is the time at which the Traceflow as started by the Antrea Controller.
// Before K8s v1.20, null values (field not set) are not pruned, and a CR where a
// metav1.Time field is not set would fail OpenAPI validation (type string). The
// recommendation seems to be to use a pointer instead, and the field will be omitted when
// serializing.
// See https://github.com/kubernetes/kubernetes/issues/86811
StartTime *metav1.Time `json:"startTime,omitempty"`
// DataplaneTag is a tag to identify a traceflow session across Nodes.
DataplaneTag uint8 `json:"dataplaneTag,omitempty"`
// Results is the collection of all observations on different nodes.
Results []NodeResult `json:"results,omitempty"`
// CapturedPacket is the captured packet in live-traffic Traceflow.
CapturedPacket *Packet `json:"capturedPacket,omitempty"`
}

type NodeResult struct {
// Node is the node of the observation.
Node string `json:"node,omitempty" yaml:"node,omitempty"`
// Role of the node like sender, receiver, etc.
Role string `json:"role,omitempty" yaml:"role,omitempty"`
// Timestamp is the timestamp of the observations on the node.
Timestamp int64 `json:"timestamp,omitempty" yaml:"timestamp,omitempty"`
// Observations includes all observations from sender nodes, receiver ones, etc.
Observations []Observation `json:"observations,omitempty" yaml:"observations,omitempty"`
}

// Observation describes those from sender nodes or receiver nodes.
type Observation struct {
// Component is the observation component.
Component TraceflowComponent `json:"component,omitempty" yaml:"component,omitempty"`
// ComponentInfo is the extension of Component field.
ComponentInfo string `json:"componentInfo,omitempty" yaml:"componentInfo,omitempty"`
// Action is the action to the observation.
Action TraceflowAction `json:"action,omitempty" yaml:"action,omitempty"`
// Pod is the combination of Pod name and Pod Namespace.
Pod string `json:"pod,omitempty" yaml:"pod,omitempty"`
// DstMAC is the destination MAC.
DstMAC string `json:"dstMAC,omitempty" yaml:"dstMAC,omitempty"`
// NetworkPolicy is the combination of Namespace and NetworkPolicyName.
NetworkPolicy string `json:"networkPolicy,omitempty" yaml:"networkPolicy,omitempty"`
// Egress is the name of the Egress.
Egress string `json:"egress,omitempty" yaml:"egress,omitempty"`
// TTL is the observation TTL.
TTL int32 `json:"ttl,omitempty" yaml:"ttl,omitempty"`
// TranslatedSrcIP is the translated source IP.
TranslatedSrcIP string `json:"translatedSrcIP,omitempty" yaml:"translatedSrcIP,omitempty"`
// TranslatedDstIP is the translated destination IP.
TranslatedDstIP string `json:"translatedDstIP,omitempty" yaml:"translatedDstIP,omitempty"`
// TunnelDstIP is the tunnel destination IP.
TunnelDstIP string `json:"tunnelDstIP,omitempty" yaml:"tunnelDstIP,omitempty"`
EgressIP string `json:"egressIP,omitempty" yaml:"egressIP,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type TraceflowList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`

Items []Traceflow `json:"items"`
}

// IPBlock describes a particular CIDR (Ex. "192.168.1.1/24") that is allowed
// or denied to/from the workloads matched by a Spec.AppliedTo.
type IPBlock struct {
Expand Down
Loading

0 comments on commit 4f5b7f7

Please sign in to comment.