github.com/oam-dev/kubevela@v1.9.11/docs/examples/velaql-views/usage.md (about) 1 2 3 ### Usage 4 5 You can use velaQL with a syntax similar to promeQL. 6 7 The syntax format of velaQL is as follows: 8 9 ```sql 10 view{parameter1=value1}.statusKey 11 ``` 12 13 1. `view` represents different query views, we have built a few views: `component-pod-view`,`pod-view`,`resource-view` 14 2. `parameter1=value1` represents query configuration items 15 3. `statusKey` represents the aggregate result of the query, default is `status` 16 17 ### component-pod-view 18 19 #### describe 20 21 List the pods created by specified component 22 23 #### parameter 24 25 ``` 26 parameter: { 27 appName: string // application name 28 appNs: string // application namespace 29 name: string // component name 30 cluster?: string // cluster name(Optional) 31 clusterNs?: string // cluster namespace(Optional) 32 } 33 ``` 34 35 #### statusKey 36 37 `status` 38 39 #### query result 40 41 ``` 42 // query successful 43 status: { 44 podList: [{ 45 cluster: string 46 worload: { 47 apiVersion: string 48 kind: string 49 } 50 metadata: { 51 name: string 52 namespace: string 53 creationTime: string 54 version: { 55 revision: string 56 publishVersion: string 57 deployVersion: string 58 } 59 } 60 status: { 61 phase: "Pending" | "Running" | "Succeeded" | "Failed" | "Unknown" 62 // if phase == "Pending" or "Unknown": podIP, hostIP, nodeName will be empty 63 podIP: string 64 hostIP: string 65 nodeName: string 66 } 67 }] 68 } 69 70 // query failed 71 status: { 72 error: string 73 } 74 ``` 75 76 #### demo 77 78 ```sql 79 component-pod-view{appName=demo,appNs=default,cluster=prod,clusterNs=default,name=web}.status 80 ``` 81 82 ### pod-view 83 84 #### describe 85 86 Query the pods detail information 87 88 #### parameter 89 90 ``` 91 parameter: { 92 name: string // pod name 93 namespace: string // pod namespace 94 cluster?: string // cluster name(Optional) 95 } 96 ``` 97 98 #### statusKey 99 100 `status` 101 102 #### query result 103 104 ``` 105 // query successful 106 status: { 107 containers: [{ 108 name: string 109 image: string 110 resources: { 111 limits: { 112 cpu: string 113 memory: string 114 } 115 requests: { 116 cpu: string 117 memory: string 118 } 119 usage: { 120 cpu: string 121 memory: string 122 } 123 } 124 status: { 125 // state holds a possible state of container. 126 // only one of its members may be specified. 127 state: { 128 running: {...} 129 waiting: {...} 130 terminated: {...} 131 } 132 restartCount: string 133 } 134 }] 135 events: [...v1.Event] 136 } 137 138 // query failed 139 status: { 140 error: string 141 } 142 ``` 143 144 #### demo 145 146 ``` 147 pod-view{name=demo,namespace=default,cluster=prod}.status 148 ``` 149 150 ### resource-view 151 152 #### describe 153 154 List resources 155 156 #### parameter 157 158 ``` 159 parameter: { 160 type: "ns" | "secret" | "configMap" | "pvc" | "storageClass" 161 namespace: *"" | string // Optional 162 cluster: *"" | string // Optional 163 } 164 ``` 165 166 #### statusKey 167 168 `status` 169 170 #### query result 171 172 ``` 173 // query successful 174 status: { 175 list: [...k8sObject] 176 } 177 178 // query failed 179 status: { 180 error: string 181 } 182 ``` 183 184 #### demo 185 186 ``` 187 resource-view{type=ns,cluster=prod}.status 188 ``` 189 190