Skip to content

Commit

Permalink
Addressed comments from 7/30
Browse files Browse the repository at this point in the history
  • Loading branch information
srikartati committed Aug 3, 2020
1 parent 9f04cb6 commit b48253f
Show file tree
Hide file tree
Showing 27 changed files with 590 additions and 591 deletions.
23 changes: 12 additions & 11 deletions build/yamls/antrea-eks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -713,16 +713,17 @@ data:
# Provide flow collector address as string with format <IP>:<port>[:<proto>], where proto is tcp or udp. This also enables flow exporter that sends IPFIX
# flow records of conntrack flows on OVS bridge. If no L4 transport proto is given, we consider tcp as default.
# Defaults to "".
#flowCollectorAddr: ""
# Provide flow exporter poll and export intervals in format "0s:0s". This determines how often flow exporter polls connections
# in conntrack module and exports IPFIX flow records that are built from connection store.
# Flow export interval should be a multiple of flow poll interval.
# Flow poll interval value should be in range [1s, ExportInterval(s)).
# Flow export interval value should be in range (PollInterval(s), 600s].
# Defaults to "5s:60s". Follow the time units of duration.
#flowPollAndFlowExportIntervals: ""
# Provide flow poll interval in format "0s". This determines how often flow exporter dumps connections in conntrack module.
# Flow poll interval should be greater than or equal to 1s(one second).
# Follow the time units of time.Duration type.
#flowPollInterval: "5s"
# Provide flow export frequency, which is the number of poll cycles elapsed before flow exporter exports flow records to
# the flow collector.
# Flow export frequency should be greater than or equal to 1.
#flowExportFrequency: 12
antrea-cni.conflist: |
{
"cniVersion":"0.3.0",
Expand Down Expand Up @@ -771,7 +772,7 @@ metadata:
annotations: {}
labels:
app: antrea
name: antrea-config-d6dk5fc278
name: antrea-config-8c9kbbcb7f
namespace: kube-system
---
apiVersion: v1
Expand Down Expand Up @@ -877,7 +878,7 @@ spec:
key: node-role.kubernetes.io/master
volumes:
- configMap:
name: antrea-config-d6dk5fc278
name: antrea-config-8c9kbbcb7f
name: antrea-config
- name: antrea-controller-tls
secret:
Expand Down Expand Up @@ -1094,7 +1095,7 @@ spec:
operator: Exists
volumes:
- configMap:
name: antrea-config-d6dk5fc278
name: antrea-config-8c9kbbcb7f
name: antrea-config
- hostPath:
path: /etc/cni/net.d
Expand Down
23 changes: 12 additions & 11 deletions build/yamls/antrea-gke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -713,16 +713,17 @@ data:
# Provide flow collector address as string with format <IP>:<port>[:<proto>], where proto is tcp or udp. This also enables flow exporter that sends IPFIX
# flow records of conntrack flows on OVS bridge. If no L4 transport proto is given, we consider tcp as default.
# Defaults to "".
#flowCollectorAddr: ""
# Provide flow exporter poll and export intervals in format "0s:0s". This determines how often flow exporter polls connections
# in conntrack module and exports IPFIX flow records that are built from connection store.
# Flow export interval should be a multiple of flow poll interval.
# Flow poll interval value should be in range [1s, ExportInterval(s)).
# Flow export interval value should be in range (PollInterval(s), 600s].
# Defaults to "5s:60s". Follow the time units of duration.
#flowPollAndFlowExportIntervals: ""
# Provide flow poll interval in format "0s". This determines how often flow exporter dumps connections in conntrack module.
# Flow poll interval should be greater than or equal to 1s(one second).
# Follow the time units of time.Duration type.
#flowPollInterval: "5s"
# Provide flow export frequency, which is the number of poll cycles elapsed before flow exporter exports flow records to
# the flow collector.
# Flow export frequency should be greater than or equal to 1.
#flowExportFrequency: 12
antrea-cni.conflist: |
{
"cniVersion":"0.3.0",
Expand Down Expand Up @@ -771,7 +772,7 @@ metadata:
annotations: {}
labels:
app: antrea
name: antrea-config-6k8785fhcf
name: antrea-config-md9t42kbkc
namespace: kube-system
---
apiVersion: v1
Expand Down Expand Up @@ -877,7 +878,7 @@ spec:
key: node-role.kubernetes.io/master
volumes:
- configMap:
name: antrea-config-6k8785fhcf
name: antrea-config-md9t42kbkc
name: antrea-config
- name: antrea-controller-tls
secret:
Expand Down Expand Up @@ -1092,7 +1093,7 @@ spec:
operator: Exists
volumes:
- configMap:
name: antrea-config-6k8785fhcf
name: antrea-config-md9t42kbkc
name: antrea-config
- hostPath:
path: /etc/cni/net.d
Expand Down
23 changes: 12 additions & 11 deletions build/yamls/antrea-ipsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -713,16 +713,17 @@ data:
# Provide flow collector address as string with format <IP>:<port>[:<proto>], where proto is tcp or udp. This also enables flow exporter that sends IPFIX
# flow records of conntrack flows on OVS bridge. If no L4 transport proto is given, we consider tcp as default.
# Defaults to "".
#flowCollectorAddr: ""
# Provide flow exporter poll and export intervals in format "0s:0s". This determines how often flow exporter polls connections
# in conntrack module and exports IPFIX flow records that are built from connection store.
# Flow export interval should be a multiple of flow poll interval.
# Flow poll interval value should be in range [1s, ExportInterval(s)).
# Flow export interval value should be in range (PollInterval(s), 600s].
# Defaults to "5s:60s". Follow the time units of duration.
#flowPollAndFlowExportIntervals: ""
# Provide flow poll interval in format "0s". This determines how often flow exporter dumps connections in conntrack module.
# Flow poll interval should be greater than or equal to 1s(one second).
# Follow the time units of time.Duration type.
#flowPollInterval: "5s"
# Provide flow export frequency, which is the number of poll cycles elapsed before flow exporter exports flow records to
# the flow collector.
# Flow export frequency should be greater than or equal to 1.
#flowExportFrequency: 12
antrea-cni.conflist: |
{
"cniVersion":"0.3.0",
Expand Down Expand Up @@ -771,7 +772,7 @@ metadata:
annotations: {}
labels:
app: antrea
name: antrea-config-2g7ttm262c
name: antrea-config-5c99kg5ktt
namespace: kube-system
---
apiVersion: v1
Expand Down Expand Up @@ -886,7 +887,7 @@ spec:
key: node-role.kubernetes.io/master
volumes:
- configMap:
name: antrea-config-2g7ttm262c
name: antrea-config-5c99kg5ktt
name: antrea-config
- name: antrea-controller-tls
secret:
Expand Down Expand Up @@ -1136,7 +1137,7 @@ spec:
operator: Exists
volumes:
- configMap:
name: antrea-config-2g7ttm262c
name: antrea-config-5c99kg5ktt
name: antrea-config
- hostPath:
path: /etc/cni/net.d
Expand Down
23 changes: 12 additions & 11 deletions build/yamls/antrea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -713,16 +713,17 @@ data:
# Provide flow collector address as string with format <IP>:<port>[:<proto>], where proto is tcp or udp. This also enables flow exporter that sends IPFIX
# flow records of conntrack flows on OVS bridge. If no L4 transport proto is given, we consider tcp as default.
# Defaults to "".
#flowCollectorAddr: ""
# Provide flow exporter poll and export intervals in format "0s:0s". This determines how often flow exporter polls connections
# in conntrack module and exports IPFIX flow records that are built from connection store.
# Flow export interval should be a multiple of flow poll interval.
# Flow poll interval value should be in range [1s, ExportInterval(s)).
# Flow export interval value should be in range (PollInterval(s), 600s].
# Defaults to "5s:60s". Follow the time units of duration.
#flowPollAndFlowExportIntervals: ""
# Provide flow poll interval in format "0s". This determines how often flow exporter dumps connections in conntrack module.
# Flow poll interval should be greater than or equal to 1s(one second).
# Follow the time units of time.Duration type.
#flowPollInterval: "5s"
# Provide flow export frequency, which is the number of poll cycles elapsed before flow exporter exports flow records to
# the flow collector.
# Flow export frequency should be greater than or equal to 1.
#flowExportFrequency: 12
antrea-cni.conflist: |
{
"cniVersion":"0.3.0",
Expand Down Expand Up @@ -771,7 +772,7 @@ metadata:
annotations: {}
labels:
app: antrea
name: antrea-config-dk76m4tfk4
name: antrea-config-dcbbcd7h8b
namespace: kube-system
---
apiVersion: v1
Expand Down Expand Up @@ -877,7 +878,7 @@ spec:
key: node-role.kubernetes.io/master
volumes:
- configMap:
name: antrea-config-dk76m4tfk4
name: antrea-config-dcbbcd7h8b
name: antrea-config
- name: antrea-controller-tls
secret:
Expand Down Expand Up @@ -1092,7 +1093,7 @@ spec:
operator: Exists
volumes:
- configMap:
name: antrea-config-dk76m4tfk4
name: antrea-config-dcbbcd7h8b
name: antrea-config
- hostPath:
path: /etc/cni/net.d
Expand Down
17 changes: 9 additions & 8 deletions build/yamls/base/conf/antrea-agent.conf
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ featureGates:

# Provide flow collector address as string with format <IP>:<port>[:<proto>], where proto is tcp or udp. This also enables flow exporter that sends IPFIX
# flow records of conntrack flows on OVS bridge. If no L4 transport proto is given, we consider tcp as default.
# Defaults to "".
#flowCollectorAddr: ""

# Provide flow exporter poll and export intervals in format "0s:0s". This determines how often flow exporter polls connections
# in conntrack module and exports IPFIX flow records that are built from connection store.
# Flow export interval should be a multiple of flow poll interval.
# Flow poll interval value should be in range [1s, ExportInterval(s)).
# Flow export interval value should be in range (PollInterval(s), 600s].
# Defaults to "5s:60s". Follow the time units of duration.
#flowPollAndFlowExportIntervals: ""
# Provide flow poll interval in format "0s". This determines how often flow exporter dumps connections in conntrack module.
# Flow poll interval should be greater than or equal to 1s(one second).
# Follow the time units of time.Duration type.
#flowPollInterval: "5s"

# Provide flow export frequency, which is the number of poll cycles elapsed before flow exporter exports flow records to
# the flow collector.
# Flow export frequency should be greater than or equal to 1.
#flowExportFrequency: 12
40 changes: 20 additions & 20 deletions cmd/antrea-agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,28 +237,28 @@ func run(o *Options) error {
go ofClient.StartPacketInHandler(stopCh)
}

// Initialize flow exporter; start go routines to poll conntrack flows and export IPFIX flow records
// Initialize flow exporter to start go routines to poll conntrack flows and export IPFIX flow records
if features.DefaultFeatureGate.Enabled(features.FlowExporter) {
if o.flowCollector != nil {
var connTrackDumper connections.ConnTrackDumper
if o.config.OVSDatapathType == ovsconfig.OVSDatapathSystem {
connTrackDumper = connections.NewConnTrackDumper(connections.NewConnTrackSystem(), nodeConfig, serviceCIDRNet, o.config.OVSDatapathType, agentQuerier.GetOVSCtlClient())
} else if o.config.OVSDatapathType == ovsconfig.OVSDatapathNetdev {
connTrackDumper = connections.NewConnTrackDumper(connections.NewConnTrackNetdev(), nodeConfig, serviceCIDRNet, o.config.OVSDatapathType, agentQuerier.GetOVSCtlClient())
}
connStore := connections.NewConnectionStore(connTrackDumper, ifaceStore, o.pollingInterval)
flowRecords := flowrecords.NewFlowRecords(connStore)
flowExporter, err := exporter.InitFlowExporter(o.flowCollector, flowRecords, o.exportInterval, o.pollingInterval)
if err != nil {
// If flow exporter cannot be initialized, then Antrea agent does not exit; only error is logged.
klog.Errorf("error when initializing flow exporter: %v", err)
} else {
// pollDone helps in synchronizing connStore.Run and flowExporter.Run go routines.
pollDone := make(chan bool)
go connStore.Run(stopCh, pollDone)
go flowExporter.Run(stopCh, pollDone)
}
connStore := connections.NewConnectionStore(
o.config.OVSDatapathType,
nodeConfig,
serviceCIDRNet,
agentQuerier.GetOVSCtlClient(),
ifaceStore,
o.pollInterval)
// pollDone helps in synchronizing connStore.Run and flowExporter.Run go routines.
pollDone := make(chan struct{})
go connStore.Run(stopCh, pollDone)

flowExporter, err := exporter.InitFlowExporter(
o.flowCollector,
flowrecords.NewFlowRecords(connStore),
o.config.FlowExportFrequency,
o.pollInterval)
if err != nil {
return fmt.Errorf("error when initializing flow exporter: %v", err)
}
go flowExporter.Run(stopCh, pollDone)
}

<-stopCh
Expand Down
21 changes: 12 additions & 9 deletions cmd/antrea-agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,18 @@ type AgentConfig struct {
// Enable metrics exposure via Prometheus. Initializes Prometheus metrics listener
// Defaults to false.
EnablePrometheusMetrics bool `yaml:"enablePrometheusMetrics,omitempty"`
// Provide flow collector address as string with format <IP>:<port>[:<proto>], where proto is tcp or udp. This also enables flow exporter that sends IPFIX
// flow records of conntrack flows on OVS bridge. If no L4 transport proto is given, we consider tcp as default.
// Provide the flow collector address as string with format <IP>:<port>[:<proto>], where proto is tcp or udp. This also
// enables the flow exporter that sends IPFIX flow records of conntrack flows on OVS bridge. If no L4 transport proto
// is given, we consider tcp as default.
// Defaults to "".
FlowCollectorAddr string `yaml:"flowCollectorAddr,omitempty"`
// Provide flow exporter poll and export intervals in format "0s:0s". This determines how often flow exporter polls connections
// in conntrack module and exports IPFIX flow records that are built from connection store.
// Flow export interval should be a multiple of flow poll interval.
// Flow poll interval value should be in range [1s, ExportInterval(s)).
// Flow export interval value should be in range (PollInterval(s), 600s].
// Defaults to "5s:60s". Follow the time units of duration.
FlowPollAndFlowExportIntervals string `yaml:"flowPollAndFlowExportIntervals,omitempty"`
// Provide flow poll interval in format "0s". This determines how often flow exporter dumps connections in conntrack module.
// Flow poll interval should be greater than or equal to 1s(one second).
// Defaults to "5s". Follow the time units of duration.
FlowPollInterval string `yaml:"flowPollInterval,omitempty"`
// Provide flow export frequency, which is the number of poll cycles elapsed before flow exporter exports flow records to
// the flow collector.
// Flow export frequency should be greater than or equal to 1.
// Defaults to "12".
FlowExportFrequency uint `yaml:"flowExportFrequency,omitempty"`
}
2 changes: 1 addition & 1 deletion cmd/antrea-agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func newAgentCommand() *cobra.Command {
if err := opts.validate(args); err != nil {
klog.Fatalf("Failed to validate: %v", err)
}
// Not passing args again as it is already validated and not used in flow exporter config
// Not passing args again as they are already validated and are not used in flow exporter config
if err := opts.validateFlowExporterConfig(); err != nil {
klog.Fatalf("Failed to validate flow exporter config: %v", err)
}
Expand Down
Loading

0 comments on commit b48253f

Please sign in to comment.