Skip to content

Commit

Permalink
Document overlaps between customLabels and autoDetect
Browse files Browse the repository at this point in the history
  • Loading branch information
jotak committed Mar 5, 2024
1 parent 953d1f1 commit 354616e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
3 changes: 2 additions & 1 deletion apis/flowcollector/v1beta1/flowcollector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,7 @@ type SubnetLabels struct {
OpenShiftAutoDetect *bool `json:"openShiftAutoDetect,omitempty"`

// `customLabels` allows to customize subnets and IPs labelling, such as to identify cluster-external workloads or web services.
// If you enable `openShiftAutoDetect`, `customLabels` can override the detected subnets in case they overlap.
//+optional
CustomLabels []SubnetLabel `json:"customLabels,omitempty"`
}
Expand All @@ -866,7 +867,7 @@ type SubnetLabels struct {
type SubnetLabel struct {
// List of CIDRs, such as `["1.2.3.4/32"]`.
//+required
CIDRs []string `json:"cidrs,omitempty"`
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"`
Expand Down
3 changes: 2 additions & 1 deletion apis/flowcollector/v1beta2/flowcollector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,7 @@ type SubnetLabels struct {
OpenShiftAutoDetect *bool `json:"openShiftAutoDetect,omitempty"`

// `customLabels` allows to customize subnets and IPs labelling, such as to identify cluster-external workloads or web services.
// If you enable `openShiftAutoDetect`, `customLabels` can override the detected subnets in case they overlap.
//+optional
CustomLabels []SubnetLabel `json:"customLabels,omitempty"`
}
Expand All @@ -1017,7 +1018,7 @@ type SubnetLabels struct {
type SubnetLabel struct {
// List of CIDRs, such as `["1.2.3.4/32"]`.
//+required
CIDRs []string `json:"cidrs,omitempty"`
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"`
Expand Down
6 changes: 4 additions & 2 deletions bundle/manifests/flows.netobserv.io_flowcollectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2753,7 +2753,8 @@ spec:
customLabels:
description: '`customLabels` allows to customize subnets and
IPs labelling, such as to identify cluster-external workloads
or web services.'
or web services. If you enable `openShiftAutoDetect`, `customLabels`
can override the detected subnets in case they overlap.'
items:
description: SubnetLabel allows to label subnets and IPs,
such as to identify cluster-external workloads or web
Expand Down Expand Up @@ -5847,7 +5848,8 @@ spec:
customLabels:
description: '`customLabels` allows to customize subnets and
IPs labelling, such as to identify cluster-external workloads
or web services.'
or web services. If you enable `openShiftAutoDetect`, `customLabels`
can override the detected subnets in case they overlap.'
items:
description: SubnetLabel allows to label subnets and IPs,
such as to identify cluster-external workloads or web
Expand Down
6 changes: 4 additions & 2 deletions config/crd/bases/flows.netobserv.io_flowcollectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2740,7 +2740,8 @@ spec:
customLabels:
description: '`customLabels` allows to customize subnets and
IPs labelling, such as to identify cluster-external workloads
or web services.'
or web services. If you enable `openShiftAutoDetect`, `customLabels`
can override the detected subnets in case they overlap.'
items:
description: SubnetLabel allows to label subnets and IPs,
such as to identify cluster-external workloads or web
Expand Down Expand Up @@ -5834,7 +5835,8 @@ spec:
customLabels:
description: '`customLabels` allows to customize subnets and
IPs labelling, such as to identify cluster-external workloads
or web services.'
or web services. If you enable `openShiftAutoDetect`, `customLabels`
can override the detected subnets in case they overlap.'
items:
description: SubnetLabel allows to label subnets and IPs,
such as to identify cluster-external workloads or web
Expand Down
4 changes: 2 additions & 2 deletions docs/FlowCollector.md
Original file line number Diff line number Diff line change
Expand Up @@ -4832,7 +4832,7 @@ ResourceClaim references one entry in PodSpec.ResourceClaims.
<td><b><a href="#flowcollectorspecprocessorsubnetlabelscustomlabelsindex">customLabels</a></b></td>
<td>[]object</td>
<td>
`customLabels` allows to customize subnets and IPs labelling, such as to identify cluster-external workloads or web services.<br/>
`customLabels` allows to customize subnets and IPs labelling, such as to identify cluster-external workloads or web services. If you enable `openShiftAutoDetect`, `customLabels` can override the detected subnets in case they overlap.<br/>
</td>
<td>false</td>
</tr><tr>
Expand Down Expand Up @@ -10406,7 +10406,7 @@ ResourceClaim references one entry in PodSpec.ResourceClaims.
<td><b><a href="#flowcollectorspecprocessorsubnetlabelscustomlabelsindex-1">customLabels</a></b></td>
<td>[]object</td>
<td>
`customLabels` allows to customize subnets and IPs labelling, such as to identify cluster-external workloads or web services.<br/>
`customLabels` allows to customize subnets and IPs labelling, such as to identify cluster-external workloads or web services. If you enable `openShiftAutoDetect`, `customLabels` can override the detected subnets in case they overlap.<br/>
</td>
<td>false</td>
</tr><tr>
Expand Down

0 comments on commit 354616e

Please sign in to comment.