diff --git a/apis/flowcollector/v1beta1/flowcollector_types.go b/apis/flowcollector/v1beta1/flowcollector_types.go index b20eccebf..8c755b01e 100644 --- a/apis/flowcollector/v1beta1/flowcollector_types.go +++ b/apis/flowcollector/v1beta1/flowcollector_types.go @@ -485,9 +485,14 @@ type FlowCollectorFLP struct { ClusterName string `json:"clusterName,omitempty"` //+kubebuilder:default:=false - // Set `multiClusterDeployment` to `true` to enable multi clusters feature. This will add clusterName label to flows data + // Set `multiClusterDeployment` to `true` to enable multi clusters feature. This adds clusterName label to flows data MultiClusterDeployment *bool `json:"multiClusterDeployment,omitempty"` + //+optional + // `addZone` allows availability zone awareness by labelling flows with their source and destination zones. + // This feature requires the "topology.kubernetes.io/zone" label to be set on nodes. + AddZone *bool `json:"addZone,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. Users setting its values do it at their own risk. diff --git a/apis/flowcollector/v1beta1/flowcollector_webhook.go b/apis/flowcollector/v1beta1/flowcollector_webhook.go index e43bfd4e3..585c08c02 100644 --- a/apis/flowcollector/v1beta1/flowcollector_webhook.go +++ b/apis/flowcollector/v1beta1/flowcollector_webhook.go @@ -51,7 +51,6 @@ func (r *FlowCollector) ConvertTo(dstRaw conversion.Hub) error { dst.Spec.Loki.Monolithic = restored.Spec.Loki.Monolithic dst.Spec.Loki.Microservices = restored.Spec.Loki.Microservices dst.Spec.Loki.Manual = restored.Spec.Loki.Manual - dst.Spec.Processor.AddZone = restored.Spec.Processor.AddZone return nil } diff --git a/apis/flowcollector/v1beta1/zz_generated.conversion.go b/apis/flowcollector/v1beta1/zz_generated.conversion.go index 33b6f851d..65897b2f2 100644 --- a/apis/flowcollector/v1beta1/zz_generated.conversion.go +++ b/apis/flowcollector/v1beta1/zz_generated.conversion.go @@ -617,6 +617,7 @@ func autoConvert_v1beta1_FlowCollectorFLP_To_v1beta2_FlowCollectorFLP(in *FlowCo // WARNING: in.ConversationTerminatingTimeout requires manual conversion: does not exist in peer-type out.ClusterName = in.ClusterName out.MultiClusterDeployment = (*bool)(unsafe.Pointer(in.MultiClusterDeployment)) + out.AddZone = (*bool)(unsafe.Pointer(in.AddZone)) // WARNING: in.Debug requires manual conversion: does not exist in peer-type return nil } @@ -637,7 +638,7 @@ func autoConvert_v1beta2_FlowCollectorFLP_To_v1beta1_FlowCollectorFLP(in *v1beta out.LogTypes = (*string)(unsafe.Pointer(in.LogTypes)) out.ClusterName = in.ClusterName out.MultiClusterDeployment = (*bool)(unsafe.Pointer(in.MultiClusterDeployment)) - // WARNING: in.AddZone requires manual conversion: does not exist in peer-type + out.AddZone = (*bool)(unsafe.Pointer(in.AddZone)) // WARNING: in.Advanced requires manual conversion: does not exist in peer-type return nil } diff --git a/apis/flowcollector/v1beta1/zz_generated.deepcopy.go b/apis/flowcollector/v1beta1/zz_generated.deepcopy.go index 43760dcc7..48ebf3e72 100644 --- a/apis/flowcollector/v1beta1/zz_generated.deepcopy.go +++ b/apis/flowcollector/v1beta1/zz_generated.deepcopy.go @@ -357,6 +357,11 @@ func (in *FlowCollectorFLP) DeepCopyInto(out *FlowCollectorFLP) { *out = new(bool) **out = **in } + if in.AddZone != nil { + in, out := &in.AddZone, &out.AddZone + *out = new(bool) + **out = **in + } in.Debug.DeepCopyInto(&out.Debug) } diff --git a/apis/flowcollector/v1beta2/flowcollector_types.go b/apis/flowcollector/v1beta2/flowcollector_types.go index 0b39b5909..c55402f73 100644 --- a/apis/flowcollector/v1beta2/flowcollector_types.go +++ b/apis/flowcollector/v1beta2/flowcollector_types.go @@ -356,7 +356,7 @@ type FLPMetrics struct { // `includeList` is a list of metric names to specify which ones to generate. // The names correspond to the names in Prometheus without the prefix. For example, - // `namespace_egress_packets_total` will show up as `netobserv_namespace_egress_packets_total` in Prometheus. + // `namespace_egress_packets_total` shows up as `netobserv_namespace_egress_packets_total` in Prometheus. // Note that the more metrics you add, the bigger is the impact on Prometheus workload resources. // Metrics enabled by default are: // `namespace_flows_total`, `node_ingress_bytes_total`, `workload_ingress_bytes_total`, `namespace_drop_packets_total` (when `PacketDrop` feature is enabled), @@ -442,12 +442,12 @@ type FlowCollectorFLP struct { ClusterName string `json:"clusterName,omitempty"` //+kubebuilder:default:=false - // Set `multiClusterDeployment` to `true` to enable multi clusters feature. This will add clusterName label to flows data + // Set `multiClusterDeployment` to `true` to enable multi clusters feature. This adds `clusterName` label to flows data MultiClusterDeployment *bool `json:"multiClusterDeployment,omitempty"` - //+kubebuilder:default:=false //+optional - // `addZone` when set to `true`, the source and destination of flow will their zone added to the flow + // `addZone` allows availability zone awareness by labelling flows with their source and destination zones. + // This feature requires the "topology.kubernetes.io/zone" label to be set on nodes. AddZone *bool `json:"addZone,omitempty"` // `advanced` allows setting some aspects of the internal configuration of the flow processor. diff --git a/bundle/manifests/flows.netobserv.io_flowcollectors.yaml b/bundle/manifests/flows.netobserv.io_flowcollectors.yaml index 0cb4278b5..14fba7e17 100644 --- a/bundle/manifests/flows.netobserv.io_flowcollectors.yaml +++ b/bundle/manifests/flows.netobserv.io_flowcollectors.yaml @@ -4135,6 +4135,12 @@ spec: and forwards them to the Loki persistence layer and/or any available exporter.' properties: + addZone: + description: '`addZone` allows availability zone awareness by + labelling flows with their source and destination zones. This + feature requires the "topology.kubernetes.io/zone" label to + be set on nodes.' + type: boolean clusterName: default: "" description: '`clusterName` is the name of the cluster to appear @@ -4974,7 +4980,7 @@ spec: multiClusterDeployment: default: false description: Set `multiClusterDeployment` to `true` to enable - multi clusters feature. This will add clusterName label to flows + multi clusters feature. This adds clusterName label to flows data type: boolean port: @@ -7103,9 +7109,10 @@ spec: exporter.' properties: addZone: - default: false - description: '`addZone` when set to `true`, the source and destination - of flow will their zone added to the flow' + description: '`addZone` allows availability zone awareness by + labelling flows with their source and destination zones. This + feature requires the "topology.kubernetes.io/zone" label to + be set on nodes.' type: boolean advanced: description: '`advanced` allows setting some aspects of the internal @@ -7797,8 +7804,8 @@ spec: description: '`includeList` is a list of metric names to specify which ones to generate. The names correspond to the names in Prometheus without the prefix. For example, `namespace_egress_packets_total` - will show up as `netobserv_namespace_egress_packets_total` - in Prometheus. Note that the more metrics you add, the bigger + shows up as `netobserv_namespace_egress_packets_total` in + Prometheus. Note that the more metrics you add, the bigger is the impact on Prometheus workload resources. Metrics enabled by default are: `namespace_flows_total`, `node_ingress_bytes_total`, `workload_ingress_bytes_total`, `namespace_drop_packets_total` @@ -7942,7 +7949,7 @@ spec: multiClusterDeployment: default: false description: Set `multiClusterDeployment` to `true` to enable - multi clusters feature. This will add clusterName label to flows + multi clusters feature. This adds `clusterName` label to flows data type: boolean resources: diff --git a/bundle/manifests/netobserv-operator.clusterserviceversion.yaml b/bundle/manifests/netobserv-operator.clusterserviceversion.yaml index 242ff007f..dfe0cdda0 100644 --- a/bundle/manifests/netobserv-operator.clusterserviceversion.yaml +++ b/bundle/manifests/netobserv-operator.clusterserviceversion.yaml @@ -536,6 +536,10 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:fieldDependency:processor.multiClusterDeployment:true + - displayName: Availability zones + path: processor.addZone + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch - path: processor.advanced x-descriptors: - urn:alm:descriptor:com.tectonic.ui:hidden @@ -740,8 +744,6 @@ spec: path: loki.readTimeout - displayName: Namespace path: namespace - - displayName: Add zone - path: processor.addZone - displayName: Log types path: processor.logTypes - displayName: Disable alerts diff --git a/config/crd/bases/flows.netobserv.io_flowcollectors.yaml b/config/crd/bases/flows.netobserv.io_flowcollectors.yaml index 24d892e97..459d34027 100644 --- a/config/crd/bases/flows.netobserv.io_flowcollectors.yaml +++ b/config/crd/bases/flows.netobserv.io_flowcollectors.yaml @@ -4121,6 +4121,12 @@ spec: and forwards them to the Loki persistence layer and/or any available exporter.' properties: + addZone: + description: '`addZone` allows availability zone awareness by + labelling flows with their source and destination zones. This + feature requires the "topology.kubernetes.io/zone" label to + be set on nodes.' + type: boolean clusterName: default: "" description: '`clusterName` is the name of the cluster to appear @@ -4960,7 +4966,7 @@ spec: multiClusterDeployment: default: false description: Set `multiClusterDeployment` to `true` to enable - multi clusters feature. This will add clusterName label to flows + multi clusters feature. This adds clusterName label to flows data type: boolean port: @@ -7089,9 +7095,10 @@ spec: exporter.' properties: addZone: - default: false - description: '`addZone` when set to `true`, the source and destination - of flow will their zone added to the flow' + description: '`addZone` allows availability zone awareness by + labelling flows with their source and destination zones. This + feature requires the "topology.kubernetes.io/zone" label to + be set on nodes.' type: boolean advanced: description: '`advanced` allows setting some aspects of the internal @@ -7783,8 +7790,8 @@ spec: description: '`includeList` is a list of metric names to specify which ones to generate. The names correspond to the names in Prometheus without the prefix. For example, `namespace_egress_packets_total` - will show up as `netobserv_namespace_egress_packets_total` - in Prometheus. Note that the more metrics you add, the bigger + shows up as `netobserv_namespace_egress_packets_total` in + Prometheus. Note that the more metrics you add, the bigger is the impact on Prometheus workload resources. Metrics enabled by default are: `namespace_flows_total`, `node_ingress_bytes_total`, `workload_ingress_bytes_total`, `namespace_drop_packets_total` @@ -7928,7 +7935,7 @@ spec: multiClusterDeployment: default: false description: Set `multiClusterDeployment` to `true` to enable - multi clusters feature. This will add clusterName label to flows + multi clusters feature. This adds `clusterName` label to flows data type: boolean resources: diff --git a/config/csv/bases/netobserv-operator.clusterserviceversion.yaml b/config/csv/bases/netobserv-operator.clusterserviceversion.yaml index effd3ead9..fc20f6fad 100644 --- a/config/csv/bases/netobserv-operator.clusterserviceversion.yaml +++ b/config/csv/bases/netobserv-operator.clusterserviceversion.yaml @@ -130,6 +130,10 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:fieldDependency:processor.multiClusterDeployment:true + - displayName: Availability zones + path: processor.addZone + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch - path: processor.advanced x-descriptors: - urn:alm:descriptor:com.tectonic.ui:hidden diff --git a/controllers/ebpf/agent_controller.go b/controllers/ebpf/agent_controller.go index 6ce080b27..500cf22ab 100644 --- a/controllers/ebpf/agent_controller.go +++ b/controllers/ebpf/agent_controller.go @@ -209,7 +209,7 @@ func (c *AgentController) desired(ctx context.Context, coll *flowslatest.FlowCol volumeMounts = append(volumeMounts, volumeMount) } - if helper.IsFeatureEnabled(&coll.Spec.Agent.EBPF, flowslatest.PacketDrop) { + if helper.IsAgentFeatureEnabled(&coll.Spec.Agent.EBPF, flowslatest.PacketDrop) { if !coll.Spec.Agent.EBPF.Privileged { rlog.Error(fmt.Errorf("invalid configuration"), "To use PacketsDrop feature privileged mode needs to be enabled") } else { diff --git a/controllers/flp/flp_pipeline_builder.go b/controllers/flp/flp_pipeline_builder.go index 566029a39..38fecf90a 100644 --- a/controllers/flp/flp_pipeline_builder.go +++ b/controllers/flp/flp_pipeline_builder.go @@ -52,10 +52,7 @@ func (b *PipelineBuilder) AddProcessorStages() error { lastStage = b.addTransformFilter(lastStage) lastStage = b.addConnectionTracking(lastStage) - addZone := false - if b.desired.Processor.AddZone != nil { - addZone = *b.desired.Processor.AddZone - } + addZone := helper.IsZoneEnabled(&b.desired.Processor) // enrich stage (transform) configuration enrichedStage := lastStage.TransformNetwork("enrich", api.TransformNetwork{ @@ -359,7 +356,7 @@ func (b *PipelineBuilder) addTransformFilter(lastStage config.PipelineBuilderSta var clusterName string transformFilterRules := []api.TransformFilterRule{} - if b.desired.Processor.MultiClusterDeployment != nil && *b.desired.Processor.MultiClusterDeployment { + if helper.IsMultiClusterEnabled(&b.desired.Processor) { if b.desired.Processor.ClusterName != "" { clusterName = b.desired.Processor.ClusterName } else { diff --git a/docs/FlowCollector.md b/docs/FlowCollector.md index 7b8af1afd..242e28cd7 100644 --- a/docs/FlowCollector.md +++ b/docs/FlowCollector.md @@ -7401,6 +7401,13 @@ TLS client configuration for Loki URL.