Skip to content

Commit 1753435

Browse files
[2.15] [VAI] Index more fields (#1149)
* Add tests for mcio.cluster:status.driver * Add new 'status.info' fields and 'spec.fleetWorkspaceNam'
1 parent 5dda840 commit 1753435

3 files changed

Lines changed: 131 additions & 14 deletions

File tree

pkg/stores/sqlproxy/proxy_store.go

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -194,20 +194,25 @@ var (
194194
"spec.clusterName": &informer.JSONPathField{Path: []string{"spec", "clusterName"}},
195195
},
196196
gvkKey("management.cattle.io", "v3", "Cluster"): {
197-
"spec.internal": &informer.JSONPathField{Path: []string{"spec", "internal"}},
198-
"spec.displayName": &informer.JSONPathField{Path: []string{"spec", "displayName"}},
199-
"status.allocatable.cpu": &informer.JSONPathField{Type: "", Path: []string{"status", "allocatable", "cpu"}},
200-
"status.allocatable.cpuRaw": &informer.JSONPathField{Type: "REAL", Path: []string{"status", "allocatable", "cpuRaw"}},
201-
"status.allocatable.memory": &informer.JSONPathField{Type: "", Path: []string{"status", "allocatable", "memory"}},
202-
"status.allocatable.memoryRaw": &informer.JSONPathField{Type: "REAL", Path: []string{"status", "allocatable", "memoryRaw"}},
203-
"status.allocatable.pods": &informer.JSONPathField{Type: "INT", Path: []string{"status", "allocatable", "pods"}},
204-
"status.requested.cpu": &informer.JSONPathField{Type: "", Path: []string{"status", "requested", "cpu"}},
205-
"status.requested.cpuRaw": &informer.JSONPathField{Type: "REAL", Path: []string{"status", "requested", "cpuRaw"}},
206-
"status.requested.memory": &informer.JSONPathField{Type: "", Path: []string{"status", "requested", "memory"}},
207-
"status.requested.memoryRaw": &informer.JSONPathField{Type: "REAL", Path: []string{"status", "requested", "memoryRaw"}},
208-
"status.requested.pods": &informer.JSONPathField{Type: "INT", Path: []string{"status", "requested", "pods"}},
209-
"status.connected": &informer.JSONPathField{Path: []string{"status", "connected"}},
210-
"status.provider": &informer.JSONPathField{Path: []string{"status", "provider"}},
197+
"spec.fleetWorkspaceName": &informer.JSONPathField{Path: []string{"spec", "fleetWorkspaceName"}},
198+
"spec.internal": &informer.JSONPathField{Path: []string{"spec", "internal"}},
199+
"spec.displayName": &informer.JSONPathField{Path: []string{"spec", "displayName"}},
200+
"status.allocatable.cpu": &informer.JSONPathField{Type: "", Path: []string{"status", "allocatable", "cpu"}},
201+
"status.allocatable.cpuRaw": &informer.JSONPathField{Type: "REAL", Path: []string{"status", "allocatable", "cpuRaw"}},
202+
"status.allocatable.memory": &informer.JSONPathField{Type: "", Path: []string{"status", "allocatable", "memory"}},
203+
"status.allocatable.memoryRaw": &informer.JSONPathField{Type: "REAL", Path: []string{"status", "allocatable", "memoryRaw"}},
204+
"status.allocatable.pods": &informer.JSONPathField{Type: "INT", Path: []string{"status", "allocatable", "pods"}},
205+
"status.driver": &informer.JSONPathField{Path: []string{"status", "driver"}},
206+
"status.info.kubernetesVersion": &informer.JSONPathField{Path: []string{"status", "info", "kubernetesVersion"}},
207+
"status.info.machineProvider": &informer.JSONPathField{Path: []string{"status", "info", "machineProvider"}},
208+
"status.info.nodeCount": &informer.JSONPathField{Type: "INT", Path: []string{"status", "info", "nodeCount"}},
209+
"status.requested.cpu": &informer.JSONPathField{Type: "", Path: []string{"status", "requested", "cpu"}},
210+
"status.requested.cpuRaw": &informer.JSONPathField{Type: "REAL", Path: []string{"status", "requested", "cpuRaw"}},
211+
"status.requested.memory": &informer.JSONPathField{Type: "", Path: []string{"status", "requested", "memory"}},
212+
"status.requested.memoryRaw": &informer.JSONPathField{Type: "REAL", Path: []string{"status", "requested", "memoryRaw"}},
213+
"status.requested.pods": &informer.JSONPathField{Type: "INT", Path: []string{"status", "requested", "pods"}},
214+
"status.connected": &informer.JSONPathField{Path: []string{"status", "connected"}},
215+
"status.provider": &informer.JSONPathField{Path: []string{"status", "provider"}},
211216
},
212217
gvkKey("management.cattle.io", "v3", "ClusterRoleTemplateBinding"): {
213218
"clusterName": &informer.JSONPathField{Path: []string{"clusterName"}},
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
apiVersion: management.cattle.io/v3
2+
kind: Cluster
3+
metadata:
4+
name: pinion
5+
spec:
6+
fleetWorkspaceName: fleet-of-foot
7+
status:
8+
conditions:
9+
- type: Ready
10+
status: "True"
11+
driver: Ardeth
12+
info:
13+
kubernetesVersion: v1.35.3+rke2r2
14+
machineProvider: lothar
15+
nodeCount: "2"
16+
---
17+
apiVersion: management.cattle.io/v3
18+
kind: Cluster
19+
metadata:
20+
name: gearshift
21+
spec:
22+
fleetWorkspaceName: fleet-of-foot
23+
status:
24+
conditions:
25+
- type: Ready
26+
status: "True"
27+
driver: Unser
28+
info:
29+
kubernetesVersion: v1.35.3+rke2r1
30+
machineProvider: floyd
31+
nodeCount: "4"
32+
---
33+
apiVersion: management.cattle.io/v3
34+
kind: Cluster
35+
metadata:
36+
name: spoiler
37+
spec:
38+
fleetWorkspaceName: foxes
39+
status:
40+
conditions:
41+
- type: Ready
42+
status: "True"
43+
driver: Petty
44+
info:
45+
kubernetesVersion: mouse
46+
---
47+
apiVersion: management.cattle.io/v3
48+
kind: Cluster
49+
metadata:
50+
name: alternator
51+
spec:
52+
fleetWorkspaceName: "not the bubble gum"
53+
status:
54+
conditions:
55+
- type: Ready
56+
status: "True"
57+
driver: Foyt
58+
info: {}
59+
---
60+
apiVersion: management.cattle.io/v3
61+
kind: Cluster
62+
metadata:
63+
name: airbag
64+
spec:
65+
fleetWorkspaceName: fleet-of-foot
66+
status:
67+
conditions:
68+
- type: Ready
69+
status: "True"
70+
info:
71+
kubernetesVersion: v1.35.3+rke2r1
72+
machineProvider: lothar
73+
nodeCount: "5"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
schemaID: management.cattle.io.clusters
2+
tests:
3+
- query: sort=status.driver
4+
expected:
5+
- airbag # <not given>
6+
- pinion # Ardeth
7+
- alternator # Foyt
8+
- spoiler # Petty
9+
- gearshift # Unser
10+
- query: "filter=status.driver+IN+(Ardeth,+Foyt)&sort=-status.driver"
11+
expected:
12+
- alternator # Foyt
13+
- pinion # Ardeth
14+
- query: "filter=spec.fleetWorkspaceName=fleet-of-foot"
15+
expected:
16+
- airbag
17+
- gearshift
18+
- pinion
19+
- query: "filter=spec.fleetWorkspaceName=foxes"
20+
expected:
21+
- spoiler
22+
- query: "filter=status.info.machineProvider=lothar"
23+
expected:
24+
- airbag
25+
- pinion
26+
# The syntax here is because:
27+
# 1. The query processor will map a '+' to a space
28+
# 2. The parser will stop at the '+' for an unquoted value
29+
- query: 'filter=status.info.kubernetesVersion="v1.35.3%2brke2r1"'
30+
expected:
31+
- airbag
32+
- gearshift
33+
- query: filter=status.info.kubernetesVersion=mouse
34+
expected:
35+
- spoiler
36+
- query: "filter=status.info.nodeCount+<+5"
37+
expected:
38+
- gearshift
39+
- pinion

0 commit comments

Comments
 (0)