Skip to content

Commit 24cc237

Browse files
committed
PR feedback: introduce FlowCollectorSlice status
- Create a status on FlowCollectorSlice CRD that includes: - Number of configured subnets - Filter being applied - Ready condition - SubnetOverlap condition - Add commented-out subnet config in FlowCollectorSlice sample - Add new admin config in FlowCollector sample
1 parent aeb6402 commit 24cc237

14 files changed

+246
-24
lines changed

api/flowcollectorslice/v1alpha1/flowcollectorslice_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ type SubnetLabel struct {
3333
type FlowCollectorSliceStatus struct {
3434
// `conditions` represent the latest available observations of an object's state
3535
Conditions []metav1.Condition `json:"conditions"`
36+
// Filter that is applied for flow collection
37+
// +optional
38+
FilterApplied string `json:"filterApplied"`
39+
// Number of subnet labels configured
40+
// +optional
41+
SubnetLabelsConfigured int `json:"subnetLabelsConfigured"`
3642
}
3743

3844
// +kubebuilder:object:root=true

api/flowcollectorslice/v1alpha1/groupversion_info.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
/*
2-
Copyright 2021.
3-
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
*/
16-
171
// Package v1alpha1 contains API Schema definitions for the flows v1alpha1 API group
182
// +kubebuilder:object:generate=true
193
// +groupName=flows.netobserv.io

bundle/manifests/flows.netobserv.io_flowcollectorslices.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ spec:
132132
- type
133133
type: object
134134
type: array
135+
filterApplied:
136+
description: Filter that is applied for flow collection
137+
type: string
138+
subnetLabelsConfigured:
139+
description: Number of subnet labels configured
140+
type: integer
135141
required:
136142
- conditions
137143
type: object

bundle/manifests/netobserv-operator.clusterserviceversion.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,13 @@ metadata:
247247
"cpu": "100m",
248248
"memory": "100Mi"
249249
}
250+
},
251+
"slicesConfig": {
252+
"collectionMode": "AllowList",
253+
"enable": false,
254+
"namespacesAllowList": [
255+
"/openshift-.*|netobserv.*/"
256+
]
250257
}
251258
},
252259
"prometheus": {

config/crd/bases/flows.netobserv.io_flowcollectorslices.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ spec:
132132
- type
133133
type: object
134134
type: array
135+
filterApplied:
136+
description: Filter that is applied for flow collection
137+
type: string
138+
subnetLabelsConfigured:
139+
description: Number of subnet labels configured
140+
type: integer
135141
required:
136142
- conditions
137143
type: object

config/samples/flows_v1alpha1_flowcollectorslice.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ metadata:
44
name: flowcollectorslice-sample
55
spec:
66
sampling: 10
7+
# subnetLabels:
8+
# - name: my-database
9+
# cidrs:
10+
# - 1.2.3.4/24

config/samples/flows_v1beta2_flowcollector.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ spec:
121121
# info: "5"
122122
# groupBy: Namespace
123123
# lowVolumeThreshold: "5"
124+
slicesConfig:
125+
enable: false
126+
collectionMode: AllowList
127+
namespacesAllowList:
128+
- /openshift-.*|netobserv.*/
124129
# Kafka consumer stage configuration
125130
kafkaConsumerReplicas: 3
126131
kafkaConsumerAutoscaler: null

docs/FlowCollectorSlice.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,20 @@ FlowCollectorSliceStatus defines the observed state of FlowCollectorSlice
164164
`conditions` represent the latest available observations of an object's state<br/>
165165
</td>
166166
<td>true</td>
167+
</tr><tr>
168+
<td><b>filterApplied</b></td>
169+
<td>string</td>
170+
<td>
171+
Filter that is applied for flow collection<br/>
172+
</td>
173+
<td>false</td>
174+
</tr><tr>
175+
<td><b>subnetLabelsConfigured</b></td>
176+
<td>integer</td>
177+
<td>
178+
Number of subnet labels configured<br/>
179+
</td>
180+
<td>false</td>
167181
</tr></tbody>
168182
</table>
169183

helm/crds/flows.netobserv.io_flowcollectorslices.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ spec:
126126
- type
127127
type: object
128128
type: array
129+
filterApplied:
130+
description: Filter that is applied for flow collection
131+
type: string
132+
subnetLabelsConfigured:
133+
description: Number of subnet labels configured
134+
type: integer
129135
required:
130136
- conditions
131137
type: object

internal/controller/flp/flp_controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
metricslatest "github.com/netobserv/network-observability-operator/api/flowmetrics/v1alpha1"
1212
"github.com/netobserv/network-observability-operator/internal/controller/constants"
1313
"github.com/netobserv/network-observability-operator/internal/controller/flp/fmstatus"
14+
"github.com/netobserv/network-observability-operator/internal/controller/flp/slicesstatus"
1415
"github.com/netobserv/network-observability-operator/internal/controller/reconcilers"
1516
"github.com/netobserv/network-observability-operator/internal/pkg/helper"
1617
"github.com/netobserv/network-observability-operator/internal/pkg/manager"
@@ -158,6 +159,8 @@ func (r *Reconciler) reconcile(ctx context.Context, clh *helper.Client, fc *flow
158159
slices.SortFunc(fcSlices.Items, func(a, b sliceslatest.FlowCollectorSlice) int {
159160
return strings.Compare(a.Name, b.Name)
160161
})
162+
slicesstatus.Reset(&fcSlices)
163+
defer slicesstatus.Sync(ctx, r.Client, &fcSlices)
161164
}
162165

163166
// Create sub-reconcilers

0 commit comments

Comments
 (0)