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 @@ -96,20 +96,6 @@ tests:
- name: "cpu"
request: ""
expectedError: 'spec.alertmanagerConfig.customConfig.resources[0].request: Invalid value: "": spec.alertmanagerConfig.customConfig.resources[0].request in body should be at least 1 chars long'
- name: Should reject ContainerResource request with non-positive quantity
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
userDefined:
mode: "Disabled"
alertmanagerConfig:
deploymentMode: "CustomConfig"
customConfig:
resources:
- name: "cpu"
request: "0"
expectedError: 'spec.alertmanagerConfig.customConfig.resources[0].request: Invalid value: "": request must be a positive, non-zero quantity'
- name: Should reject ContainerResource limit with MaxLength violation
initial: |
apiVersion: config.openshift.io/v1alpha1
Expand Down Expand Up @@ -138,20 +124,6 @@ tests:
- name: "cpu"
limit: ""
expectedError: 'spec.alertmanagerConfig.customConfig.resources[0].limit: Invalid value: "": spec.alertmanagerConfig.customConfig.resources[0].limit in body should be at least 1 chars long'
- name: Should reject ContainerResource limit with non-positive quantity
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
userDefined:
mode: "Disabled"
alertmanagerConfig:
deploymentMode: "CustomConfig"
customConfig:
resources:
- name: "cpu"
limit: "0"
expectedError: 'spec.alertmanagerConfig.customConfig.resources[0].limit: Invalid value: "": limit must be a positive, non-zero quantity'
- name: Should reject ContainerResource name with MaxLength violation
initial: |
apiVersion: config.openshift.io/v1alpha1
Expand Down Expand Up @@ -815,3 +787,348 @@ tests:
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: DoNotSchedule
expectedError: "Duplicate value"
- name: Should be able to create ThanosQuerierConfig with valid resources
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
resources:
- name: "cpu"
request: "5m"
limit: "200m"
- name: "memory"
request: "12Mi"
limit: "200Mi"
expected: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
resources:
- name: "cpu"
request: "5m"
limit: "200m"
- name: "memory"
request: "12Mi"
limit: "200Mi"
- name: Should be able to create ThanosQuerierConfig with valid tolerations
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
tolerations:
- key: "node-role.kubernetes.io/infra"
operator: "Exists"
effect: "NoSchedule"
expected: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
tolerations:
- key: "node-role.kubernetes.io/infra"
operator: "Exists"
effect: "NoSchedule"
- name: Should be able to create ThanosQuerierConfig with valid topologySpreadConstraints
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
topologySpreadConstraints:
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: thanos-querier
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
app: thanos-querier
expected: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
topologySpreadConstraints:
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: thanos-querier
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
app: thanos-querier
- name: Should be able to create ThanosQuerierConfig with all fields
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
nodeSelector:
kubernetes.io/os: linux
resources:
- name: "cpu"
request: "5m"
- name: "memory"
request: "12Mi"
tolerations:
- key: "node-role.kubernetes.io/infra"
operator: "Exists"
effect: "NoSchedule"
topologySpreadConstraints:
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: DoNotSchedule
expected: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
nodeSelector:
kubernetes.io/os: linux
resources:
- name: "cpu"
request: "5m"
- name: "memory"
request: "12Mi"
tolerations:
- key: "node-role.kubernetes.io/infra"
operator: "Exists"
effect: "NoSchedule"
topologySpreadConstraints:
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: DoNotSchedule
- name: Should reject ThanosQuerierConfig with empty object
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig: {}
expectedError: 'spec.thanosQuerierConfig: Invalid value: 0: spec.thanosQuerierConfig in body should have at least 1 properties'
- name: Should reject ThanosQuerierConfig with duplicate resource names
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
resources:
- name: "cpu"
request: "100m"
- name: "cpu"
request: "200m"
expectedError: 'spec.thanosQuerierConfig.resources[1]: Duplicate value: map[string]interface {}{"name":"cpu"}'
- name: Should reject ThanosQuerierConfig with too many resources
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
resources:
- name: "cpu"
request: "100m"
- name: "memory"
request: "64Mi"
- name: "hugepages-2Mi"
request: "32Mi"
- name: "hugepages-1Gi"
request: "1Gi"
- name: "ephemeral-storage"
request: "1Gi"
- name: "nvidia.com/gpu"
request: "1"
- name: "example.com/foo"
request: "1"
- name: "example.com/bar"
request: "1"
- name: "example.com/baz"
request: "1"
- name: "example.com/qux"
request: "1"
- name: "example.com/quux"
request: "1"
expectedError: 'spec.thanosQuerierConfig.resources: Too many: 11: must have at most 10 items'
- name: Should reject ThanosQuerierConfig with limit less than request
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
resources:
- name: "cpu"
request: "500m"
limit: "200m"
expectedError: 'spec.thanosQuerierConfig.resources[0]: Invalid value: "object": limit must be greater than or equal to request'
- name: Should reject ThanosQuerierConfig with too many topologySpreadConstraints
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
topologySpreadConstraints:
- maxSkew: 1
topologyKey: "zone1"
whenUnsatisfiable: DoNotSchedule
- maxSkew: 1
topologyKey: "zone2"
whenUnsatisfiable: DoNotSchedule
- maxSkew: 1
topologyKey: "zone3"
whenUnsatisfiable: DoNotSchedule
- maxSkew: 1
topologyKey: "zone4"
whenUnsatisfiable: DoNotSchedule
- maxSkew: 1
topologyKey: "zone5"
whenUnsatisfiable: DoNotSchedule
- maxSkew: 1
topologyKey: "zone6"
whenUnsatisfiable: DoNotSchedule
- maxSkew: 1
topologyKey: "zone7"
whenUnsatisfiable: DoNotSchedule
- maxSkew: 1
topologyKey: "zone8"
whenUnsatisfiable: DoNotSchedule
- maxSkew: 1
topologyKey: "zone9"
whenUnsatisfiable: DoNotSchedule
- maxSkew: 1
topologyKey: "zone10"
whenUnsatisfiable: DoNotSchedule
- maxSkew: 1
topologyKey: "zone11"
whenUnsatisfiable: DoNotSchedule
expectedError: 'spec.thanosQuerierConfig.topologySpreadConstraints: Too many: 11: must have at most 10 items'
- name: Should reject ThanosQuerierConfig with empty topologySpreadConstraints array
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
topologySpreadConstraints: []
expectedError: 'spec.thanosQuerierConfig.topologySpreadConstraints: Invalid value: 0: spec.thanosQuerierConfig.topologySpreadConstraints in body should have at least 1 items'
- name: Should reject ThanosQuerierConfig with empty resources array
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
resources: []
expectedError: 'spec.thanosQuerierConfig.resources: Invalid value: 0: spec.thanosQuerierConfig.resources in body should have at least 1 items'
- name: Should reject ThanosQuerierConfig with empty nodeSelector
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
nodeSelector: {}
expectedError: 'spec.thanosQuerierConfig.nodeSelector: Invalid value: 0: spec.thanosQuerierConfig.nodeSelector in body should have at least 1 properties'
- name: Should reject ThanosQuerierConfig with more than 10 nodeSelector entries
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
nodeSelector:
key1: val1
key2: val2
key3: val3
key4: val4
key5: val5
key6: val6
key7: val7
key8: val8
key9: val9
key10: val10
key11: val11
expectedError: 'spec.thanosQuerierConfig.nodeSelector: Too many: 11: must have at most 10 items'
- name: Should reject ThanosQuerierConfig with empty tolerations array
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
tolerations: []
expectedError: 'spec.thanosQuerierConfig.tolerations: Invalid value: 0: spec.thanosQuerierConfig.tolerations in body should have at least 1 items'
- name: Should reject ThanosQuerierConfig with more than 10 tolerations
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
tolerations:
- key: "key1"
operator: "Exists"
effect: "NoSchedule"
- key: "key2"
operator: "Exists"
effect: "NoSchedule"
- key: "key3"
operator: "Exists"
effect: "NoSchedule"
- key: "key4"
operator: "Exists"
effect: "NoSchedule"
- key: "key5"
operator: "Exists"
effect: "NoSchedule"
- key: "key6"
operator: "Exists"
effect: "NoSchedule"
- key: "key7"
operator: "Exists"
effect: "NoSchedule"
- key: "key8"
operator: "Exists"
effect: "NoSchedule"
- key: "key9"
operator: "Exists"
effect: "NoSchedule"
- key: "key10"
operator: "Exists"
effect: "NoSchedule"
- key: "key11"
operator: "Exists"
effect: "NoSchedule"
expectedError: 'spec.thanosQuerierConfig.tolerations: Too many: 11: must have at most 10 items'
- name: Should reject ThanosQuerierConfig with duplicate topologySpreadConstraints
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
topologySpreadConstraints:
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: DoNotSchedule
- maxSkew: 2
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: DoNotSchedule
expectedError: "Duplicate value"
onUpdate:
- name: Should reject updating ThanosQuerierConfig to empty object
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig:
resources:
- name: "cpu"
request: "5m"
updated: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
thanosQuerierConfig: {}
expectedError: 'spec.thanosQuerierConfig: Invalid value: 0: spec.thanosQuerierConfig in body should have at least 1 properties'
Loading