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 @@ -2037,6 +2037,11 @@ tests:
collectionPolicy: Collect
buddyInfo:
collectionPolicy: DoNotCollect
interrupts:
collectionPolicy: Collect
collect:
include:
- "LOC.*"
maxProcs: 4
ignoredNetworkDevices:
- "^veth.*$"
Expand All @@ -2055,6 +2060,11 @@ tests:
collectionPolicy: Collect
buddyInfo:
collectionPolicy: DoNotCollect
interrupts:
collectionPolicy: Collect
collect:
include:
- "LOC.*"
maxProcs: 4
ignoredNetworkDevices:
- "^veth.*$"
Expand Down Expand Up @@ -2165,7 +2175,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 +2205,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 Expand Up @@ -2288,6 +2298,138 @@ tests:
collectors:
softirqs: {}
expectedError: 'spec.nodeExporterConfig.collectors.softirqs.collectionPolicy: Required value'
- name: Should accept interrupts collector with Collect
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
nodeExporterConfig:
collectors:
interrupts:
collectionPolicy: Collect
expected: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
nodeExporterConfig:
collectors:
interrupts:
collectionPolicy: Collect
- name: Should accept interrupts collector with DoNotCollect
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
nodeExporterConfig:
collectors:
interrupts:
collectionPolicy: DoNotCollect
expected: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
nodeExporterConfig:
collectors:
interrupts:
collectionPolicy: DoNotCollect
- name: Should reject interrupts collector with invalid collectionPolicy
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
nodeExporterConfig:
collectors:
interrupts:
collectionPolicy: Invalid
expectedError: 'spec.nodeExporterConfig.collectors.interrupts.collectionPolicy: Unsupported value: "Invalid"'
- name: Should reject interrupts collector with empty collectionPolicy
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
nodeExporterConfig:
collectors:
interrupts: {}
expectedError: 'spec.nodeExporterConfig.collectors.interrupts.collectionPolicy: Required value'
- name: Should accept interrupts Collect with include list
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
nodeExporterConfig:
collectors:
interrupts:
collectionPolicy: Collect
collect:
include:
- "LOC.*"
- "NMI.*"
expected: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
nodeExporterConfig:
collectors:
interrupts:
collectionPolicy: Collect
collect:
include:
- "LOC.*"
- "NMI.*"
- name: Should accept interrupts Collect without collect field
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
nodeExporterConfig:
collectors:
interrupts:
collectionPolicy: Collect
expected: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
nodeExporterConfig:
collectors:
interrupts:
collectionPolicy: Collect
- name: Should reject interrupts with collect set when collector is DoNotCollect
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
nodeExporterConfig:
collectors:
interrupts:
collectionPolicy: DoNotCollect
collect:
include:
- "LOC.*"
expectedError: 'collect may be set when collectionPolicy is Collect, and forbidden otherwise'
- name: Should reject interrupts collect with empty object
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
nodeExporterConfig:
collectors:
interrupts:
collectionPolicy: Collect
collect: {}
expectedError: 'spec.nodeExporterConfig.collectors.interrupts.collect: Invalid value: 0: spec.nodeExporterConfig.collectors.interrupts.collect in body should have at least 1 properties'
- name: Should reject interrupts include with control characters
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
nodeExporterConfig:
collectors:
interrupts:
collectionPolicy: Collect
collect:
include:
- "LOC\ttab"
expectedError: 'must contain only printable ASCII characters (no control characters)'
- name: Should reject NodeExporterConfig with zero request
initial: |
apiVersion: config.openshift.io/v1alpha1
Expand Down
76 changes: 74 additions & 2 deletions config/v1alpha1/types_cluster_monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,16 @@ type NodeExporterCollectorConfig struct {
// which is subject to change over time. The current default is enabled.
// +optional
NVMExpressSubsystem NodeExporterCollectorNVMExpressSubsystemConfig `json:"nvmExpressSubsystem,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 @@ -548,7 +558,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 @@ -649,7 +659,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 @@ -753,6 +763,68 @@ type NodeExporterCollectorNVMExpressSubsystemConfig 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:XValidation:rule="self.matches('^[\\\\x20-\\\\x7E]+$')",message="must contain only printable ASCII characters (no control characters)"
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
Loading