Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions config/sample-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -480,46 +480,55 @@ frontend:
- id: K8S_Name
name: Names
calculated: '[SrcK8S_Name,DstK8S_Name]'
filter: name
default: false
width: 15
- id: K8S_Type
name: Kinds
calculated: '[SrcK8S_Type,DstK8S_Type]'
filter: kind
default: false
width: 10
- id: K8S_OwnerName
name: Owners
calculated: '[SrcK8S_OwnerName,DstK8S_OwnerName]'
filter: owner_name
default: false
width: 15
- id: K8S_OwnerType
name: Owner Kinds
calculated: '[SrcK8S_OwnerType,DstK8S_OwnerType]'
filter: kind
default: false
width: 10
- id: K8S_Namespace
name: Namespaces
calculated: '[SrcK8S_Namespace,DstK8S_Namespace]'
filter: namespace
default: false
width: 15
- id: Addr
name: IP
calculated: '[SrcAddr,DstAddr]'
filter: address
default: false
width: 10
- id: Port
name: Ports
calculated: '[SrcPort,DstPort]'
filter: port
default: false
width: 10
- id: Mac
name: MAC
calculated: '[SrcMac,DstMac]'
filter: mac
default: false
width: 10
- id: K8S_HostIP
name: Node IP
calculated: '[SrcK8S_HostIP,DstK8S_HostIP]'
filter: host_address
default: false
width: 10
- id: Sampling
Expand All @@ -530,16 +539,19 @@ frontend:
- id: K8S_HostName
name: Node Name
calculated: '[SrcK8S_HostName,DstK8S_HostName]'
filter: host_name
default: false
width: 15
- id: K8S_Object
name: Kubernetes Objects
calculated: '[column.SrcK8S_Object,column.DstK8S_Object]'
filter: resource
default: false
width: 15
- id: K8S_OwnerObject
name: Owner Kubernetes Objects
calculated: '[column.SrcK8S_OwnerObject,column.DstK8S_OwnerObject]'
filter: resource
default: false
width: 15
- id: K8S_FlowLayer
Expand Down Expand Up @@ -822,6 +834,22 @@ frontend:
name: Cluster
component: autocomplete
hint: Specify a cluster ID or name.
- id: namespace
name: Namespace
component: autocomplete
autoCompleteAddsQuotes: true
category: targeteable
placeholder: 'E.g: netobserv'
hint: Specify a single kubernetes name.
examples: |-
Specify a single kubernetes name following these rules:
- Containing any alphanumeric, hyphen, underscrore or dot character
- Partial text like cluster, cluster-image, image-registry
- Exact match using quotes like "cluster-image-registry"
- Case sensitive match using quotes like "Deployment"
- Starting text like cluster, "cluster-*"
- Ending text like "*-registry"
- Pattern like "cluster-*-registry", "c*-*-r*y", -i*e-
- id: src_namespace
name: Namespace
component: autocomplete
Expand Down Expand Up @@ -854,6 +882,21 @@ frontend:
- Starting text like cluster, "cluster-*"
- Ending text like "*-registry"
- Pattern like "cluster-*-registry", "c*-*-r*y", -i*e-
- id: name
name: Name
component: text
category: targeteable
placeholder: 'E.g: my-pod'
hint: Specify a single kubernetes name.
examples: |-
Specify a single kubernetes name following these rules:
- Containing any alphanumeric, hyphen, underscrore or dot character
- Partial text like cluster, cluster-image, image-registry
- Exact match using quotes like "cluster-image-registry"
- Case sensitive match using quotes like "Deployment"
- Starting text like cluster, "cluster-*"
- Ending text like "*-registry"
- Pattern like "cluster-*-registry", "c*-*-r*y", -i*e-
- id: src_name
name: Name
component: text
Expand Down Expand Up @@ -884,6 +927,12 @@ frontend:
- Starting text like cluster, "cluster-*"
- Ending text like "*-registry"
- Pattern like "cluster-*-registry", "c*-*-r*y", -i*e-
- id: kind
name: Kind
component: autocomplete
autoCompleteAddsQuotes: true
category: targeteable
placeholder: 'E.g: Pod, Service'
- id: src_kind
name: Kind
component: autocomplete
Expand All @@ -896,6 +945,21 @@ frontend:
autoCompleteAddsQuotes: true
category: destination
placeholder: 'E.g: Pod, Service'
- id: owner_name
name: Owner Name
component: text
category: targeteable
placeholder: 'E.g: my-deployment'
hint: Specify a single kubernetes name.
examples: |-
Specify a single kubernetes name following these rules:
- Containing any alphanumeric, hyphen, underscrore or dot character
- Partial text like cluster, cluster-image, image-registry
- Exact match using quotes like "cluster-image-registry"
- Case sensitive match using quotes like "Deployment"
- Starting text like cluster, "cluster-*"
- Ending text like "*-registry"
- Pattern like "cluster-*-registry", "c*-*-r*y", -i*e-
- id: src_owner_name
name: Owner Name
component: text
Expand Down Expand Up @@ -926,6 +990,11 @@ frontend:
- Starting text like cluster, "cluster-*"
- Ending text like "*-registry"
- Pattern like "cluster-*-registry", "c*-*-r*y", -i*e-
- id: zone
name: Zone
component: autocomplete
category: targeteable
hint: Specify a single zone.
- id: src_zone
name: Zone
component: autocomplete
Expand All @@ -936,6 +1005,11 @@ frontend:
component: autocomplete
category: destination
hint: Specify a single zone.
- id: subnet_label
name: Subnet Label
component: autocomplete
category: targeteable
hint: Specify a subnet label, or an empty string to get unmatched sources.
- id: src_subnet_label
name: Subnet Label
component: autocomplete
Expand All @@ -946,6 +1020,17 @@ frontend:
component: autocomplete
category: destination
hint: Specify a subnet label, or an empty string to get unmatched destinations.
- id: resource
name: Resource
component: autocomplete
category: targeteable
placeholder: 'E.g: Deployment.example.my-dep or Pod.default.my-pod'
hint: Specify an existing resource from its kind, namespace and name.
examples: |-
Specify a kind, namespace and name from existing:
- Select kind first from suggestions
- Then select namespace from suggestions
- Finally select name from suggestions
- id: src_resource
name: Resource
component: autocomplete
Expand All @@ -968,6 +1053,17 @@ frontend:
- Select kind first from suggestions
- Then select namespace from suggestions
- Finally select name from suggestions
- id: address
name: IP
component: text
category: targeteable
hint: Specify a single IP or range.
placeholder: 'E.g: 192.0.2.0'
examples: |-
Specify IP following one of these rules:
- A single IPv4 or IPv6 address like 192.0.2.0, ::1
- An IP address range like 192.168.0.1-192.189.10.12, 2001:db8::1-2001:db8::8
- A CIDR specification like 192.51.100.0/24, 2001:db8::/32
- id: src_address
name: IP
component: text
Expand All @@ -990,6 +1086,17 @@ frontend:
- A single IPv4 or IPv6 address like 192.0.2.0, ::1
- An IP address range like 192.168.0.1-192.189.10.12, 2001:db8::1-2001:db8::8
- A CIDR specification like 192.51.100.0/24, 2001:db8::/32
- id: port
name: Port
component: autocomplete
category: targeteable
hint: Specify a single port number or name.
placeholder: 'E.g: 80'
examples: |-
Specify a single port following one of these rules:
- A port number like 80, 21
- A IANA name like HTTP, FTP
docUrl: https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml
- id: src_port
name: Port
component: autocomplete
Expand All @@ -1012,6 +1119,12 @@ frontend:
- A port number like 80, 21
- A IANA name like HTTP, FTP
docUrl: https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml
- id: mac
name: MAC
component: text
category: targeteable
placeholder: 'E.g: 42:01:0A:00:00:01'
hint: Specify a single MAC address.
- id: src_mac
name: MAC
component: text
Expand All @@ -1024,6 +1137,17 @@ frontend:
category: destination
placeholder: 'E.g: 42:01:0A:00:00:01'
hint: Specify a single MAC address.
- id: host_address
name: Node IP
component: text
category: targeteable
placeholder: 'E.g: 10.0.0.1'
hint: Specify a single IP or range.
examples: |-
Specify IP following one of these rules:
- A single IPv4 or IPv6 address like 192.0.2.0, ::1
- An IP address range like 192.168.0.1-192.189.10.12, 2001:db8::1-2001:db8::8
- A CIDR specification like 192.51.100.0/24, 2001:db8::/32
- id: src_host_address
name: Node IP
component: text
Expand All @@ -1046,6 +1170,21 @@ frontend:
- A single IPv4 or IPv6 address like 192.0.2.0, ::1
- An IP address range like 192.168.0.1-192.189.10.12, 2001:db8::1-2001:db8::8
- A CIDR specification like 192.51.100.0/24, 2001:db8::/32
- id: host_name
name: Node Name
component: text
category: targeteable
placeholder: 'E.g: my-node'
hint: Specify a single kubernetes name.
examples: |-
Specify a single kubernetes name following these rules:
- Containing any alphanumeric, hyphen, underscrore or dot character
- Partial text like cluster, cluster-image, image-registry
- Exact match using quotes like "cluster-image-registry"
- Case sensitive match using quotes like "Deployment"
- Starting text like cluster, "cluster-*"
- Ending text like "*-registry"
- Pattern like "cluster-*-registry", "c*-*-r*y", -i*e-
- id: src_host_name
name: Node Name
component: text
Expand Down Expand Up @@ -1076,6 +1215,10 @@ frontend:
- Starting text like cluster, "cluster-*"
- Ending text like "*-registry"
- Pattern like "cluster-*-registry", "c*-*-r*y", -i*e-
- id: network
name: Network Name
component: text
category: targeteable
- id: src_network
name: Network Name
component: text
Expand Down
4 changes: 2 additions & 2 deletions pkg/handler/flows.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ func (h *Handlers) getFlows(ctx context.Context, lokiClient httpclient.Caller, p
// TODO: this should actually be managed from the loki gateway, with "namespace" query param
filterGroups = filterGroups.Distribute(
[]filters.SingleQuery{
{filters.NewMatch(fields.SrcNamespace, `"`+namespace+`"`)},
{filters.NewMatch(fields.DstNamespace, `"`+namespace+`"`)},
{filters.NewEqualMatch(fields.SrcNamespace, namespace)},
{filters.NewEqualMatch(fields.DstNamespace, namespace)},
},
func(_ filters.SingleQuery) bool { return false },
)
Expand Down
6 changes: 3 additions & 3 deletions pkg/handler/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,14 @@ func (h *Handlers) GetNames(ctx context.Context) func(w http.ResponseWriter, r *
func (h *Handlers) getNamesForPrefix(ctx context.Context, cl clients, prefix, kind, namespace string) ([]string, int, error) {
filts := filters.SingleQuery{}
if namespace != "" {
filts = append(filts, filters.NewMatch(prefix+fields.Namespace, exact(namespace)))
filts = append(filts, filters.NewRegexMatch(prefix+fields.Namespace, exact(namespace)))
}
var searchField string
if utils.IsOwnerKind(kind) {
filts = append(filts, filters.NewMatch(prefix+fields.OwnerType, exact(kind)))
filts = append(filts, filters.NewRegexMatch(prefix+fields.OwnerType, exact(kind)))
searchField = prefix + fields.OwnerName
} else {
filts = append(filts, filters.NewMatch(prefix+fields.Type, exact(kind)))
filts = append(filts, filters.NewRegexMatch(prefix+fields.Type, exact(kind)))
searchField = prefix + fields.Name
}

Expand Down
10 changes: 5 additions & 5 deletions pkg/handler/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ func expandQueries(queries filters.MultiQueries, namespace string, isForProm fun
// (Note that we use DstOwnerName both as an optimization as it's a Loki index,
// and as convenience because looking for empty fields won't work if they aren't indexed)
q1 := filters.SingleQuery{
filters.NewMatch(fields.FlowDirection, `"`+string(constants.Ingress)+`","`+string(constants.Inner)+`"`),
filters.NewRegexMatch(fields.FlowDirection, `"`+string(constants.Ingress)+`","`+string(constants.Inner)+`"`),
}
q2 := filters.SingleQuery{
filters.NewMatch(fields.FlowDirection, `"`+string(constants.Egress)+`"`),
filters.NewMatch(fields.DstType, `"","Service"`),
filters.NewRegexMatch(fields.FlowDirection, `"`+string(constants.Egress)+`"`),
filters.NewRegexMatch(fields.DstType, `"","Service"`),
}

shouldSkip := func(q filters.SingleQuery) bool {
Expand All @@ -258,8 +258,8 @@ func expandQueries(queries filters.MultiQueries, namespace string, isForProm fun
// TODO: this should actually be managed from the loki gateway, with "namespace" query param
expanded = expanded.Distribute(
[]filters.SingleQuery{
{filters.NewMatch(fields.SrcNamespace, `"`+namespace+`"`)},
{filters.NewMatch(fields.DstNamespace, `"`+namespace+`"`)},
{filters.NewRegexMatch(fields.SrcNamespace, `"`+namespace+`"`)},
{filters.NewRegexMatch(fields.DstNamespace, `"`+namespace+`"`)},
},
isForProm,
)
Expand Down
Loading