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
Original file line number Diff line number Diff line change
Expand Up @@ -2165,7 +2165,7 @@ tests:
collectionPolicy: DoNotCollect
collect:
statsGatherer: Netlink
expectedError: 'collect is forbidden when collectionPolicy is not Collect'
expectedError: 'collect may be set when collectionPolicy is Collect, and forbidden otherwise'
- name: Should accept netClass DoNotCollect without collect
initial: |
apiVersion: config.openshift.io/v1alpha1
Expand Down Expand Up @@ -2195,7 +2195,7 @@ tests:
collect:
units:
- "kubelet.service"
expectedError: 'collect is forbidden when collectionPolicy is not Collect'
expectedError: 'collect may be set when collectionPolicy is Collect, and forbidden otherwise'
- name: Should accept systemd DoNotCollect without collect
initial: |
apiVersion: config.openshift.io/v1alpha1
Expand Down
77 changes: 75 additions & 2 deletions config/v1alpha1/types_cluster_monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,16 @@ type NodeExporterCollectorConfig struct {
// Enable when you need visibility into kernel memory zone allocation and pressure.
// +optional
Zoneinfo NodeExporterCollectorZoneinfoConfig `json:"zoneinfo,omitzero"`
// interrupts configures the interrupts collector, which exposes interrupt counts
// from /proc/interrupts.
// interrupts is optional.
// When omitted, this means no opinion and the platform is left to choose a reasonable default,
// which is subject to change over time. The current default is disabled.
// The interrupts collector can produce a large number of metrics depending on the hardware
// and interrupt sources present. When enabled, use the collect.include list to filter
// which interrupt lines are collected.
// +optional
Interrupts NodeExporterCollectorInterruptsConfig `json:"interrupts,omitempty,omitzero"`
}

