-
Notifications
You must be signed in to change notification settings - Fork 25
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
NETOBSERV-1426: detect external workloads / openshift subnets #559
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -505,6 +505,10 @@ type FlowCollectorFLP struct { | |
// This feature requires the "topology.kubernetes.io/zone" label to be set on nodes. | ||
AddZone *bool `json:"addZone,omitempty"` | ||
|
||
//+optional | ||
// `subnetLabels` allows to define custom labels on subnets and IPs or to enable automatic labelling of recognized subnets in OpenShift. | ||
SubnetLabels SubnetLabels `json:"subnetLabels,omitempty"` | ||
|
||
// `debug` allows setting some aspects of the internal configuration of the flow processor. | ||
// This section is aimed exclusively for debugging and fine-grained performance optimizations, | ||
// such as `GOGC` and `GOMAXPROCS` env vars. Set these values at your own risk. | ||
|
@@ -844,6 +848,29 @@ type DebugConfig struct { | |
Env map[string]string `json:"env,omitempty"` | ||
} | ||
|
||
// `SubnetLabels` allows to define custom labels on subnets and IPs or to enable automatic labelling of recognized subnets in OpenShift. | ||
type SubnetLabels struct { | ||
// `openShiftAutoDetect` allows, when set to `true`, to detect automatically the machines, pods and services subnets based on the | ||
// OpenShift install configuration and the Cluster Network Operator configuration. | ||
//+optional | ||
OpenShiftAutoDetect *bool `json:"openShiftAutoDetect,omitempty"` | ||
|
||
// `customLabels` allows to customize subnets and IPs labelling, such as to identify cluster-external workloads or web services. | ||
jotak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// If you enable `openShiftAutoDetect`, `customLabels` can override the detected subnets in case they overlap. | ||
//+optional | ||
CustomLabels []SubnetLabel `json:"customLabels,omitempty"` | ||
} | ||
|
||
// SubnetLabel allows to label subnets and IPs, such as to identify cluster-external workloads or web services. | ||
type SubnetLabel struct { | ||
// List of CIDRs, such as `["1.2.3.4/32"]`. | ||
//+required | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do u need CIDR api verification here ? this is an example There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks yeah I'll look into it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually this pattern only matches IPv4, and we allow IPv6 here. Adding regex for ipv6 is quite more complicated; I'd rather go with a validation webhook (there is a future task to implement that) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this the check for the resource u read to pull cidrs from in CNO, I remember there were extension to verify IP CIDR that was under dev I will see if that is already there in such case that will be very light weight compared to verification webhook There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is new cel check for CIDR pls check this slack thread There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as discussed on slack, using the CIDR check would break compatibility on older k8s/ocp. We need to wait that our last supported version has it |
||
CIDRs []string `json:"cidrs,omitempty"` // Note, starting with k8s 1.31 / ocp 4.16 there's a new way to validate CIDR such as `+kubebuilder:validation:XValidation:rule="isCIDR(self)",message="field should be in CIDR notation format"`. But older versions would reject the CRD so we cannot implement it now to maintain compatibility. | ||
// Label name, used to flag matching flows. | ||
//+required | ||
Name string `json:"name,omitempty"` | ||
} | ||
|
||
// Add more exporter types below | ||
type ExporterType string | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
is there a default ?
false
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.
keeping
nil
as a default makes it more flexible, imagine if in the future we want to enable it by default, then we'll be able to tell "if it's nil => enabled" .. which will also work for folks upgrading from a previous version.If we set a default "false", and we later change the default, people upgrading will still have their old default