Skip to content

Commit

Permalink
NETOBSERV-1426: detect external workloads / openshift subnets
Browse files Browse the repository at this point in the history
  • Loading branch information
jotak committed Feb 20, 2024
1 parent d3053bc commit ab09645
Show file tree
Hide file tree
Showing 26 changed files with 751 additions and 72 deletions.
1 change: 1 addition & 0 deletions apis/flowcollector/v1alpha1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions apis/flowcollector/v1beta1/flowcollector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,10 @@ type FlowCollectorFLP struct {
// This feature requires the "topology.kubernetes.io/zone" label to be set on nodes.
AddZone *bool `json:"addZone,omitempty"`

//+optional
// `subnetLabels` allows to define custom labels on subnets and IPs or to enable automatic labelling of recognized subnets in OpenShift.
SubnetLabels SubnetLabels `json:"subnetLabels,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. Set these values at your own risk.
Expand Down Expand Up @@ -832,6 +836,28 @@ type DebugConfig struct {
Env map[string]string `json:"env,omitempty"`
}

// `SubnetLabels` allows to define custom labels on subnets and IPs or to enable automatic labelling of recognized subnets in OpenShift.
type SubnetLabels struct {
// `openShiftAutoDetect` allows, when set to `true`, to detect automatically the machines, pods and services subnets based on the
// OpenShift install configuration and the Cluster Network Operator configuration.
//+optional
OpenShiftAutoDetect *bool `json:"openShiftAutoDetect,omitempty"`

// `customLabels` allows to customize subnets and IPs labelling, such as to identify cluster-external workloads or web services.
//+optional
CustomLabels []SubnetLabel `json:"customLabels,omitempty"`
}

// SubnetLabel allows to label subnets and IPs, such as to identify cluster-external workloads or web services.
type SubnetLabel struct {
// List of CIDRs, such as `["1.2.3.4/32"]`.
//+required
CIDRs []string `json:"cidrs,omitempty"`
// Label name, used to flag matching flows.
//+required
Name string `json:"name,omitempty"`
}

// Add more exporter types below
type ExporterType string

Expand Down
70 changes: 70 additions & 0 deletions apis/flowcollector/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions apis/flowcollector/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions apis/flowcollector/v1beta2/flowcollector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,10 @@ type FlowCollectorFLP struct {
// This feature requires the "topology.kubernetes.io/zone" label to be set on nodes.
AddZone *bool `json:"addZone,omitempty"`

//+optional
// `SubnetLabels` allows to define custom labels on subnets and IPs or to enable automatic labelling of recognized subnets in OpenShift.
SubnetLabels SubnetLabels `json:"subnetLabels,omitempty"`

// `advanced` allows setting some aspects of the internal configuration of the flow processor.
// This section is aimed mostly for debugging and fine-grained performance optimizations,
// such as `GOGC` and `GOMAXPROCS` env vars. Set these values at your own risk.
Expand Down Expand Up @@ -983,6 +987,28 @@ type AdvancedPluginConfig struct {
Port *int32 `json:"port,omitempty"`
}

// `SubnetLabels` allows to define custom labels on subnets and IPs or to enable automatic labelling of recognized subnets in OpenShift.
type SubnetLabels struct {
// `openShiftAutoDetect` allows, when set to `true`, to detect automatically the machines, pods and services subnets based on the
// OpenShift install configuration and the Cluster Network Operator configuration.
//+optional
OpenShiftAutoDetect *bool `json:"openShiftAutoDetect,omitempty"`

// `customLabels` allows to customize subnets and IPs labelling, such as to identify cluster-external workloads or web services.
//+optional
CustomLabels []SubnetLabel `json:"customLabels,omitempty"`
}

// SubnetLabel allows to label subnets and IPs, such as to identify cluster-external workloads or web services.
type SubnetLabel struct {
// List of CIDRs, such as `["1.2.3.4/32"]`.
//+required
CIDRs []string `json:"cidrs,omitempty"`
// Label name, used to flag matching flows.
//+required
Name string `json:"name,omitempty"`
}

// Add more exporter types below
type ExporterType string

Expand Down
48 changes: 48 additions & 0 deletions apis/flowcollector/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions bundle/manifests/flows.netobserv.io_flowcollectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5056,6 +5056,37 @@ spec:
Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
subnetLabels:
description: '`subnetLabels` allows to define custom labels on
subnets and IPs or to enable automatic labelling of recognized
subnets in OpenShift.'
properties:
customLabels:
description: '`customLabels` allows to customize subnets and
IPs labelling, such as to identify cluster-external workloads
or web services.'
items:
description: SubnetLabel allows to label subnets and IPs,
such as to identify cluster-external workloads or web
services.
properties:
cidrs:
description: List of CIDRs, such as `["1.2.3.4/32"]`.
items:
type: string
type: array
name:
description: Label name, used to flag matching flows.
type: string
type: object
type: array
openShiftAutoDetect:
description: '`openShiftAutoDetect` allows, when set to `true`,
to detect automatically the machines, pods and services
subnets based on the OpenShift install configuration and
the Cluster Network Operator configuration.'
type: boolean
type: object
type: object
type: object
status:
Expand Down Expand Up @@ -8010,6 +8041,37 @@ spec:
Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
subnetLabels:
description: '`SubnetLabels` allows to define custom labels on
subnets and IPs or to enable automatic labelling of recognized
subnets in OpenShift.'
properties:
customLabels:
description: '`customLabels` allows to customize subnets and
IPs labelling, such as to identify cluster-external workloads
or web services.'
items:
description: SubnetLabel allows to label subnets and IPs,
such as to identify cluster-external workloads or web
services.
properties:
cidrs:
description: List of CIDRs, such as `["1.2.3.4/32"]`.
items:
type: string
type: array
name:
description: Label name, used to flag matching flows.
type: string
type: object
type: array
openShiftAutoDetect:
description: '`openShiftAutoDetect` allows, when set to `true`,
to detect automatically the machines, pods and services
subnets based on the OpenShift install configuration and
the Cluster Network Operator configuration.'
type: boolean
type: object
type: object
type: object
status:
Expand Down
Loading

0 comments on commit ab09645

Please sign in to comment.