You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MON-4036: Add NodeExporterConfig to ClusterMonitoring API
Add NodeExporterConfig to ClusterMonitoringSpec with support
for nodeSelector, resources, tolerations, collectors (10
individual toggles with per-collector options), maxProcs,
and ignoredNetworkDevices.
Signed-off-by: Daniel Mellado <[email protected]>
expectedError: 'spec.prometheusOperatorAdmissionWebhookConfig.resources: Invalid value: 0: spec.prometheusOperatorAdmissionWebhookConfig.resources in body should have at least 1 items'
580
-
- name: Should be able to create OpenShiftStateMetricsConfig with valid resources
580
+
- name: Should be able to create NodeExporterConfig with valid resources
581
581
initial: |
582
582
apiVersion: config.openshift.io/v1alpha1
583
583
kind: ClusterMonitoring
584
584
spec:
585
-
openShiftStateMetricsConfig:
585
+
nodeExporterConfig:
586
586
resources:
587
587
- name: "cpu"
588
588
request: "50m"
@@ -594,109 +594,128 @@ tests:
594
594
apiVersion: config.openshift.io/v1alpha1
595
595
kind: ClusterMonitoring
596
596
spec:
597
-
openShiftStateMetricsConfig:
597
+
nodeExporterConfig:
598
598
resources:
599
599
- name: "cpu"
600
600
request: "50m"
601
601
limit: "200m"
602
602
- name: "memory"
603
603
request: "50Mi"
604
604
limit: "200Mi"
605
-
- name: Should be able to create OpenShiftStateMetricsConfig with valid topologySpreadConstraints
605
+
- name: Should be able to create NodeExporterConfig with valid tolerations
606
606
initial: |
607
607
apiVersion: config.openshift.io/v1alpha1
608
608
kind: ClusterMonitoring
609
609
spec:
610
-
openShiftStateMetricsConfig:
611
-
topologySpreadConstraints:
612
-
- maxSkew: 1
613
-
topologyKey: topology.kubernetes.io/zone
614
-
whenUnsatisfiable: DoNotSchedule
615
-
labelSelector:
616
-
matchLabels:
617
-
app: openshift-state-metrics
618
-
- maxSkew: 2
619
-
topologyKey: kubernetes.io/hostname
620
-
whenUnsatisfiable: ScheduleAnyway
621
-
labelSelector:
622
-
matchLabels:
623
-
app: openshift-state-metrics
610
+
nodeExporterConfig:
611
+
tolerations:
612
+
- operator: "Exists"
624
613
expected: |
625
614
apiVersion: config.openshift.io/v1alpha1
626
615
kind: ClusterMonitoring
627
616
spec:
628
-
openShiftStateMetricsConfig:
629
-
topologySpreadConstraints:
630
-
- maxSkew: 1
631
-
topologyKey: topology.kubernetes.io/zone
632
-
whenUnsatisfiable: DoNotSchedule
633
-
labelSelector:
634
-
matchLabels:
635
-
app: openshift-state-metrics
636
-
- maxSkew: 2
637
-
topologyKey: kubernetes.io/hostname
638
-
whenUnsatisfiable: ScheduleAnyway
639
-
labelSelector:
640
-
matchLabels:
641
-
app: openshift-state-metrics
642
-
- name: Should be able to create OpenShiftStateMetricsConfig with all fields
617
+
nodeExporterConfig:
618
+
tolerations:
619
+
- operator: "Exists"
620
+
- name: Should be able to create NodeExporterConfig with collectors
621
+
initial: |
622
+
apiVersion: config.openshift.io/v1alpha1
623
+
kind: ClusterMonitoring
624
+
spec:
625
+
nodeExporterConfig:
626
+
collectors:
627
+
cpuFreq:
628
+
enabled: Enabled
629
+
tcpStat:
630
+
enabled: Disabled
631
+
netDev:
632
+
enabled: Enabled
633
+
netClass:
634
+
enabled: Enabled
635
+
useNetlink: Enabled
636
+
systemd:
637
+
enabled: Enabled
638
+
units:
639
+
- "kubelet.service"
640
+
- "crio.service"
641
+
expected: |
642
+
apiVersion: config.openshift.io/v1alpha1
643
+
kind: ClusterMonitoring
644
+
spec:
645
+
nodeExporterConfig:
646
+
collectors:
647
+
cpuFreq:
648
+
enabled: Enabled
649
+
tcpStat:
650
+
enabled: Disabled
651
+
netDev:
652
+
enabled: Enabled
653
+
netClass:
654
+
enabled: Enabled
655
+
useNetlink: Enabled
656
+
systemd:
657
+
enabled: Enabled
658
+
units:
659
+
- "kubelet.service"
660
+
- "crio.service"
661
+
- name: Should be able to create NodeExporterConfig with all fields
643
662
initial: |
644
663
apiVersion: config.openshift.io/v1alpha1
645
664
kind: ClusterMonitoring
646
665
spec:
647
-
openShiftStateMetricsConfig:
666
+
nodeExporterConfig:
648
667
nodeSelector:
649
668
kubernetes.io/os: linux
650
669
resources:
651
670
- name: "cpu"
652
671
request: "50m"
653
672
limit: "200m"
654
673
tolerations:
655
-
- key: "node-role.kubernetes.io/infra"
656
-
operator: "Exists"
657
-
effect: "NoSchedule"
658
-
topologySpreadConstraints:
659
-
- maxSkew: 1
660
-
topologyKey: topology.kubernetes.io/zone
661
-
whenUnsatisfiable: DoNotSchedule
662
-
labelSelector:
663
-
matchLabels:
664
-
app: openshift-state-metrics
674
+
- operator: "Exists"
675
+
collectors:
676
+
cpuFreq:
677
+
enabled: Enabled
678
+
buddyInfo:
679
+
enabled: Disabled
680
+
maxProcs: 4
681
+
ignoredNetworkDevices:
682
+
- "^veth.*$"
683
+
- "^docker.*$"
665
684
expected: |
666
685
apiVersion: config.openshift.io/v1alpha1
667
686
kind: ClusterMonitoring
668
687
spec:
669
-
openShiftStateMetricsConfig:
688
+
nodeExporterConfig:
670
689
nodeSelector:
671
690
kubernetes.io/os: linux
672
691
resources:
673
692
- name: "cpu"
674
693
request: "50m"
675
694
limit: "200m"
676
695
tolerations:
677
-
- key: "node-role.kubernetes.io/infra"
678
-
operator: "Exists"
679
-
effect: "NoSchedule"
680
-
topologySpreadConstraints:
681
-
- maxSkew: 1
682
-
topologyKey: topology.kubernetes.io/zone
683
-
whenUnsatisfiable: DoNotSchedule
684
-
labelSelector:
685
-
matchLabels:
686
-
app: openshift-state-metrics
687
-
- name: Should reject OpenShiftStateMetricsConfig with empty object
696
+
- operator: "Exists"
697
+
collectors:
698
+
cpuFreq:
699
+
enabled: Enabled
700
+
buddyInfo:
701
+
enabled: Disabled
702
+
maxProcs: 4
703
+
ignoredNetworkDevices:
704
+
- "^veth.*$"
705
+
- "^docker.*$"
706
+
- name: Should reject NodeExporterConfig with empty object
688
707
initial: |
689
708
apiVersion: config.openshift.io/v1alpha1
690
709
kind: ClusterMonitoring
691
710
spec:
692
-
openShiftStateMetricsConfig: {}
693
-
expectedError: 'spec.openShiftStateMetricsConfig: Invalid value: 0: spec.openShiftStateMetricsConfig in body should have at least 1 properties'
694
-
- name: Should reject OpenShiftStateMetricsConfig with too many resources
711
+
nodeExporterConfig: {}
712
+
expectedError: 'spec.nodeExporterConfig: Invalid value: 0: spec.nodeExporterConfig in body should have at least 1 properties'
713
+
- name: Should reject NodeExporterConfig with too many resources
695
714
initial: |
696
715
apiVersion: config.openshift.io/v1alpha1
697
716
kind: ClusterMonitoring
698
717
spec:
699
-
openShiftStateMetricsConfig:
718
+
nodeExporterConfig:
700
719
resources:
701
720
- name: "cpu"
702
721
request: "100m"
@@ -720,98 +739,72 @@ tests:
720
739
request: "1"
721
740
- name: "example.com/quux"
722
741
request: "1"
723
-
expectedError: 'spec.openShiftStateMetricsConfig.resources: Too many: 11: must have at most 10 items'
724
-
- name: Should reject OpenShiftStateMetricsConfig with limit less than request
742
+
expectedError: 'spec.nodeExporterConfig.resources: Too many: 11: must have at most 10 items'
743
+
- name: Should reject NodeExporterConfig with duplicate resource names
- name: Should reject NodeExporterConfig with limit less than request
756
+
initial: |
757
+
apiVersion: config.openshift.io/v1alpha1
758
+
kind: ClusterMonitoring
759
+
spec:
760
+
nodeExporterConfig:
730
761
resources:
731
762
- name: "cpu"
732
763
request: "500m"
733
764
limit: "200m"
734
-
expectedError: 'spec.openShiftStateMetricsConfig.resources[0]: Invalid value: "object": limit must be greater than or equal to request'
735
-
- name: Should reject OpenShiftStateMetricsConfig with too many topologySpreadConstraints
765
+
expectedError: 'spec.nodeExporterConfig.resources[0]: Invalid value: "object": limit must be greater than or equal to request'
766
+
- name: Should reject NodeExporterConfig with empty resources array
736
767
initial: |
737
768
apiVersion: config.openshift.io/v1alpha1
738
769
kind: ClusterMonitoring
739
770
spec:
740
-
openShiftStateMetricsConfig:
741
-
topologySpreadConstraints:
742
-
- maxSkew: 1
743
-
topologyKey: "zone1"
744
-
whenUnsatisfiable: DoNotSchedule
745
-
- maxSkew: 1
746
-
topologyKey: "zone2"
747
-
whenUnsatisfiable: DoNotSchedule
748
-
- maxSkew: 1
749
-
topologyKey: "zone3"
750
-
whenUnsatisfiable: DoNotSchedule
751
-
- maxSkew: 1
752
-
topologyKey: "zone4"
753
-
whenUnsatisfiable: DoNotSchedule
754
-
- maxSkew: 1
755
-
topologyKey: "zone5"
756
-
whenUnsatisfiable: DoNotSchedule
757
-
- maxSkew: 1
758
-
topologyKey: "zone6"
759
-
whenUnsatisfiable: DoNotSchedule
760
-
- maxSkew: 1
761
-
topologyKey: "zone7"
762
-
whenUnsatisfiable: DoNotSchedule
763
-
- maxSkew: 1
764
-
topologyKey: "zone8"
765
-
whenUnsatisfiable: DoNotSchedule
766
-
- maxSkew: 1
767
-
topologyKey: "zone9"
768
-
whenUnsatisfiable: DoNotSchedule
769
-
- maxSkew: 1
770
-
topologyKey: "zone10"
771
-
whenUnsatisfiable: DoNotSchedule
772
-
- maxSkew: 1
773
-
topologyKey: "zone11"
774
-
whenUnsatisfiable: DoNotSchedule
775
-
expectedError: 'spec.openShiftStateMetricsConfig.topologySpreadConstraints: Too many: 11: must have at most 10 items'
776
-
- name: Should reject OpenShiftStateMetricsConfig with empty resources array
771
+
nodeExporterConfig:
772
+
resources: []
773
+
expectedError: 'spec.nodeExporterConfig.resources: Invalid value: 0: spec.nodeExporterConfig.resources in body should have at least 1 items'
774
+
- name: Should reject NodeExporterConfig with empty collectors object
777
775
initial: |
778
776
apiVersion: config.openshift.io/v1alpha1
779
777
kind: ClusterMonitoring
780
778
spec:
781
-
openShiftStateMetricsConfig:
782
-
resources: []
783
-
expectedError: 'spec.openShiftStateMetricsConfig.resources: Invalid value: 0: spec.openShiftStateMetricsConfig.resources in body should have at least 1 items'
784
-
- name: Should reject OpenShiftStateMetricsConfig with empty topologySpreadConstraints array
779
+
nodeExporterConfig:
780
+
collectors: {}
781
+
expectedError: 'spec.nodeExporterConfig.collectors: Invalid value: 0: spec.nodeExporterConfig.collectors in body should have at least 1 properties'
782
+
- name: Should accept NodeExporterConfig with empty ignoredNetworkDevices list
785
783
initial: |
786
784
apiVersion: config.openshift.io/v1alpha1
787
785
kind: ClusterMonitoring
788
786
spec:
789
-
openShiftStateMetricsConfig:
790
-
topologySpreadConstraints: []
791
-
expectedError: 'spec.openShiftStateMetricsConfig.topologySpreadConstraints: Invalid value: 0: spec.openShiftStateMetricsConfig.topologySpreadConstraints in body should have at least 1 items'
792
-
- name: Should reject OpenShiftStateMetricsConfig with duplicate resource names
787
+
nodeExporterConfig:
788
+
ignoredNetworkDevices: []
789
+
expected: |
790
+
apiVersion: config.openshift.io/v1alpha1
791
+
kind: ClusterMonitoring
792
+
spec:
793
+
nodeExporterConfig:
794
+
ignoredNetworkDevices: []
795
+
- name: Should reject NodeExporterConfig with maxProcs below minimum
0 commit comments