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 <dmellado@fedoraproject.org>
Copy file name to clipboardExpand all lines: config/v1alpha1/tests/clustermonitorings.config.openshift.io/ClusterMonitoringConfig.yaml
+231Lines changed: 231 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -577,3 +577,234 @@ tests:
577
577
prometheusOperatorAdmissionWebhookConfig:
578
578
resources: []
579
579
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 NodeExporterConfig with valid resources
581
+
initial: |
582
+
apiVersion: config.openshift.io/v1alpha1
583
+
kind: ClusterMonitoring
584
+
spec:
585
+
nodeExporterConfig:
586
+
resources:
587
+
- name: "cpu"
588
+
request: "50m"
589
+
limit: "200m"
590
+
- name: "memory"
591
+
request: "50Mi"
592
+
limit: "200Mi"
593
+
expected: |
594
+
apiVersion: config.openshift.io/v1alpha1
595
+
kind: ClusterMonitoring
596
+
spec:
597
+
nodeExporterConfig:
598
+
resources:
599
+
- name: "cpu"
600
+
request: "50m"
601
+
limit: "200m"
602
+
- name: "memory"
603
+
request: "50Mi"
604
+
limit: "200Mi"
605
+
- name: Should be able to create NodeExporterConfig with valid tolerations
606
+
initial: |
607
+
apiVersion: config.openshift.io/v1alpha1
608
+
kind: ClusterMonitoring
609
+
spec:
610
+
nodeExporterConfig:
611
+
tolerations:
612
+
- operator: "Exists"
613
+
expected: |
614
+
apiVersion: config.openshift.io/v1alpha1
615
+
kind: ClusterMonitoring
616
+
spec:
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
662
+
initial: |
663
+
apiVersion: config.openshift.io/v1alpha1
664
+
kind: ClusterMonitoring
665
+
spec:
666
+
nodeExporterConfig:
667
+
nodeSelector:
668
+
kubernetes.io/os: linux
669
+
resources:
670
+
- name: "cpu"
671
+
request: "50m"
672
+
limit: "200m"
673
+
tolerations:
674
+
- operator: "Exists"
675
+
collectors:
676
+
cpuFreq:
677
+
enabled: Enabled
678
+
buddyInfo:
679
+
enabled: Disabled
680
+
maxProcs: 4
681
+
ignoredNetworkDevices:
682
+
- "^veth.*$"
683
+
- "^docker.*$"
684
+
expected: |
685
+
apiVersion: config.openshift.io/v1alpha1
686
+
kind: ClusterMonitoring
687
+
spec:
688
+
nodeExporterConfig:
689
+
nodeSelector:
690
+
kubernetes.io/os: linux
691
+
resources:
692
+
- name: "cpu"
693
+
request: "50m"
694
+
limit: "200m"
695
+
tolerations:
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
707
+
initial: |
708
+
apiVersion: config.openshift.io/v1alpha1
709
+
kind: ClusterMonitoring
710
+
spec:
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
714
+
initial: |
715
+
apiVersion: config.openshift.io/v1alpha1
716
+
kind: ClusterMonitoring
717
+
spec:
718
+
nodeExporterConfig:
719
+
resources:
720
+
- name: "cpu"
721
+
request: "100m"
722
+
- name: "memory"
723
+
request: "64Mi"
724
+
- name: "hugepages-2Mi"
725
+
request: "32Mi"
726
+
- name: "hugepages-1Gi"
727
+
request: "1Gi"
728
+
- name: "ephemeral-storage"
729
+
request: "1Gi"
730
+
- name: "nvidia.com/gpu"
731
+
request: "1"
732
+
- name: "example.com/foo"
733
+
request: "1"
734
+
- name: "example.com/bar"
735
+
request: "1"
736
+
- name: "example.com/baz"
737
+
request: "1"
738
+
- name: "example.com/qux"
739
+
request: "1"
740
+
- name: "example.com/quux"
741
+
request: "1"
742
+
expectedError: 'spec.nodeExporterConfig.resources: Too many: 11: must have at most 10 items'
743
+
- name: Should reject NodeExporterConfig with duplicate resource names
0 commit comments