// NodeExporterCollectorCpufreqConfig provides configuration for the cpufreq collector
Expand Down Expand Up @@ -541,7 +551,7 @@ type NodeExporterCollectorNetDevConfig struct {
// such as network speed, MTU, and carrier status.
// It is enabled by default.
// When collectionPolicy is DoNotCollect, the collect field must not be set.
// +kubebuilder:validation:XValidation:rule="has(self.collectionPolicy) && self.collectionPolicy == 'Collect' ? true : !has(self.collect)",message="collect is forbidden when collectionPolicy is not Collect"
// +kubebuilder:validation:XValidation:rule="has(self.collectionPolicy) && self.collectionPolicy == 'Collect' ? true : !has(self.collect)",message="collect may be set when collectionPolicy is Collect, and forbidden otherwise"
// +union
type NodeExporterCollectorNetClassConfig struct {
// collectionPolicy declares whether the netclass collector collects metrics.
Expand Down Expand Up @@ -642,7 +652,7 @@ type NodeExporterCollectorProcessesConfig struct {
// cardinality. If you enable this collector, closely monitor the prometheus-k8s deployment
// for excessive memory usage.
// When collectionPolicy is DoNotCollect, the collect field must not be set.
// +kubebuilder:validation:XValidation:rule="has(self.collectionPolicy) && self.collectionPolicy == 'Collect' ? true : !has(self.collect)",message="collect is forbidden when collectionPolicy is not Collect"
// +kubebuilder:validation:XValidation:rule="has(self.collectionPolicy) && self.collectionPolicy == 'Collect' ? true : !has(self.collect)",message="collect may be set when collectionPolicy is Collect, and forbidden otherwise"
// +union
type NodeExporterCollectorSystemdConfig struct {
// collectionPolicy declares whether the systemd collector collects metrics.
Expand Down Expand Up @@ -732,6 +742,69 @@ type NodeExporterCollectorZoneinfoConfig struct {
CollectionPolicy NodeExporterCollectorCollectionPolicy `json:"collectionPolicy,omitempty"`
}


// NodeExporterCollectorInterruptsConfig provides configuration for the interrupts collector
// of the node-exporter agent. The interrupts collector exposes interrupt counts
// from /proc/interrupts.
// It is disabled by default.
// The interrupts collector can produce a large number of metrics depending on the hardware
// and interrupt sources present. When enabled, use the collect.include list to filter
// which interrupt lines are collected.
// When collectionPolicy is DoNotCollect, the collect field must not be set.
// +kubebuilder:validation:XValidation:rule="has(self.collectionPolicy) && self.collectionPolicy == 'Collect' ? true : !has(self.collect)",message="collect may be set when collectionPolicy is Collect, and forbidden otherwise"
// +union
type NodeExporterCollectorInterruptsConfig struct {
// collectionPolicy declares whether the interrupts collector collects metrics.
// This field is required.
// Valid values are "Collect" and "DoNotCollect".
// When set to "Collect", the interrupts collector is active and interrupt statistics are collected.
// When set to "DoNotCollect", the interrupts collector is inactive and the collect field must not be set.
// +unionDiscriminator
// +required
CollectionPolicy NodeExporterCollectorCollectionPolicy `json:"collectionPolicy,omitempty"`
// collect contains configuration options that apply only when the interrupts collector is actively collecting metrics
// (i.e. when collectionPolicy is Collect).
// collect is optional and may be omitted even when collectionPolicy is Collect.
Comment thread
midu16 marked this conversation as resolved.
// When omitted and collectionPolicy is Collect, all interrupt lines are collected without filtering.
// collect may only be set when collectionPolicy is Collect.
// When set, at least one field must be specified within collect.
// +unionMember
// +optional
Collect NodeExporterCollectorInterruptsCollectConfig `json:"collect,omitzero,omitempty"`
Comment thread
qodo-for-rh-openshift[bot] marked this conversation as resolved.
}

// NodeExporterCollectorInterruptsCollectConfig holds configuration options for the interrupts collector
// when it is actively collecting metrics. At least one field must be specified.
// +kubebuilder:validation:MinProperties=1
type NodeExporterCollectorInterruptsCollectConfig struct {
// include is a list of regular expression patterns that select which interrupt lines to collect.
// include is optional.
// Each line in /proc/interrupts is matched against the same string node-exporter uses:
// the IRQ name, info, and devices fields joined with ";", for example "LOC;77;IO-APIC 2-edge ...".
// Patterns are combined with OR into a single expression anchored on both ends,
// so each pattern must match the entire string (use ".*" where needed).
// Omitting include collects all interrupt lines.
// Each entry must be at least 1 character and at most 1024 characters.
// Maximum length for this list is 50.
// Minimum length for this list is 1.
// Entries in this list must be unique.
// +kubebuilder:validation:MaxItems=50
// +kubebuilder:validation:MinItems=1
// +listType=set
// +optional
Include []NodeExporterInterruptsIncludePattern `json:"include,omitempty"`
}

// NodeExporterInterruptsIncludePattern is a string that is interpreted as a Go regular expression
// pattern by the controller to match interrupt line names.
// Invalid regular expressions will cause a controller-level error at runtime.
// Must be at least 1 character and at most 1024 characters.
// Must contain only printable ASCII characters (no control characters).
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=1024
// +kubebuilder:validation:Pattern=`^[\x20-\x7E]+$`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something I had missed but the linter caught - this should be a CEL validation as it allows us to return a more user-friendly error message as opposed to returning the raw regular expression used for validation.

Please do this.

type NodeExporterInterruptsIncludePattern string
Comment thread
everettraven marked this conversation as resolved.

// MonitoringPluginConfig provides configuration options for the monitoring plugin
// that runs as a dynamic plugin of the OpenShift web console.
// The monitoring plugin provides the monitoring UI in the OpenShift web console
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2206,6 +2206,75 @@ spec:
required:
- collectionPolicy
type: object
interrupts:
description: |-
interrupts configures the interrupts collector, which exposes interrupt counts
from /proc/interrupts.
interrupts is optional.
When omitted, this means no opinion and the platform is left to choose a reasonable default,
which is subject to change over time. The current default is disabled.
The interrupts collector can produce a large number of metrics depending on the hardware
and interrupt sources present. When enabled, use the collect.include list to filter
which interrupt lines are collected.
properties:
collect:
description: |-
collect contains configuration options that apply only when the interrupts collector is actively collecting metrics
(i.e. when collectionPolicy is Collect).
collect is optional and may be omitted even when collectionPolicy is Collect.
When omitted and collectionPolicy is Collect, all interrupt lines are collected without filtering.
collect may only be set when collectionPolicy is Collect.
When set, at least one field must be specified within collect.
minProperties: 1
properties:
include:
description: |-
include is a list of regular expression patterns that select which interrupt lines to collect.
include is optional.
Each line in /proc/interrupts is matched against the same string node-exporter uses:
the IRQ name, info, and devices fields joined with ";", for example "LOC;77;IO-APIC 2-edge ...".
Patterns are combined with OR into a single expression anchored on both ends,
so each pattern must match the entire string (use ".*" where needed).
Omitting include collects all interrupt lines.
Each entry must be at least 1 character and at most 1024 characters.
Maximum length for this list is 50.
Minimum length for this list is 1.
Entries in this list must be unique.
items:
description: |-
NodeExporterInterruptsIncludePattern is a string that is interpreted as a Go regular expression
pattern by the controller to match interrupt line names.
Invalid regular expressions will cause a controller-level error at runtime.
Must be at least 1 character and at most 1024 characters.
Must contain only printable ASCII characters (no control characters).
maxLength: 1024
minLength: 1
pattern: ^[\x20-\x7E]+$
type: string
maxItems: 50
minItems: 1
type: array
x-kubernetes-list-type: set
type: object
collectionPolicy:
description: |-
collectionPolicy declares whether the interrupts collector collects metrics.
This field is required.
Valid values are "Collect" and "DoNotCollect".
When set to "Collect", the interrupts collector is active and interrupt statistics are collected.
When set to "DoNotCollect", the interrupts collector is inactive and the collect field must not be set.
enum:
- Collect
- DoNotCollect
type: string
required:
- collectionPolicy
type: object
x-kubernetes-validations:
- message: collect may be set when collectionPolicy is Collect,
and forbidden otherwise
rule: 'has(self.collectionPolicy) && self.collectionPolicy
== ''Collect'' ? true : !has(self.collect)'
ksmd:
description: |-
ksmd configures the ksmd collector, which collects statistics from the kernel same-page
Expand Down Expand Up @@ -2300,8 +2369,8 @@ spec:
- collectionPolicy
type: object
x-kubernetes-validations:
- message: collect is forbidden when collectionPolicy is not
Collect
- message: collect may be set when collectionPolicy is Collect,
and forbidden otherwise
rule: 'has(self.collectionPolicy) && self.collectionPolicy
== ''Collect'' ? true : !has(self.collect)'
netDev:
Expand Down Expand Up @@ -2432,8 +2501,8 @@ spec:
- collectionPolicy
type: object
x-kubernetes-validations:
- message: collect is forbidden when collectionPolicy is not
Collect
- message: collect may be set when collectionPolicy is Collect,
and forbidden otherwise
rule: 'has(self.collectionPolicy) && self.collectionPolicy
== ''Collect'' ? true : !has(self.collect)'
tcpStat:
Expand Down
39 changes: 39 additions & 0 deletions config/v1alpha1/zz_generated.deepcopy.go

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

Loading