mirror of https://github.com/rancher/dartboard.git
k6: add benchmark for listing resources directly from Kubernetes (#65)
* k6/k8s: make list limit configurable Signed-off-by: Silvio Moioli <silvio@moioli.net> * k6: add Kubernetes api read benchmark Signed-off-by: Silvio Moioli <silvio@moioli.net> --------- Signed-off-by: Silvio Moioli <silvio@moioli.net>
This commit is contained in:
parent
aa87402359
commit
c06f68e218
|
|
@ -6,7 +6,6 @@ import * as YAML from './lib/js-yaml-4.1.0.mjs'
|
||||||
|
|
||||||
import { URL } from './lib/url-1.0.0.js';
|
import { URL } from './lib/url-1.0.0.js';
|
||||||
|
|
||||||
const limit = 5000
|
|
||||||
const timeout = '3600s'
|
const timeout = '3600s'
|
||||||
|
|
||||||
// loads connection variables from kubeconfig's specified context
|
// loads connection variables from kubeconfig's specified context
|
||||||
|
|
@ -59,7 +58,7 @@ export function del(url){
|
||||||
const continueRegex = /"continue":"([A-Za-z0-9]+)"/;
|
const continueRegex = /"continue":"([A-Za-z0-9]+)"/;
|
||||||
|
|
||||||
// lists k8s resources
|
// lists k8s resources
|
||||||
export function list(url) {
|
export function list(url, limit) {
|
||||||
let _continue = 'first'
|
let _continue = 'first'
|
||||||
let responses = []
|
let responses = []
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
import * as k8s from './k8s.js'
|
||||||
|
|
||||||
|
// Parameters
|
||||||
|
const vus = __ENV.VUS || 1
|
||||||
|
const perVuIterations = __ENV.PER_VU_ITERATIONS || 30
|
||||||
|
const resource = __ENV.RESOURCE || "configmaps"
|
||||||
|
const limit = __ENV.LIMIT || 5000
|
||||||
|
const namespace = __ENV.NAMESPACE || "scalability-test"
|
||||||
|
const kubeconfig = k8s.kubeconfig(__ENV.KUBECONFIG, __ENV.CONTEXT)
|
||||||
|
const baseUrl = __ENV.BASE_URL
|
||||||
|
|
||||||
|
// Option setting
|
||||||
|
export const options = {
|
||||||
|
insecureSkipTLSVerify: true,
|
||||||
|
|
||||||
|
tlsAuth: [
|
||||||
|
{
|
||||||
|
cert: kubeconfig["cert"],
|
||||||
|
key: kubeconfig["key"],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
scenarios: {
|
||||||
|
list : {
|
||||||
|
executor: 'per-vu-iterations',
|
||||||
|
exec: 'list',
|
||||||
|
vus: vus,
|
||||||
|
iterations: perVuIterations,
|
||||||
|
maxDuration: '24h',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
thresholds: {
|
||||||
|
checks: ['rate>0.99']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test functions, in order of execution
|
||||||
|
|
||||||
|
export function list() {
|
||||||
|
k8s.list(`${baseUrl}/api/v1/namespaces/${namespace}/${resource}`, limit)
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue