Skip to content

Commit

Permalink
Add "srcPodIP" field in Traceflow observations
Browse files Browse the repository at this point in the history
Signed-off-by: Kumar Atish <[email protected]>
  • Loading branch information
Atish-iaf committed Apr 22, 2024
1 parent 2dc0201 commit f6336a8
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 10 deletions.
2 changes: 2 additions & 0 deletions build/charts/antrea/crds/traceflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ spec:
type: string
egressNode:
type: string
srcPodIP:
type: string
capturedPacket:
properties:
srcIP:
Expand Down
2 changes: 2 additions & 0 deletions build/yamls/antrea-aks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4961,6 +4961,8 @@ spec:
type: string
egressNode:
type: string
srcPodIP:
type: string
capturedPacket:
properties:
srcIP:
Expand Down
2 changes: 2 additions & 0 deletions build/yamls/antrea-crds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4934,6 +4934,8 @@ spec:
type: string
egressNode:
type: string
srcPodIP:
type: string
capturedPacket:
properties:
srcIP:
Expand Down
2 changes: 2 additions & 0 deletions build/yamls/antrea-eks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4961,6 +4961,8 @@ spec:
type: string
egressNode:
type: string
srcPodIP:
type: string
capturedPacket:
properties:
srcIP:
Expand Down
2 changes: 2 additions & 0 deletions build/yamls/antrea-gke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4961,6 +4961,8 @@ spec:
type: string
egressNode:
type: string
srcPodIP:
type: string
capturedPacket:
properties:
srcIP:
Expand Down
2 changes: 2 additions & 0 deletions build/yamls/antrea-ipsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4961,6 +4961,8 @@ spec:
type: string
egressNode:
type: string
srcPodIP:
type: string
capturedPacket:
properties:
srcIP:
Expand Down
2 changes: 2 additions & 0 deletions build/yamls/antrea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4961,6 +4961,8 @@ spec:
type: string
egressNode:
type: string
srcPodIP:
type: string
capturedPacket:
properties:
srcIP:
Expand Down
1 change: 1 addition & 0 deletions pkg/agent/controller/traceflow/packetin.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ func (c *Controller) parsePacketIn(pktIn *ofctrl.PacketIn) (*crdv1beta1.Traceflo
ob := new(crdv1beta1.Observation)
ob.Component = crdv1beta1.ComponentSpoofGuard
ob.Action = crdv1beta1.ActionForwarded
ob.SrcPodIP = ipSrc
obs = append(obs, *ob)
} else {
ob := new(crdv1beta1.Observation)
Expand Down
8 changes: 6 additions & 2 deletions pkg/agent/controller/traceflow/packetin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ func getTestPacketBytes(dstIP string) []byte {
Protocol: uint8(8),
DSCP: 1,
Length: 20,
NWSrc: net.IP(pod1IPv4),
NWDst: net.IP(dstIP),
NWSrc: net.ParseIP(pod1IPv4),
NWDst: net.ParseIP(dstIP),
}
ethernetPkt := protocol.NewEthernet()
ethernetPkt.HWSrc = pod1MAC
Expand Down Expand Up @@ -329,6 +329,7 @@ func TestParsePacketIn(t *testing.T) {
{
Component: crdv1beta1.ComponentSpoofGuard,
Action: crdv1beta1.ActionForwarded,
SrcPodIP: pod1IPv4,
},
{
Component: crdv1beta1.ComponentEgress,
Expand Down Expand Up @@ -396,6 +397,7 @@ func TestParsePacketIn(t *testing.T) {
{
Component: crdv1beta1.ComponentSpoofGuard,
Action: crdv1beta1.ActionForwarded,
SrcPodIP: pod1IPv4,
},
{
Component: crdv1beta1.ComponentEgress,
Expand Down Expand Up @@ -531,6 +533,7 @@ func TestParsePacketIn(t *testing.T) {
{
Component: crdv1beta1.ComponentSpoofGuard,
Action: crdv1beta1.ActionForwarded,
SrcPodIP: pod1IPv4,
},
{
Component: crdv1beta1.ComponentNetworkPolicy,
Expand Down Expand Up @@ -658,6 +661,7 @@ func TestParsePacketIn(t *testing.T) {
{
Component: crdv1beta1.ComponentSpoofGuard,
Action: crdv1beta1.ActionForwarded,
SrcPodIP: pod1IPv4,
},
{
Component: crdv1beta1.ComponentNetworkPolicy,
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/crd/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,8 @@ type Observation struct {
EgressIP string `json:"egressIP,omitempty" yaml:"egressIP,omitempty"`
// EgressNode is the name of the Egress Node.
EgressNode string `json:"egressNode,omitempty" yaml:"egressNode,omitempty"`
// SrcPodIP is the IP of source Pod.
SrcPodIP string `json:"srcPodIP,omitempty" yaml:"srcPodIP,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
7 changes: 7 additions & 0 deletions pkg/apiserver/openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f6336a8

Please sign in to comment.