Skip to content

Commit

Permalink
Add link to sticky session doc (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
julie-garrone authored May 10, 2023
1 parent 9f451e1 commit 60a5633
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 1 deletion.
57 changes: 57 additions & 0 deletions contrib/sticky-session/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Using sticky session for Decision Center connection

The aim of this complementary documentation is to explain how to enable sticky session for Decision Center connection, using NGINX ingress.

Sticky sessions or session affinity, is a feature that allows you to keep a session alive for a certain period of time. In a Kubernetes cluster, if sticky session is enabled, all the traffic from a client to an application will be redirected to the same pod, even with multiple replicas.

## Prerequisites

This supposes that you already provision an NGINX Ingress Controller in your cluster. Refer to the documentation corresponding to your platform for more information.

## Deploy ODM without Ingress

To install ODM without Ingress:

- Get the appropriate value file for your platform and set the `ingress.enabled` parameter to `false`:
```yaml
ingress:
enabled: false
```
> **Note**
> `false` is the default value if not provided.

- Run the helm install command:

```
helm install mycompany ibm-helm/ibm-odm-prod --version 23.1.0 -f my-nginx-values.yaml
```

## Configuring Ingress to use sticky sessions

To be able to use sticky session in Decision Center but not enabling it in Decision Server, you will have to create to different Ingress instances:

```bash
kubeclt apply -f ingress-dc.yaml
kubeclt apply -f ingress-ds.yaml
```

The [ingress-dc.yaml](ingress-dc.yaml) configuration file uses the `nginx.ingress.kubernetes.io/affinity: cookie` annotation that enable sticky sessions.

### 6. Access the ODM services  

After a couple of minutes, the Ingress configuration is updated. You can then access the ODM services by retrieving the URLs with this command:

```bash
export DC_ROOTURL=$(kubectl get ingress mycompany-odm-dc-ingress --no-headers |awk '{print $4}')
export DS_ROOTURL=$(kubectl get ingress mycompany-odm-ds-ingress --no-headers |awk '{print $4}')
```

The ODM services are accessible from the following URLs:

| *Component* | *URL* | *Username/Password* |
|---|---|---|
| Decision Center | https://${DC_ROOTURL}/decisioncenter | odmAdmin/odmAdmin |
| Decision Center Swagger | https://${DC_ROOTURL}/decisioncenter-api | odmAdmin/odmAdmin |
| Decision Server Console |https://${DS_ROOTURL}/res| odmAdmin/odmAdmin |
| Decision Server Runtime | https://${DS_ROOTURL}/DecisionService | odmAdmin/odmAdmin |
| Decision Runner | https://${DS_ROOTURL}/DecisionRunner | odmAdmin/odmAdmin |
30 changes: 30 additions & 0 deletions contrib/sticky-session/ingress-dc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ${RELEASE_NAME}-odm-dc-ingress
labels:
app: ibm-odm-prod
ingressroutes: ${RELEASE_NAME}
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/backend-protocol: https
nginx.ingress.kubernetes.io/affinity: cookie

spec:
rules:
- http:
paths:
- path: /decisioncenter
pathType: Prefix
backend:
service:
name: ${RELEASE_NAME}-odm-decisioncenter
port:
number: 9453
- path: /decisioncenter-api
pathType: Prefix
backend:
service:
name: ${RELEASE_NAME-odm-decisioncenter
port:
number: 9453
36 changes: 36 additions & 0 deletions contrib/sticky-session/ingress-ds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ${RELEASE_NAME}-odm-ds-ingress
labels:
app: ibm-odm-prod
ingressroutes: ${RELEASE_NAME}
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/backend-protocol: https

spec:
rules:
- http:
paths:
- path: /res
pathType: Prefix
backend:
service:
name: ${RELEASE_NAME}-odm-decisionserverconsole
port:
number: 9443
- path: /DecisionService
pathType: Prefix
backend:
service:
name: ${RELEASE_NAME}-odm-decisionserverruntime
port:
number: 9443
- path: /DecisionRunner
pathType: Prefix
backend:
service:
name: ${RELEASE_NAME}-odm-decisionrunner
port:
number: 9443
5 changes: 4 additions & 1 deletion platform/azure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,13 @@ helm install <release> ibmcharts/ibm-odm-prod --version 22.1.0 \
--set externalDatabase.secretCredentials=<odmdbsecret> \
--set service.ingress.enabled=true --set service.ingress.tlsSecretRef=<mycompanytlssecret> \
--set service.ingress.tlsHosts={mycompany.com} --set service.ingress.host=mycompany.com \
--set service.ingress.annotations={"kubernetes.io/ingress.class: nginx"\,"nginx.ingress.kubernetes.io/backend-protocol: HTTPS"\,"nginx.ingress.kubernetes.io/affinity: cookie"} \
--set service.ingress.annotations={"kubernetes.io/ingress.class: nginx"\,"nginx.ingress.kubernetes.io/backend-protocol: HTTPS"} \
--set license=true --set usersPassword=<password>
```

> **Note**
> By default, the NGINX Ingress controller does not enable sticky session. If you want to use sticky session to connect to DC, refer to [Using sticky session for Decision Center connection](../../contrib/sticky-session/README.md)
### Edit your /etc/hosts

```
Expand Down
3 changes: 3 additions & 0 deletions platform/eks/README-NGINX.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ helm install mycompany ibmcharts/ibm-odm-prod --version 22.2.0 -f eks-rds-nginx-
>```bash
>helm install mycompany ibmcharts/ibm-odm-prod --version 22.2.0 -f eks-nginx-values.yaml
>```
> **Note**
> By default, NGINX does not enable sticky session. If you want to use sticky session to connect to DC, refer to [Using sticky session for Decision Center connection](../../contrib/sticky-session/README.md)
3 changes: 3 additions & 0 deletions platform/gcloud/README_NGINX.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ helm install mycompany ibmcharts/ibm-odm-prod --version 22.2.0 \
--set service.ingress.annotations={"kubernetes.io/ingress.class: nginx"}
```

> **Note**
> By default, NGINX does not enable sticky session. If you want to use sticky session to connect to DC, refer to [Using sticky session for Decision Center connection](../../contrib/sticky-session/README.md)
### 3. Check the deployment and access ODM services

Refer to the [the main README](README.md#b-check-the-topology) to check the deployment and access the ODM services.
Expand Down

0 comments on commit 60a5633

Please sign in to comment.