-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade go-ipfix to v0.13.0 #6998
Upgrade go-ipfix to v0.13.0 #6998
Conversation
09b8c16
to
31bbde9
Compare
@@ -144,7 +150,8 @@ func (e *IPFIXExporter) UpdateOptions(opt *options.Options) { | |||
e.observationDomainID = genObservationDomainID(e.clusterUUID) | |||
} | |||
e.templateRefreshTimeout = opt.TemplateRefreshTimeout | |||
klog.InfoS("New IPFIXExporter configuration", "collectorAddress", e.externalFlowCollectorAddr, "collectorProtocol", e.externalFlowCollectorProto, "sendJSON", e.sendJSONRecord, "domainID", e.observationDomainID, "templateRefreshTimeout", e.templateRefreshTimeout) | |||
e.maxIPFIXMsgSize = int(opt.Config.FlowCollector.MaxIPFIXMsgSize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any range for this? should we check if the value provided by the user is a reasonable value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added validation code, using the same limits as in the go-ipfix library
pkg/flowaggregator/exporter/ipfix.go
Outdated
if klog.V(7).Enabled() { | ||
klog.InfoS("Data set sent successfully", "bytes sent", sentBytes) | ||
klog.InfoS("Data record added successfully") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it just call klog.V(7).InfoS("Data record added successfully")
, getting rid of Enabled
check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you are suggesting this because the "cost" is the same in the absence of fields to log?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, it's not common to have a dedicated Enabled
check when there is no big overhead to serialize the values as it could have been written in one line.
pkg/flowaggregator/exporter/ipfix.go
Outdated
if e.exportingProcess != nil { | ||
e.exportingProcess.CloseConnToCollector() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it flush bufferedExporter
first like Stop()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say it's reasonable not to flush in case of error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is when user changes the configuration, right? If not flushed, could some records received in the last second be lost. My understanding this is similar to Stop
+ Start
, so I wonder why we flush upon Stop
but not here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right actually, I thought you left that comment in a different place. I'll make the change
As part of this upgrade, we make the following changes: * Switch to buffered IPFIX exporter in the Flow Aggregator. This exporter has better performance for UDP IPFIX messages, by ensuring that multiple data records can be batched together in a single message. * Provide Path MTU (PMTU) when creating the IPFIX exporter in the Flow Aggregator. The value is used by the new buffered exporter to determine how many IPFIX records can fit in a single message while avoiding IP fragmentation. In our case, we "approximate" the Path MTU by looking up the MTU of the Flow Aggregator Pod's eth0 interface. * Add a MaxMsgSize configuration parameter to the Flow Aggregator as a way to override the default behavior, which is to use the MTU (minus header overhead) when the UDP protocol is used. * Add periodic flushing when exporting IPFIX records, which is necessary after switching to the buffered exporter. In Aggregation mode, flushing happens after processing a given batch of expired records. In Proxy mode, flushing happens every second. * Use updated reference IPFIX collector in e2e tests. The updated collector handles the case where multiple data records are included in the same IPFIX message more gracefully, which leads to some simplification in the test code. Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
31bbde9
to
8942f97
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall, one nit.
@@ -34,6 +34,7 @@ Kubernetes: `>= 1.19.0-0` | |||
| flowAggregatorAddress | string | `""` | Provide an extra DNS name or IP address of flow aggregator for generating TLS certificate. | | |||
| flowCollector.address | string | `""` | Provide the flow collector address as string with format <IP>:<port>[:<proto>], where proto is tcp or udp. If no L4 transport proto is given, we consider tcp as default. | | |||
| flowCollector.enable | bool | `false` | Determine whether to enable exporting flow records to external flow collector. | | |||
| flowCollector.maxIPFIXMsgSize | int | `0` | Maximum message size to use for IPFIX records. If set to 0 (recommended), a reasonable default value will be used based on the protocol (tcp or udp) used to connect to the collector. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| flowCollector.maxIPFIXMsgSize | int | `0` | Maximum message size to use for IPFIX records. If set to 0 (recommended), a reasonable default value will be used based on the protocol (tcp or udp) used to connect to the collector. | | |
| flowCollector.maxIPFIXMsgSize | int | `0` | Maximum message size to use for IPFIX records. If set to 0 (recommended), a reasonable default value will be used based on the protocol (tcp or udp) used to connect to the collector. Min valid value is 512 and max valid value is 65535. | |
/test-all |
closed by mistake... |
/test-all |
17e2d9d
to
cb16327
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one minor comment about inconsistent error messages
return nil, fmt.Errorf("maxIPFIXMsgSize cannot be smaller than minimum valid IPFIX mesage size %d", flowaggregatorconfig.MinValidIPFIXMsgSize) | ||
} | ||
if opt.Config.FlowCollector.MaxIPFIXMsgSize > flowaggregatorconfig.MaxValidIPFIXMsgSize { | ||
return nil, fmt.Errorf("maxIPFIXMsgSize cannot be greater than the maximum valid IPFIX mesage size %d", flowaggregatorconfig.MaxValidIPFIXMsgSize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the error message have "the" in front of minimum/maximum consistently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, thanks
Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
cb16327
to
314fd64
Compare
/test-all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
As part of this upgrade, we make the following changes:
exporter has better performance for UDP IPFIX messages, by ensuring
that multiple data records can be batched together in a single
message.
Aggregator. The value is used by the new buffered exporter to
determine how many IPFIX records can fit in a single message while
avoiding IP fragmentation. In our case, we "approximate" the Path MTU
by looking up the MTU of the Flow Aggregator Pod's eth0 interface.
way to override the default behavior, which is to use the MTU (minus
header overhead) when the UDP protocol is used.
after switching to the buffered exporter. In Aggregation mode,
flushing happens after processing a given batch of expired records. In
Proxy mode, flushing happens every second.
collector handles the case where multiple data records are included in
the same IPFIX message more gracefully, which leads to some
simplification in the test code.