Skip to content

Commit 4b3a1b8

Browse files
jpinsonneaujotak
andauthored
NETOBSERV-1927 scopes config (#834)
* add scopes config * Update controllers/consoleplugin/config/static-frontend-config.yaml Co-authored-by: Joel Takvorian <[email protected]> * step into --------- Co-authored-by: Joel Takvorian <[email protected]>
1 parent b508f5d commit 4b3a1b8

File tree

3 files changed

+142
-7
lines changed

3 files changed

+142
-7
lines changed

controllers/consoleplugin/config/config.go

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,19 @@ type FilterConfig struct {
8787
Placeholder string `yaml:"placeholder,omitempty" json:"placeholder,omitempty"`
8888
}
8989

90+
type ScopeConfig struct {
91+
ID string `yaml:"id" json:"id"`
92+
Name string `yaml:"name" json:"name"`
93+
ShortName string `yaml:"shortName" json:"shortName"`
94+
Description string `yaml:"description" json:"description"`
95+
Labels []string `yaml:"labels" json:"labels"`
96+
Feature string `yaml:"feature,omitempty" json:"feature,omitempty"`
97+
Groups []string `yaml:"groups,omitempty" json:"groups,omitempty"`
98+
Filter string `yaml:"filter,omitempty" json:"filter,omitempty"`
99+
Filters []string `yaml:"filters,omitempty" json:"filters,omitempty"`
100+
StepInto string `yaml:"stepInto,omitempty" json:"stepInto,omitempty"`
101+
}
102+
90103
type FieldConfig struct {
91104
Name string `yaml:"name" json:"name"`
92105
Type string `yaml:"type" json:"type"`
@@ -101,17 +114,17 @@ type Deduper struct {
101114
}
102115

103116
type FrontendConfig struct {
104-
RecordTypes []api.ConnTrackOutputRecordTypeEnum `yaml:"recordTypes" json:"recordTypes"`
105-
Columns []ColumnConfig `yaml:"columns" json:"columns"`
106-
Sampling int `yaml:"sampling" json:"sampling"`
107-
Features []string `yaml:"features" json:"features"`
108-
Deduper Deduper `yaml:"deduper" json:"deduper"`
109-
Fields []FieldConfig `yaml:"fields" json:"fields"`
110-
117+
RecordTypes []api.ConnTrackOutputRecordTypeEnum `yaml:"recordTypes" json:"recordTypes"`
111118
PortNaming flowslatest.ConsolePluginPortConfig `yaml:"portNaming,omitempty" json:"portNaming,omitempty"`
119+
Columns []ColumnConfig `yaml:"columns" json:"columns"`
112120
Filters []FilterConfig `yaml:"filters,omitempty" json:"filters,omitempty"`
121+
Scopes []ScopeConfig `yaml:"scopes" json:"scopes"`
113122
QuickFilters []flowslatest.QuickFilter `yaml:"quickFilters,omitempty" json:"quickFilters,omitempty"`
114123
AlertNamespaces []string `yaml:"alertNamespaces,omitempty" json:"alertNamespaces,omitempty"`
124+
Sampling int `yaml:"sampling" json:"sampling"`
125+
Features []string `yaml:"features" json:"features"`
126+
Deduper Deduper `yaml:"deduper" json:"deduper"`
127+
Fields []FieldConfig `yaml:"fields" json:"fields"`
115128
}
116129

117130
type PluginConfig struct {

controllers/consoleplugin/config/static-frontend-config.yaml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,127 @@ filters:
902902
name: Network events flow monitoring
903903
component: text
904904
hint: Specify a single network event.
905+
scopes:
906+
- id: cluster
907+
name: Cluster
908+
shortName: Cl
909+
description: Cluster name or identifier
910+
labels:
911+
- K8S_ClusterName
912+
feature: multiCluster
913+
filter: cluster_name
914+
stepInto: zone
915+
- id: zone
916+
name: Zone
917+
shortName: AZ
918+
description: Availability zone
919+
labels:
920+
- SrcK8S_Zone
921+
- DstK8S_Zone
922+
feature: zones
923+
groups:
924+
- clusters
925+
filters:
926+
- src_zone
927+
- dst_zone
928+
stepInto: host
929+
- id: host
930+
name: Node
931+
shortName: Node
932+
description: Node on which the resources are running
933+
labels:
934+
- SrcK8S_HostName
935+
- DstK8S_HostName
936+
groups:
937+
- clusters
938+
- zones
939+
- clusters+zones
940+
filters:
941+
- src_host_name
942+
- dst_host_name
943+
stepInto: resource
944+
- id: namespace
945+
name: Namespace
946+
shortName: NS
947+
description: Resource namespace
948+
labels:
949+
- SrcK8S_Namespace
950+
- DstK8S_Namespace
951+
groups:
952+
- clusters
953+
- clusters+zones
954+
- clusters+hosts
955+
- zones
956+
- zones+hosts
957+
- hosts
958+
filters:
959+
- src_namespace
960+
- dst_namespace
961+
stepInto: owner
962+
- id: owner
963+
name: Owner
964+
shortName: Own
965+
description: Controller owner, such as a Deployment
966+
labels:
967+
- SrcK8S_OwnerName
968+
- SrcK8S_OwnerType
969+
- DstK8S_OwnerName
970+
- DstK8S_OwnerType
971+
- SrcK8S_Namespace
972+
- DstK8S_Namespace
973+
groups:
974+
- clusters
975+
- clusters+zones
976+
- clusters+hosts
977+
- clusters+namespaces
978+
- zones
979+
- zones+hosts
980+
- zones+namespaces
981+
- hosts
982+
- hosts+namespaces
983+
- namespaces
984+
filters:
985+
- src_owner_name
986+
- dst_owner_name
987+
stepInto: resource
988+
- id: resource
989+
name: Resource
990+
shortName: Res
991+
description: Base resource, such as a Pod, a Service or a Node
992+
labels:
993+
- SrcK8S_Name
994+
- SrcK8S_Type
995+
- SrcK8S_OwnerName
996+
- SrcK8S_OwnerType
997+
- SrcK8S_Namespace
998+
- SrcAddr
999+
- SrcK8S_HostName
1000+
- DstK8S_Name
1001+
- DstK8S_Type
1002+
- DstK8S_OwnerName
1003+
- DstK8S_OwnerType
1004+
- DstK8S_Namespace
1005+
- DstAddr
1006+
- DstK8S_HostName
1007+
groups:
1008+
- clusters
1009+
- clusters+zones
1010+
- clusters+hosts
1011+
- clusters+namespaces
1012+
- clusters+owners
1013+
- zones
1014+
- zones+hosts
1015+
- zones+namespaces
1016+
- zones+owners
1017+
- hosts
1018+
- hosts+namespaces
1019+
- hosts+owners
1020+
- namespaces
1021+
- namespaces+owners
1022+
- owners
1023+
filters:
1024+
- src_resource
1025+
- dst_resource
9051026
# Fields definition, used to generate documentation
9061027
fields:
9071028
- name: TimeFlowStartMs

controllers/consoleplugin/consoleplugin_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ func TestConfigMapContent(t *testing.T) {
338338
assert.Empty(config.Frontend.Features)
339339
assert.NotEmpty(config.Frontend.Columns)
340340
assert.NotEmpty(config.Frontend.Filters)
341+
assert.NotEmpty(config.Frontend.Scopes)
341342
assert.Equal(config.Frontend.Sampling, 1)
342343
assert.Equal(config.Frontend.Deduper.Mark, false)
343344
assert.Equal(config.Frontend.Deduper.Merge, true)

0 commit comments

Comments
 (0)