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 5, 2024
1 parent 34fd0ae commit 3bd04ea
Show file tree
Hide file tree
Showing 26 changed files with 731 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.

22 changes: 22 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. Users setting its values do it at their own risk.
Expand Down Expand Up @@ -832,6 +836,24 @@ 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 {
CIDRs []string `json:"cidrs,omitempty"`
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.

22 changes: 22 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. Users setting its values do it at their own risk.
Expand Down Expand Up @@ -983,6 +987,24 @@ 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 {
CIDRs []string `json:"cidrs,omitempty"`
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.

58 changes: 58 additions & 0 deletions bundle/manifests/flows.netobserv.io_flowcollectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5055,6 +5055,35 @@ 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:
items:
type: string
type: array
name:
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 @@ -8008,6 +8037,35 @@ 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:
items:
type: string
type: array
name:
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
14 changes: 14 additions & 0 deletions bundle/manifests/netobserv-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,12 @@ spec:
path: processor.metrics.includeList
- displayName: Port
path: processor.metrics.server.port
- displayName: Subnet labels
path: processor.subnetLabels
- displayName: Custom labels
path: processor.subnetLabels.customLabels
- displayName: Open shift auto detect
path: processor.subnetLabels.openShiftAutoDetect
statusDescriptors:
- description: Namespace where console plugin and flowlogs-pipeline have been
deployed.
Expand Down Expand Up @@ -1020,6 +1026,14 @@ spec:
- list
- update
- watch
- apiGroups:
- operator.openshift.io
resources:
- networks
verbs:
- get
- list
- watch
- apiGroups:
- rbac.authorization.k8s.io
resources:
Expand Down
Loading

0 comments on commit 3bd04ea

Please sign in to comment.