Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dgzlopes/xk6-kubernetes-jobs
A k6 extension to interact with Kubernetes jobs.
https://github.com/dgzlopes/xk6-kubernetes-jobs
k6 k6-extension kubernetes xk6
Last synced: 3 months ago
JSON representation
A k6 extension to interact with Kubernetes jobs.
- Host: GitHub
- URL: https://github.com/dgzlopes/xk6-kubernetes-jobs
- Owner: dgzlopes
- License: apache-2.0
- Archived: true
- Created: 2021-02-20T14:17:48.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-22T07:28:50.000Z (over 3 years ago)
- Last Synced: 2024-07-30T21:05:38.271Z (6 months ago)
- Topics: k6, k6-extension, kubernetes, xk6
- Language: Go
- Homepage:
- Size: 5.31 MB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
| :exclamation: This extension is deprecated! You should use [xk6-kubernetes](https://github.com/grafana/xk6-kubernetes) instead |
|------|# xk6-kubernetes-jobs
This is a [k6](https://go.k6.io/k6) extension using the [xk6](https://github.com/grafana/xk6) system.
## Build
To build a `k6` binary with this extension, first ensure you have the prerequisites:
- [Go toolchain](https://go101.org/article/go-toolchain.html)
- GitThen:
1. Install `xk6`:
```shell
$ go install go.k6.io/xk6/cmd/xk6@latest
```2. Build the binary:
```shell
$ xk6 build --with github.com/dgzlopes/xk6-kubernetes-jobs@latest
```## Example
```javascript
import { sleep } from 'k6';
import kubernetes from 'k6/x/kubernetes-jobs';const client = new kubernetes.Client();
export default function () {
client.create("pi-small","perl","perl -Mbignum=bpi -wle print bpi(20)")
client.create("pi-big","perl","perl -Mbignum=bpi -wle print bpi(2000)")
console.log(`Jobs: ${client.list()}`);
client.deleteAll();
sleep(2);
console.log(`Jobs: ${client.list()}`);
}
```Result output:
```
$ ./k6 run example.js/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .ioexecution: local
script: ../example.js
output: -scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)INFO[0001] Jobs: pi-big,pi-small source=console
INFO[0003] Jobs: source=consolerunning (00m03.0s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m03.0s/10m0s 1/1 iters, 1 per VUdata_received........: 0 B 0 B/s
data_sent............: 0 B 0 B/s
iteration_duration...: avg=2.98s min=2.98s med=2.98s max=2.98s p(90)=2.98s p(95)=2.98s
iterations...........: 1 0.333754/s
vus..................: 1 min=1 max=1
vus_max..............: 1 min=1 max=1
```