Skip to content

Commit

Permalink
Document Pod termination fault (#1381)
Browse files Browse the repository at this point in the history
* Document Pod termination fault

Signed-off-by: Pablo Chacin <[email protected]>

---------

Signed-off-by: Pablo Chacin <[email protected]>
Co-authored-by: Roberto Santalla <[email protected]>
  • Loading branch information
pablochacin and Roberto Santalla authored Oct 26, 2023
1 parent e0c242d commit 5e1c2cd
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ A fault is as an abnormal condition that affects a system component and which ma
| ---------- | ---------- |
| [gRPC Fault](/javascript-api/xk6-disruptor/api/faults/grpc) | Fault affecting gRPC requests from a target |
| [HTTP Fault](/javascript-api/xk6-disruptor/api/faults/http) | Fault affecting HTTP requests from a target |
| [Pod Termination Fault](/javascript-api/xk6-disruptor/api/faults/pod-termination) | Fault terminating a number of target Pods |
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: 'Pod Termination'
excerpt: 'xk6-disruptor: Pod Termination Fault attributes'
---

A Pod Termination Fault allows terminating either a fixed number or a percentage of the pods that matching a selector or back a service.

A Pod Termination fault is defined by the following attributes:

| Attribute | Type | Description |
| ------------- | ------ | --------|
| count | integer or percentage | the number of pods to be terminated. It can be specified as a integer number or as a percentage (e.g. `30%`) that defines the fraction of target pods to be terminated|


<Blockquote mod="note">
If the count is a percentage and there are no enough elements in the target pod list, the number is rounded up.
For example '25%' of a list of 2 target pods will terminate one pod.
If the list of target pods is not empty, at least one pod is always terminated.
</Blockquote>

## Example

This example defines a PorTermination fault that will terminate `30%` of target pods
```javascript
const fault = {
count: '30%'
};
```
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ To construct a `PodDisruptor`, use the [PodDisruptor() constructor](/javascript-
| [PodDisruptor.injectGrpcFaults()](/javascript-api/xk6-disruptor/api/poddisruptor/injectgrpcfaults) | Inject [gRPC faults](/javascript-api/xk6-disruptor/api/faults/grpc) in the target Pods|
| [PodDisruptor.injectHTTPFaults()](/javascript-api/xk6-disruptor/api/poddisruptor/injecthttpfaults) | Inject [HTTP faults](/javascript-api/xk6-disruptor/api/faults/http) in the target Pods|
| PodDisruptor.targets() | Returns the list of target Pods of the PodDisruptor |
| [PodDisruptor.terminatePods()](/javascript-api/xk6-disruptor/api/poddisruptor/terminatepods) | executes a [Pod Termination fault](/javascript-api/xk6-disruptor/api/faults/pod-termination) in the target Pods|


## Example
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: 'terminatePods()'
excerpt: 'xk6-disruptor: PodDisruptor.terminatePods method'
---

`terminatePods` terminates a number of the pods matching the selector configured in the PodDisruptor.

| Parameter | Type | Description |
| --------- | ------ |------- |
| fault | object | description of the [Pod Termination fault](/javascript-api/xk6-disruptor/api/faults/pod-termination) |


## Example

<!-- eslint-skip -->

```javascript
const fault = {
count: 2,
}
disruptor.terminatePods(fault)
```
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ To construct a `ServiceDisruptor`, use the [ServiceDisruptor() constructor](/jav
| ------ | ----------- |
| [ServiceDisruptor.injectGrpcFaults()](/javascript-api/xk6-disruptor/api/servicedisruptor/injectgrpcfaults) | Inject [gRPC faults](/javascript-api/xk6-disruptor/api/faults/grpc) in the target Pods|
| [ServiceDisruptor.injectHTTPFaults()](/javascript-api/xk6-disruptor/api/servicedisruptor/injecthttpfaults) | Inject [HTTTP faults](/javascript-api/xk6-disruptor/api/faults/http) in the target Pods|
| ServiceDisruptor.targets() | Returns the list of target Pods of the ServiceDisruptor |
| [ServiceDisruptor.terminatePods()](/javascript-api/xk6-disruptor/api/servicedisruptor/terminatepods) | executes a [Pod Termination fault](/javascript-api/xk6-disruptor/api/faults/pod-termination) in the target Pods|


## Example
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: 'terminatePods()'
excerpt: 'xk6-disruptor: ServiceDisruptor.terminatePods method'
---

`terminatePods` terminates a number of pods that belong to the service specified in the ServiceDisruptor.

| Parameter | Type | Description |
| --------- | ------ |------- |
| fault | object | description of the [Pod Termination fault](/javascript-api/xk6-disruptor/api/faults/pod-termination) |


## Example

<!-- eslint-skip -->

```javascript
const fault = {
count: 2,
}
disruptor.terminatePods(fault)
```

0 comments on commit 5e1c2cd

Please sign in to comment.