Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Helm Chart for WSO2 API Microgateway Deployment #21

Open
wants to merge 12 commits into
base: 3.2.0
Choose a base branch
from
4 changes: 2 additions & 2 deletions helm/microgateway/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

apiVersion: v1
appVersion: "3.0.1"
appVersion: "3.2.0"
description: A Helm chart for WSO2 API Micro Gateway
name: microgateway
version: 3.0.1-1
version: 3.2.0-1
254 changes: 201 additions & 53 deletions helm/microgateway/README.md
Original file line number Diff line number Diff line change
@@ -1,145 +1,293 @@
# Helm Chart for deployment of WSO2 API Microgateway
# Helm Chart for deployment of WSO2 API Microgateway



## Contents

* [Prerequisites](#prerequisites)
* [Quick Start Guide](#quick-start-guide)


* [Prerequisites](#prerequisites)

* [Quick Start Guide](#quick-start-guide)



## Prerequisites



* In order to use WSO2 Helm resources, you need an active WSO2 subscription. If you do not possess an active WSO2
subscription already, you can sign up for a WSO2 Free Trial Subscription from [here](https://wso2.com/free-trial-subscription)
. Otherwise you can proceed with docker images which are created using GA releases.<br><br>

subscription already, you can sign up for a WSO2 Free Trial Subscription from [here](https://wso2.com/free-trial-subscription)

. Otherwise you can proceed with docker images which are created using GA releases.<br><br>



* Install [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git), [Helm](https://github.com/kubernetes/helm/blob/master/docs/install.md)
(and Tiller) and [Kubernetes client](https://kubernetes.io/docs/tasks/tools/install-kubectl/) (compatible with v1.10) in order to run the

(and Tiller) and [Kubernetes client](https://kubernetes.io/docs/tasks/tools/install-kubectl/) (compatible with v1.10) in order to run the
chathuraswso2 marked this conversation as resolved.
Show resolved Hide resolved

steps provided in the following quick start guide.<br><br>



* An already setup [Kubernetes cluster](https://kubernetes.io/docs/setup/pick-right-solution/).<br><br>



* Install [NGINX Ingress Controller](https://kubernetes.github.io/ingress-nginx/deploy/). Please note that Helm resources for WSO2 product

deployment patterns are compatible with NGINX Ingress Controller Git release [`nginx-0.22.0`](https://github.com/kubernetes/ingress-nginx/releases/tag/nginx-0.22.0).

## Quick Start Guide
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chathuraswso2 Please refer to the README documentation and fix this doc with instructions for running in different versions of Helm and etc.

@ThilinaManamgoda do we have to provide instructions for running this with the pipeline rather than independently?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5a7cf5f commit

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ThilinaManamgoda are there any real benefits of deploying this chart outside of the Kubernetes Pipeline?

If it is tightly coupled with the pipeline, shouldn't we be instructing the user to use this chart together with it?

WDYT?


>In the context of this document, <br>
>* `KUBERNETES_HOME` will refer to a local copy of the [`wso2/kubernetes-microgateway`](https://github.com/wso2/kubernetes-microgateway/)

>* `KUBERNETES_HOME` will refer to a local copy of the [`wso2/kubernetes-microgateway`](https://github.com/wso2/kubernetes-microgateway/)

Git repository. <br>
>* `HELM_HOME` will refer to `<KUBERNETES_HOME>/helm/microgateway`. <br>

>* `HELM_HOME` will refer to `<KUBERNETES_HOME>/helm/microgateway`. <br>



##### 1. Clone the Kubernetes Resources for WSO2 Identity Server Git repository.



```

git clone https://github.com/wso2/kubernetes-microgateway.git

```



##### 2. Provide configurations.



a. The default product configurations are available at `<HELM_HOME>/confs` folder. Change the

configurations as necessary.



b. Open the `<HELM_HOME>/values.yaml` and provide the following values.



###### WSO2 Subscription Configurations
chathuraswso2 marked this conversation as resolved.
Show resolved Hide resolved

| Parameter | Description | Default Value |


| Parameter | Description | Default Value |

|-----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|-----------------------------|
| `wso2.subscription.username` | Your WSO2 Subscription username | "" |
| `wso2.subscription.password` | Your WSO2 Subscription password | "" |

If you do not have active WSO2 subscription do not change the parameters `wso2.deployment.username`, `wso2.deployment.password`.
| `wso2.subscription.username` | Your WSO2 Subscription username | "" |

| `wso2.subscription.password` | Your WSO2 Subscription password | "" |



If you do not have active WSO2 subscription do not change the parameters `wso2.deployment.username`, `wso2.deployment.password`.



###### Centralized Logging Configurations

| Parameter | Description | Default Value |


| Parameter | Description | Default Value |

|-----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|-----------------------------|
| `wso2.centralizedLogging.enabled` | Enable Centralized logging for WSO2 components | true | | |
| `wso2.centralizedLogging.logstash.imageTag` | Logstash Sidecar container image tag | 7.2.0 |
| `wso2.centralizedLogging.logstash.elasticsearch.username` | Elasticsearch username | elastic |
| `wso2.centralizedLogging.logstash.elasticsearch.password` | Elasticsearch password | changeme |
| `wso2.centralizedLogging.logstash.indexNodeID.wso2ISNode` | Elasticsearch IS Node log index ID(index name: ${NODE_ID}-${NODE_IP}) | wso2 |

| `wso2.centralizedLogging.enabled` | Enable Centralized logging for WSO2 components | false | | |

| `wso2.centralizedLogging.logstash.config.logstashYaml` | Logstash custom deployment configuration file | - |

| `wso2.centralizedLogging.logstash.config.logstashConf` | Logstash custom deployment configuration file | - |

| `wso2.centralizedLogging.logstash.elasticsearch.username` | Elasticsearch username | elastic |

| `wso2.centralizedLogging.logstash.elasticsearch.password` | Elasticsearch password | changeme |

| `wso2.centralizedLogging.logstash.indexNodeID.wso2ISNode` | Elasticsearch IS Node log index ID(index name: ${NODE_ID}-${NODE_IP}) | wso2 |



###### Micro Gateway Configurations

| Parameter | Description | Default Value |


| Parameter | Description | Default Value |

|-----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|-----------------------------|
| `wso2.deployment.wso2microgw.dockerRegistry` | Docker registry of the microgateway image | "" |
| `wso2.deployment.wso2microgw.imageName` | Image name for microgateway node | "" |
| `wso2.deployment.wso2microgw.imageTag` | Image tag for microgateway node | "" |
| `wso2.deployment.wso2microgw.replicas` | Number of replicas for microgateway node | 1 |
| `wso2.deployment.wso2microgw.minReadySeconds` | Refer to [doc](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#deploymentspec-v1-apps)| 1 75 |
| `wso2.deployment.wso2microgw.strategy.rollingUpdate.maxSurge` | Refer to [doc](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#deploymentstrategy-v1-apps) | 1 |
| `wso2.deployment.wso2microgw.strategy.rollingUpdate.maxUnavailable` | Refer to [doc](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#deploymentstrategy-v1-apps) | 0 |
| `wso2.deployment.wso2microgw.livenessProbe.initialDelaySeconds` | Initial delay for the live-ness probe for microgateway node | 40 |
| `wso2.deployment.wso2microgw.livenessProbe.periodSeconds` | Period of the live-ness probe for microgateway node | 10 |
| `wso2.deployment.wso2microgw.readinessProbe.initialDelaySeconds` | Initial delay for the readiness probe for microgateway node | 40 |
| `wso2.deployment.wso2microgw.readinessProbe.periodSeconds` | Period of the readiness probe for microgateway node | 10 |
| `wso2.deployment.wso2microgw.imagePullPolicy` | Refer to [doc](https://kubernetes.io/docs/concepts/containers/images#updating-images) | Always |
| `wso2.deployment.wso2microgw.resources.requests.memory` | The minimum amount of memory that should be allocated for a Pod | 1Gi |
| `wso2.deployment.wso2microgw.resources.requests.cpu` | The minimum amount of CPU that should be allocated for a Pod | 2000m |
| `wso2.deployment.wso2microgw.resources.limits.memory` | The maximum amount of memory that should be allocated for a Pod | 2Gi |
| `wso2.deployment.wso2microgw.resources.limits.cpu` | The maximum amount of CPU that should be allocated for a Pod | 2000m |

| `wso2.deployment.wso2microgw.dockerRegistry` | Docker registry of the microgateway image | "" |

| `wso2.deployment.wso2microgw.imageName` | Image name for microgateway node | "" |

| `wso2.deployment.wso2microgw.imageTag` | Image tag for microgateway node | "" |

| `wso2.deployment.wso2microgw.replicas` | Number of replicas for microgateway node | 1 |

| `wso2.deployment.wso2microgw.minReadySeconds` | Refer to [doc](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#deploymentspec-v1-apps)| 1 75 |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chathuraswso2 let's get rid of minReadySeconds property as it is not required in the Deployment.


| `wso2.deployment.wso2microgw.strategy.rollingUpdate.maxSurge` | Refer to [doc](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#deploymentstrategy-v1-apps) | 1 |

| `wso2.deployment.wso2microgw.strategy.rollingUpdate.maxUnavailable` | Refer to [doc](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#deploymentstrategy-v1-apps) | 0 |

| `wso2.deployment.wso2microgw.livenessProbe.initialDelaySeconds` | Initial delay for the live-ness probe for microgateway node | 40 |

| `wso2.deployment.wso2microgw.livenessProbe.periodSeconds` | Period of the live-ness probe for microgateway node | 10 |

| `wso2.deployment.wso2microgw.readinessProbe.initialDelaySeconds` | Initial delay for the readiness probe for microgateway node | 40 |

| `wso2.deployment.wso2microgw.readinessProbe.periodSeconds` | Period of the readiness probe for microgateway node | 10 |

| `wso2.deployment.wso2microgw.imagePullPolicy` | Refer to [doc](https://kubernetes.io/docs/concepts/containers/images#updating-images) | Always |

| `wso2.deployment.wso2microgw.resources.requests.memory` | The minimum amount of memory that should be allocated for a Pod | 1Gi |

| `wso2.deployment.wso2microgw.resources.requests.cpu` | The minimum amount of CPU that should be allocated for a Pod | 2000m |

| `wso2.deployment.wso2microgw.resources.limits.memory` | The maximum amount of memory that should be allocated for a Pod | 2Gi |

| `wso2.deployment.wso2microgw.resources.limits.cpu` | The maximum amount of CPU that should be allocated for a Pod | 2000m |

| `wso2.deployment.wso2microgw.ingress.hostname` | Hostname for Microgateway | am.wso2.com |

| `wso2.deployment.wso2microgw.ingress.annotations` | Ingress resource annotations for Microgateway | - |

| `wso2.deployment.wso2microgw.config` | Custom deployment configuration file for Microgateway | - |



**Note**: The above mentioned default, minimum resource amounts for running WSO2 API Microgateway are based on its [official documentation](https://docs.wso2.com/display/MG301/Installation+Prerequisites#InstallationPrerequisites-MicrogatewayRuntime).



##### 3. Deploy WSO2 Identity server.
chathuraswso2 marked this conversation as resolved.
Show resolved Hide resolved



```

helm install --dep-up --name <RELEASE_NAME> <HELM_HOME> --namespace <NAMESPACE>

```



`NAMESPACE` should be the Kubernetes Namespace in which the resources are deployed



##### 4. Access Management Console.

Default deployment will expose `<RELEASE_NAME>` host (to expose Administrative services and Management Console).


Default deployment will expose `<HOSTNAME>` host (to expose Administrative services and Management Console).



To access the console in the environment,



a. Obtain the external IP (`EXTERNAL-IP`) of the Ingress resources by listing down the Kubernetes Ingresses.



```

kubectl get ing -n <NAMESPACE>

```



```
NAME HOSTS ADDRESS PORTS AGE
wso2micro-gw-ingress <RELEASE_NAME> <EXTERNAL-IP> 80, 443 3m

NAME HOSTS ADDRESS PORTS AGE

wso2micro-gw-ingress <HOSTNAME> <EXTERNAL-IP> 80, 443 3m

```



b. Add the above host as an entry in /etc/hosts file as follows:



```
<EXTERNAL-IP> <RELEASE_NAME>

<EXTERNAL-IP> <HOSTNAME>

```



## Enabling Centralized Logging

Centralized logging with Logstash and Elasticsearch is disabled by default. However, if it is required to be enabled,


Centralized logging with Logstash and Elasticsearch is disabled by default. However, if it is required to be enabled,

the following steps should be followed.



1. Set `centralizedLogging.enabled` to `true` in the [values.yaml](values.yaml) file.

2. Add elasticsearch Helm repository to download sub-charts required for Centralized logging.

```

helm repo add elasticsearch https://helm.elastic.co

```

3. Create a requirements.yaml at <HELM_HOME> and add the following dependencies in the file.

```

dependencies:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chathuraswso2 did you test the chart with the WSO2 Kubernetes Pipeline? What is the version which you used?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't check with any Kubernetes Pipeline.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ThilinaManamgoda shouldn't we test this chart with the WSO2 Kubernetes Pipeline and update the necessary sample repositories? Please correct me if I am wrong.

- name: kibana
version: "7.2.1-0"
repository: "https://helm.elastic.co"
condition: wso2.centralizedLogging.enabled
- name: elasticsearch
version: "7.2.1-0"
repository: "https://helm.elastic.co"
condition: wso2.centralizedLogging.enabled

- name: kibana

version: "7.2.1-0"

repository: "https://helm.elastic.co"

condition: wso2.centralizedLogging.enabled

- name: elasticsearch

chathuraswso2 marked this conversation as resolved.
Show resolved Hide resolved
version: "7.2.1-0"

repository: "https://helm.elastic.co"

condition: wso2.centralizedLogging.enabled



```

4. Add override configurations for Elasticsearch in the [values.yaml](values.yaml) file.

```

wso2:
( ... )


( ... )

elasticsearch:
clusterName: wso2-elasticsearch
```

clusterName: wso2-elasticsearch

```
Loading