diff --git a/api/flowcollector/v1beta2/flowcollector_types.go b/api/flowcollector/v1beta2/flowcollector_types.go index 4052bfc9a..1ddffaba5 100644 --- a/api/flowcollector/v1beta2/flowcollector_types.go +++ b/api/flowcollector/v1beta2/flowcollector_types.go @@ -1392,6 +1392,7 @@ type AdvancedProcessorConfig struct { // Defines secondary networks to be checked for resources identification. // To guarantee a correct identification, indexed values must form an unique identifier across the cluster. // If the same index is used by several resources, those resources might be incorrectly labeled. + // If not provided and `spec.agent.ebpf.privileged` is `true`, secondary networks are detected automatically. // +optional SecondaryNetworks []SecondaryNetwork `json:"secondaryNetworks,omitempty"` } @@ -1407,8 +1408,8 @@ const ( ) type SecondaryNetwork struct { - // `name` should match the network name as visible in the pods annotation 'k8s.v1.cni.cncf.io/network-status'. - // +kubebuilder:validation:Required + // Deprecated: `name` is unused. + // +optional Name string `json:"name,omitempty"` // `index` is a list of fields to use for indexing the pods. They should form a unique Pod identifier across the cluster. diff --git a/api/flowcollector/v1beta2/helper.go b/api/flowcollector/v1beta2/helper.go index 43de81880..d7e02f087 100644 --- a/api/flowcollector/v1beta2/helper.go +++ b/api/flowcollector/v1beta2/helper.go @@ -149,8 +149,18 @@ func (spec *FlowCollectorFLP) IsSubnetLabelsEnabled() bool { return spec.HasAutoDetectOpenShiftNetworks() || len(spec.SubnetLabels.CustomLabels) > 0 } -func (spec *FlowCollectorFLP) HasSecondaryIndexes() bool { - return spec.Advanced != nil && len(spec.Advanced.SecondaryNetworks) > 0 +func (spec *FlowCollectorSpec) GetSecondaryIndexes() []SecondaryNetwork { + if spec.Processor.Advanced != nil && len(spec.Processor.Advanced.SecondaryNetworks) > 0 { + return spec.Processor.Advanced.SecondaryNetworks + } + if spec.Agent.EBPF.Privileged { + // Turn-on auto-detection in FLP by interface+MAC or interface+IP + return []SecondaryNetwork{ + {Index: []SecondaryNetworkIndex{SecondaryNetworkIndexByInterface, SecondaryNetworkIndexByIP}}, + {Index: []SecondaryNetworkIndex{SecondaryNetworkIndexByInterface, SecondaryNetworkIndexByMAC}}, + } + } + return nil } func (spec *FlowCollectorFLP) HasAutoDetectOpenShiftNetworks() bool { diff --git a/bundle/manifests/flows.netobserv.io_flowcollectors.yaml b/bundle/manifests/flows.netobserv.io_flowcollectors.yaml index a3a1705e2..ca990d379 100644 --- a/bundle/manifests/flows.netobserv.io_flowcollectors.yaml +++ b/bundle/manifests/flows.netobserv.io_flowcollectors.yaml @@ -5374,6 +5374,7 @@ spec: Defines secondary networks to be checked for resources identification. To guarantee a correct identification, indexed values must form an unique identifier across the cluster. If the same index is used by several resources, those resources might be incorrectly labeled. + If not provided and `spec.agent.ebpf.privileged` is `true`, secondary networks are detected automatically. items: properties: index: @@ -5392,12 +5393,10 @@ spec: type: string type: array name: - description: '`name` should match the network name as - visible in the pods annotation ''k8s.v1.cni.cncf.io/network-status''.' + description: 'Deprecated: `name` is unused.' type: string required: - index - - name type: object type: array type: object diff --git a/config/crd/bases/flows.netobserv.io_flowcollectors.yaml b/config/crd/bases/flows.netobserv.io_flowcollectors.yaml index 6c2e14ff6..c0733e1e7 100644 --- a/config/crd/bases/flows.netobserv.io_flowcollectors.yaml +++ b/config/crd/bases/flows.netobserv.io_flowcollectors.yaml @@ -4959,6 +4959,7 @@ spec: Defines secondary networks to be checked for resources identification. To guarantee a correct identification, indexed values must form an unique identifier across the cluster. If the same index is used by several resources, those resources might be incorrectly labeled. + If not provided and `spec.agent.ebpf.privileged` is `true`, secondary networks are detected automatically. items: properties: index: @@ -4975,11 +4976,10 @@ spec: type: string type: array name: - description: '`name` should match the network name as visible in the pods annotation ''k8s.v1.cni.cncf.io/network-status''.' + description: 'Deprecated: `name` is unused.' type: string required: - index - - name type: object type: array type: object diff --git a/docs/FlowCollector.md b/docs/FlowCollector.md index 8d2dbca5b..d50b5778a 100644 --- a/docs/FlowCollector.md +++ b/docs/FlowCollector.md @@ -8724,7 +8724,8 @@ By convention, some values are forbidden. It must be greater than 1024 and diffe