Skip to content

Commit

Permalink
updating different sections
Browse files Browse the repository at this point in the history
  • Loading branch information
cdsap committed Sep 2, 2019
1 parent dfe5a00 commit bdba2ab
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 40 deletions.
173 changes: 133 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
![alt text](resources/bagan_1.png "Bagan image")


Bagan is a framework to automate and parallelize the execution, reporting and collection of data with different types of experiments in Gradle projects using Kubernetes.
Bagan is a framework that helps to automate and paralelize the execution, reporting and collection of data with different types of experiments in Gradle projects using Kubernetes.

# Table of Contents
1. [How to use Bagan](#how-to-use-bagan)
2. [bagan_conf.json](#example2)
2. [bagan_conf.json](#bagan_conf.json)
3. [Experiments](#example2)
4. [Modes](#example2)
5. [Commands](#example2)
6. [Lifecycle Bagan](#example2)
7. [Internals Bagan](#example2)
8. [The cost of Bagan](#example2)
9. [Examples](#example2)
10. [Deploying Bagan](#third-example)
6. [Requeriments Execution](#example2)
7. [Lifecycle Bagan](#example2)
8. [Internals Bagan](#example2)
9. [The cost of Bagan](#example2)
10. [Examples](#example2)
11. [Deploying Bagan](#third-example)


## How to use Bagan <a name="how-to-use-bagan"></a>
Expand All @@ -36,7 +37,7 @@ Bagan will deploy a new cluster or will use an existing cluster to execute the e
in the main conf file.
Bagan will use Grafana and

## bagan_conf.json
## bagan_conf.json <a name="bagan_conf.json"></a>

| Property | Description |
|-------------------|---------------------------------------------------------------------------|
Expand Down Expand Up @@ -76,7 +77,7 @@ Example:
```

#### Type Experoments
## Experiments

Experiments are the type of different entites will be applied on each experrimen. You need to
use at least one the experiments to execute Bagan. Currently thetypes of experiments supported are:
Expand All @@ -88,6 +89,36 @@ use at least one the experiments to execute Bagan. Currently thetypes of experim
| gradleWrapperVersion | Execute experiments in the environment mode selected |

Example Pe
```
"experiments": {
"properties": [],
"branch": [],
"gradleWrapperVersion": []
}
```

Bagan will apply a cartesiann product for all type experiments and each combination will be consider
as element to be test.
In case we want to experiment with `jvmargs` in the project with will include.
```
"experiments": {
"properties": [
{
"name": "org.gradle.jvmargs",
"options": ["-Xmx3g","-Xmx4g"]
}
]
}
```

|Experiments |
|----------------------------|
| org.gradle.jvmargs="-Xmx3g"|
|org.gradle.jvmargs="-Xmx4g" |


We can experiment with different gradle properties at the same time and with the other type of experiments like

```
"experiments": {
"properties": [
Expand All @@ -104,11 +135,9 @@ Example Pe
"gradleWrapperVersion" : ["5.5", 5.4"]
}
```
Bagan will apply a cartesiann product for all type experiments and each combination will be consider
as element to be testd.
Following the example, we will 16 different combinations:

|sss |dsd | | |

|Experiments | | | |
|----------------------------|-------|---|------------------|
| org.gradle.jvmargs="-Xmx3g" <br> org.gradle.caching="true" <br> develop <br> 5.5 | org.gradle.jvmargs="-Xmx3g" <br> org.gradle.caching="true" <br> develop <br> 5.4 | org.gradle.jvmargs="-Xmx3g" <br> org.gradle.caching="true" <br> master <br> 5.4 | org.gradle.jvmargs="-Xmx3g" <br> org.gradle.caching="true" <br> master <br> 5.5 |
| org.gradle.jvmargs="-Xmx4g" <br> org.gradle.caching="true" <br> develop <br> 5.5 | org.gradle.jvmargs="-Xmx4g" <br> org.gradle.caching="true" <br> develop <br> 5.4 | org.gradle.jvmargs="-Xmx4g" <br> org.gradle.caching="true" <br> master <br> 5.4 | org.gradle.jvmargs="-Xmx4g" <br> org.gradle.caching="true" <br> master <br> 5.5 |
Expand All @@ -120,14 +149,15 @@ to understand better the impact in terms of cost of high perumations experiments


### Modes
Mode is the K8s environment where you want to execute the experimentation
Mode is the K8s environment where you want to execute the experimentation. Modes are needed to provision and interact with the
Kubernetes environment
There are supported thre modes

| Mode | Description |
|----------------|---------------------------------------------------------------------------|
| gcloud | Mode for logging (Silent,Info) |
| gcloud_docker | Configuration to ignore the execution of Talaiot |
| standalone | Generation of unique identifier for each execution(disabled by default) |
| gcloud | Bagan will be executed in Kubernetes Engine in Gcloud using gcloud sdk |
| gcloud_docker | Bagan will be executed in Kubernetes Engine in Gcloud using Docker and avoiding to set up different configurations in your machine. The image is cdsap/bagan-init |
| standalone | Bagan will be executed in the environemnt configured in the host machine. |

If you have actually your cluster created in Gcloud or you have a host machine where you want
to execute Bagan
Expand Down Expand Up @@ -156,41 +186,104 @@ Examples:
Meta commands are composed by single commands. You can execute single commands depending on your requeriments.
For example if you are using an existing cluster and some of the components required by Bagan are installed you can execute a single command:

| Mode | Description |
|----------------|---------------------------------------------------------------------------|
| create_cluster | Create cluster, infrastructure and execute experiments in the environment mode selected. |
| infra_pods | Create infrastructure and execute experiments in the environment mode selected |
| credentials | Execute experiments in the environment mode selected |
| secret | Execute experiments in the environment mode selected |
| helm | Execute experiments in the environment mode selected |
| helm_init | Execute experiments in the environment mode selected |
| helm_clusterrolebinding | Execute experiments in the environment mode selected |
| grafana | Execute experiments in the environment mode selected |
| influxfb | Execute experiments in the environment mode selected |
| services | Execute experiments in the environment mode selected |
| remove_experiments | Execute experiments in the environment mode selected |
| grafana_dashboard | Execute experiments in the environment mode selected |
| Command | Description |
|-----------------------------|--------------------------------------------------------------------------------------------------------|
| create_cluster | Create cluster, infrastructure and execute experiments in the environment mode selected. |
| infra_pods | Create infrastructure and execute experiments in the environment mode selected (grafana + influxdb) |
| credentials | Get the credentials for the current cluster |
| secret | Create secret object in the mode selected require to experiment with private repositories |
| helm | Execute initialization of helm and the cluster role binding required in Kubernetes |
| helm_init | Execute initialization of Helm |
| helm_clusterrolebinding | Create the cluster role binding required in Kubernetes |
| grafana | Install the Chart of Grafana with Helm at the cluster |
| influxfb | Install the Chart of InfluxDb with Helm at the cluster |
| services | Creates a service port type Load Balance |
| remove_experiments | Remove experiments in the cluster |
| grafana_dashboard | Retrieve the plublic IP of the Dashboard created |


So on the same way we can see how the Meta Command are composed:

| Mode | Description |
|----------------|---------------------------------------------------------------------------|
| cluster | create_cluster + credentials + helm + infra_pods + experiments |
| infrastrcture | Create infrastructure and execute experiments in the environment mode selected |
| experiment | Execute experiments in the environment mode selected |
| Command | Single Commands |
|-------------------|---------------------------------------------------------------------------|
| cluster | create_cluster + credentials + helm + infra_pods + experiments |
| infrastrcture | Create infrastructure and execute experiments in the environment mode selected |
| experiment | credentials + experiments |



## Lifecycle Bagan
We can group the execution of Bagan in three main stages:

* Verificiation
* Provisioning
* Execution Experiments:


![alt text](resources/lifecycle.png "Life Cycle")


### Verification
During this phase Bagan will validate the configuration file `bagan_conf.json` and the inputs included. It's executed in the host machine
and requires jq to perform the validation.

### Provisioning
In this phase, Bagan will execute the command included in the mode selected.
For `gcloud`and `standalone` modes it will be executed in the host machine. For `gcloud_docker` will be executed in a docker image(cdsap/bagan-init).
Kubectl and Helm will be configured.
Depending on the command selected different actions will be handle. Check commands section.


### Execution
The execution phase will be driven by the kscript `BaganGenerator.kt`. This script has two main functions:
* Calculate the combination of experiments
* Generate the Grafana Dashboard with the experimentation and Gradle Commands
* Create and install the experiment environment.

For each experiment `BaganGenerator.kt` will create:
* Chart.yaml
* Values.yaml
* templates/configmapexpermientN.yaml
* templates/podexperimentN.yaml

Finally with Helm will install the package in the selected environment.


## Internals Bagan

### Kubernetes Infrastructure

The overall picture of Bagan from the perspective of Kubernetes will be:

![alt text](resources/kubernetes_infra.png "Kubernetes infra")

Once the experiments are generated and installed one Pod will be linked with the configuration, it will perform the build with the `gradleCommand` and `iterations` defined in
the `bagan_conf.json`.

### Pod execution

![alt text](resources/pod.png "Pod")


## The cost of Bagan
In case you are using Google Cloud as Kubernetes environments you should consider the impact in terms of momeny of the selection
of the different elements.
Resources are limited and are constraint by the type of the machine you have selected. Android projects are expensive in terms of
memory consumption and create multiples combinations will cause the fail of the experiments:

![alt text](resources/no_resources.png "Pod")

On the other side if consider to increase the resources of the machine we should consider the cost:





Bagan is composed by different tools like Helm or Talaiot. One of the m
Bagan is composed by three main phases:


## Lifecycle Bagan
* Verificiation
* Provisioming environment mode and command
* Execution Experiments




Expand Down
Binary file added resources/kubernetes_infra.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/lifecycle.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/no_resources.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/pod.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bdba2ab

Please sign in to comment.