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-4035: Add ThanosQuerierConfig to ClusterMonitoring API
Migrate the thanos-querier configmap settings to a CRD field within
ClusterMonitoringSpec in config/v1alpha1. The new ThanosQuerierConfig
struct supports:
- nodeSelector: pod scheduling to specific nodes
- resources: compute resource requests and limits
- tolerations: pod tolerations for scheduling
- topologySpreadConstraints: pod distribution across topology domains
Also removes per-field positive-quantity CEL checks from
ContainerResource request/limit fields to stay within the Kubernetes
CRD CEL validation cost budget (StaticEstimatedCRDCostLimit) with
7 component configs at MaxItems=10.
Signed-off-by: Daniel Mellado <dmellado@fedoraproject.org>
expectedError: 'spec.alertmanagerConfig.customConfig.resources[0].request: Invalid value: "": spec.alertmanagerConfig.customConfig.resources[0].request in body should be at least 1 chars long'
99
-
- name: Should reject ContainerResource request with non-positive quantity
100
-
initial: |
101
-
apiVersion: config.openshift.io/v1alpha1
102
-
kind: ClusterMonitoring
103
-
spec:
104
-
userDefined:
105
-
mode: "Disabled"
106
-
alertmanagerConfig:
107
-
deploymentMode: "CustomConfig"
108
-
customConfig:
109
-
resources:
110
-
- name: "cpu"
111
-
request: "0"
112
-
expectedError: 'spec.alertmanagerConfig.customConfig.resources[0].request: Invalid value: "": request must be a positive, non-zero quantity'
113
99
- name: Should reject ContainerResource limit with MaxLength violation
114
100
initial: |
115
101
apiVersion: config.openshift.io/v1alpha1
@@ -138,20 +124,6 @@ tests:
138
124
- name: "cpu"
139
125
limit: ""
140
126
expectedError: 'spec.alertmanagerConfig.customConfig.resources[0].limit: Invalid value: "": spec.alertmanagerConfig.customConfig.resources[0].limit in body should be at least 1 chars long'
141
-
- name: Should reject ContainerResource limit with non-positive quantity
142
-
initial: |
143
-
apiVersion: config.openshift.io/v1alpha1
144
-
kind: ClusterMonitoring
145
-
spec:
146
-
userDefined:
147
-
mode: "Disabled"
148
-
alertmanagerConfig:
149
-
deploymentMode: "CustomConfig"
150
-
customConfig:
151
-
resources:
152
-
- name: "cpu"
153
-
limit: "0"
154
-
expectedError: 'spec.alertmanagerConfig.customConfig.resources[0].limit: Invalid value: "": limit must be a positive, non-zero quantity'
155
127
- name: Should reject ContainerResource name with MaxLength violation
156
128
initial: |
157
129
apiVersion: config.openshift.io/v1alpha1
@@ -815,3 +787,348 @@ tests:
815
787
topologyKey: topology.kubernetes.io/zone
816
788
whenUnsatisfiable: DoNotSchedule
817
789
expectedError: "Duplicate value"
790
+
- name: Should be able to create ThanosQuerierConfig with valid resources
791
+
initial: |
792
+
apiVersion: config.openshift.io/v1alpha1
793
+
kind: ClusterMonitoring
794
+
spec:
795
+
thanosQuerierConfig:
796
+
resources:
797
+
- name: "cpu"
798
+
request: "5m"
799
+
limit: "200m"
800
+
- name: "memory"
801
+
request: "12Mi"
802
+
limit: "200Mi"
803
+
expected: |
804
+
apiVersion: config.openshift.io/v1alpha1
805
+
kind: ClusterMonitoring
806
+
spec:
807
+
thanosQuerierConfig:
808
+
resources:
809
+
- name: "cpu"
810
+
request: "5m"
811
+
limit: "200m"
812
+
- name: "memory"
813
+
request: "12Mi"
814
+
limit: "200Mi"
815
+
- name: Should be able to create ThanosQuerierConfig with valid tolerations
816
+
initial: |
817
+
apiVersion: config.openshift.io/v1alpha1
818
+
kind: ClusterMonitoring
819
+
spec:
820
+
thanosQuerierConfig:
821
+
tolerations:
822
+
- key: "node-role.kubernetes.io/infra"
823
+
operator: "Exists"
824
+
effect: "NoSchedule"
825
+
expected: |
826
+
apiVersion: config.openshift.io/v1alpha1
827
+
kind: ClusterMonitoring
828
+
spec:
829
+
thanosQuerierConfig:
830
+
tolerations:
831
+
- key: "node-role.kubernetes.io/infra"
832
+
operator: "Exists"
833
+
effect: "NoSchedule"
834
+
- name: Should be able to create ThanosQuerierConfig with valid topologySpreadConstraints
835
+
initial: |
836
+
apiVersion: config.openshift.io/v1alpha1
837
+
kind: ClusterMonitoring
838
+
spec:
839
+
thanosQuerierConfig:
840
+
topologySpreadConstraints:
841
+
- maxSkew: 1
842
+
topologyKey: topology.kubernetes.io/zone
843
+
whenUnsatisfiable: DoNotSchedule
844
+
labelSelector:
845
+
matchLabels:
846
+
app: thanos-querier
847
+
- maxSkew: 2
848
+
topologyKey: kubernetes.io/hostname
849
+
whenUnsatisfiable: ScheduleAnyway
850
+
labelSelector:
851
+
matchLabels:
852
+
app: thanos-querier
853
+
expected: |
854
+
apiVersion: config.openshift.io/v1alpha1
855
+
kind: ClusterMonitoring
856
+
spec:
857
+
thanosQuerierConfig:
858
+
topologySpreadConstraints:
859
+
- maxSkew: 1
860
+
topologyKey: topology.kubernetes.io/zone
861
+
whenUnsatisfiable: DoNotSchedule
862
+
labelSelector:
863
+
matchLabels:
864
+
app: thanos-querier
865
+
- maxSkew: 2
866
+
topologyKey: kubernetes.io/hostname
867
+
whenUnsatisfiable: ScheduleAnyway
868
+
labelSelector:
869
+
matchLabels:
870
+
app: thanos-querier
871
+
- name: Should be able to create ThanosQuerierConfig with all fields
872
+
initial: |
873
+
apiVersion: config.openshift.io/v1alpha1
874
+
kind: ClusterMonitoring
875
+
spec:
876
+
thanosQuerierConfig:
877
+
nodeSelector:
878
+
kubernetes.io/os: linux
879
+
resources:
880
+
- name: "cpu"
881
+
request: "5m"
882
+
- name: "memory"
883
+
request: "12Mi"
884
+
tolerations:
885
+
- key: "node-role.kubernetes.io/infra"
886
+
operator: "Exists"
887
+
effect: "NoSchedule"
888
+
topologySpreadConstraints:
889
+
- maxSkew: 1
890
+
topologyKey: topology.kubernetes.io/zone
891
+
whenUnsatisfiable: DoNotSchedule
892
+
expected: |
893
+
apiVersion: config.openshift.io/v1alpha1
894
+
kind: ClusterMonitoring
895
+
spec:
896
+
thanosQuerierConfig:
897
+
nodeSelector:
898
+
kubernetes.io/os: linux
899
+
resources:
900
+
- name: "cpu"
901
+
request: "5m"
902
+
- name: "memory"
903
+
request: "12Mi"
904
+
tolerations:
905
+
- key: "node-role.kubernetes.io/infra"
906
+
operator: "Exists"
907
+
effect: "NoSchedule"
908
+
topologySpreadConstraints:
909
+
- maxSkew: 1
910
+
topologyKey: topology.kubernetes.io/zone
911
+
whenUnsatisfiable: DoNotSchedule
912
+
- name: Should reject ThanosQuerierConfig with empty object
913
+
initial: |
914
+
apiVersion: config.openshift.io/v1alpha1
915
+
kind: ClusterMonitoring
916
+
spec:
917
+
thanosQuerierConfig: {}
918
+
expectedError: 'spec.thanosQuerierConfig: Invalid value: 0: spec.thanosQuerierConfig in body should have at least 1 properties'
919
+
- name: Should reject ThanosQuerierConfig with duplicate resource names
- name: Should reject ThanosQuerierConfig with too many resources
932
+
initial: |
933
+
apiVersion: config.openshift.io/v1alpha1
934
+
kind: ClusterMonitoring
935
+
spec:
936
+
thanosQuerierConfig:
937
+
resources:
938
+
- name: "cpu"
939
+
request: "100m"
940
+
- name: "memory"
941
+
request: "64Mi"
942
+
- name: "hugepages-2Mi"
943
+
request: "32Mi"
944
+
- name: "hugepages-1Gi"
945
+
request: "1Gi"
946
+
- name: "ephemeral-storage"
947
+
request: "1Gi"
948
+
- name: "nvidia.com/gpu"
949
+
request: "1"
950
+
- name: "example.com/foo"
951
+
request: "1"
952
+
- name: "example.com/bar"
953
+
request: "1"
954
+
- name: "example.com/baz"
955
+
request: "1"
956
+
- name: "example.com/qux"
957
+
request: "1"
958
+
- name: "example.com/quux"
959
+
request: "1"
960
+
expectedError: 'spec.thanosQuerierConfig.resources: Too many: 11: must have at most 10 items'
961
+
- name: Should reject ThanosQuerierConfig with limit less than request
962
+
initial: |
963
+
apiVersion: config.openshift.io/v1alpha1
964
+
kind: ClusterMonitoring
965
+
spec:
966
+
thanosQuerierConfig:
967
+
resources:
968
+
- name: "cpu"
969
+
request: "500m"
970
+
limit: "200m"
971
+
expectedError: 'spec.thanosQuerierConfig.resources[0]: Invalid value: "object": limit must be greater than or equal to request'
972
+
- name: Should reject ThanosQuerierConfig with too many topologySpreadConstraints
973
+
initial: |
974
+
apiVersion: config.openshift.io/v1alpha1
975
+
kind: ClusterMonitoring
976
+
spec:
977
+
thanosQuerierConfig:
978
+
topologySpreadConstraints:
979
+
- maxSkew: 1
980
+
topologyKey: "zone1"
981
+
whenUnsatisfiable: DoNotSchedule
982
+
- maxSkew: 1
983
+
topologyKey: "zone2"
984
+
whenUnsatisfiable: DoNotSchedule
985
+
- maxSkew: 1
986
+
topologyKey: "zone3"
987
+
whenUnsatisfiable: DoNotSchedule
988
+
- maxSkew: 1
989
+
topologyKey: "zone4"
990
+
whenUnsatisfiable: DoNotSchedule
991
+
- maxSkew: 1
992
+
topologyKey: "zone5"
993
+
whenUnsatisfiable: DoNotSchedule
994
+
- maxSkew: 1
995
+
topologyKey: "zone6"
996
+
whenUnsatisfiable: DoNotSchedule
997
+
- maxSkew: 1
998
+
topologyKey: "zone7"
999
+
whenUnsatisfiable: DoNotSchedule
1000
+
- maxSkew: 1
1001
+
topologyKey: "zone8"
1002
+
whenUnsatisfiable: DoNotSchedule
1003
+
- maxSkew: 1
1004
+
topologyKey: "zone9"
1005
+
whenUnsatisfiable: DoNotSchedule
1006
+
- maxSkew: 1
1007
+
topologyKey: "zone10"
1008
+
whenUnsatisfiable: DoNotSchedule
1009
+
- maxSkew: 1
1010
+
topologyKey: "zone11"
1011
+
whenUnsatisfiable: DoNotSchedule
1012
+
expectedError: 'spec.thanosQuerierConfig.topologySpreadConstraints: Too many: 11: must have at most 10 items'
1013
+
- name: Should reject ThanosQuerierConfig with empty topologySpreadConstraints array
1014
+
initial: |
1015
+
apiVersion: config.openshift.io/v1alpha1
1016
+
kind: ClusterMonitoring
1017
+
spec:
1018
+
thanosQuerierConfig:
1019
+
topologySpreadConstraints: []
1020
+
expectedError: 'spec.thanosQuerierConfig.topologySpreadConstraints: Invalid value: 0: spec.thanosQuerierConfig.topologySpreadConstraints in body should have at least 1 items'
1021
+
- name: Should reject ThanosQuerierConfig with empty resources array
1022
+
initial: |
1023
+
apiVersion: config.openshift.io/v1alpha1
1024
+
kind: ClusterMonitoring
1025
+
spec:
1026
+
thanosQuerierConfig:
1027
+
resources: []
1028
+
expectedError: 'spec.thanosQuerierConfig.resources: Invalid value: 0: spec.thanosQuerierConfig.resources in body should have at least 1 items'
1029
+
- name: Should reject ThanosQuerierConfig with empty nodeSelector
1030
+
initial: |
1031
+
apiVersion: config.openshift.io/v1alpha1
1032
+
kind: ClusterMonitoring
1033
+
spec:
1034
+
thanosQuerierConfig:
1035
+
nodeSelector: {}
1036
+
expectedError: 'spec.thanosQuerierConfig.nodeSelector: Invalid value: 0: spec.thanosQuerierConfig.nodeSelector in body should have at least 1 properties'
1037
+
- name: Should reject ThanosQuerierConfig with more than 10 nodeSelector entries
1038
+
initial: |
1039
+
apiVersion: config.openshift.io/v1alpha1
1040
+
kind: ClusterMonitoring
1041
+
spec:
1042
+
thanosQuerierConfig:
1043
+
nodeSelector:
1044
+
key1: val1
1045
+
key2: val2
1046
+
key3: val3
1047
+
key4: val4
1048
+
key5: val5
1049
+
key6: val6
1050
+
key7: val7
1051
+
key8: val8
1052
+
key9: val9
1053
+
key10: val10
1054
+
key11: val11
1055
+
expectedError: 'spec.thanosQuerierConfig.nodeSelector: Too many: 11: must have at most 10 items'
1056
+
- name: Should reject ThanosQuerierConfig with empty tolerations array
1057
+
initial: |
1058
+
apiVersion: config.openshift.io/v1alpha1
1059
+
kind: ClusterMonitoring
1060
+
spec:
1061
+
thanosQuerierConfig:
1062
+
tolerations: []
1063
+
expectedError: 'spec.thanosQuerierConfig.tolerations: Invalid value: 0: spec.thanosQuerierConfig.tolerations in body should have at least 1 items'
1064
+
- name: Should reject ThanosQuerierConfig with more than 10 tolerations
1065
+
initial: |
1066
+
apiVersion: config.openshift.io/v1alpha1
1067
+
kind: ClusterMonitoring
1068
+
spec:
1069
+
thanosQuerierConfig:
1070
+
tolerations:
1071
+
- key: "key1"
1072
+
operator: "Exists"
1073
+
effect: "NoSchedule"
1074
+
- key: "key2"
1075
+
operator: "Exists"
1076
+
effect: "NoSchedule"
1077
+
- key: "key3"
1078
+
operator: "Exists"
1079
+
effect: "NoSchedule"
1080
+
- key: "key4"
1081
+
operator: "Exists"
1082
+
effect: "NoSchedule"
1083
+
- key: "key5"
1084
+
operator: "Exists"
1085
+
effect: "NoSchedule"
1086
+
- key: "key6"
1087
+
operator: "Exists"
1088
+
effect: "NoSchedule"
1089
+
- key: "key7"
1090
+
operator: "Exists"
1091
+
effect: "NoSchedule"
1092
+
- key: "key8"
1093
+
operator: "Exists"
1094
+
effect: "NoSchedule"
1095
+
- key: "key9"
1096
+
operator: "Exists"
1097
+
effect: "NoSchedule"
1098
+
- key: "key10"
1099
+
operator: "Exists"
1100
+
effect: "NoSchedule"
1101
+
- key: "key11"
1102
+
operator: "Exists"
1103
+
effect: "NoSchedule"
1104
+
expectedError: 'spec.thanosQuerierConfig.tolerations: Too many: 11: must have at most 10 items'
1105
+
- name: Should reject ThanosQuerierConfig with duplicate topologySpreadConstraints
1106
+
initial: |
1107
+
apiVersion: config.openshift.io/v1alpha1
1108
+
kind: ClusterMonitoring
1109
+
spec:
1110
+
thanosQuerierConfig:
1111
+
topologySpreadConstraints:
1112
+
- maxSkew: 1
1113
+
topologyKey: topology.kubernetes.io/zone
1114
+
whenUnsatisfiable: DoNotSchedule
1115
+
- maxSkew: 2
1116
+
topologyKey: topology.kubernetes.io/zone
1117
+
whenUnsatisfiable: DoNotSchedule
1118
+
expectedError: "Duplicate value"
1119
+
onUpdate:
1120
+
- name: Should reject updating ThanosQuerierConfig to empty object
1121
+
initial: |
1122
+
apiVersion: config.openshift.io/v1alpha1
1123
+
kind: ClusterMonitoring
1124
+
spec:
1125
+
thanosQuerierConfig:
1126
+
resources:
1127
+
- name: "cpu"
1128
+
request: "5m"
1129
+
updated: |
1130
+
apiVersion: config.openshift.io/v1alpha1
1131
+
kind: ClusterMonitoring
1132
+
spec:
1133
+
thanosQuerierConfig: {}
1134
+
expectedError: 'spec.thanosQuerierConfig: Invalid value: 0: spec.thanosQuerierConfig in body should have at least 1 properties'
0 commit comments