In this article, we will focus on an advanced configuration of Decision Center with ODM on Kubernetes.
As a prerequisite, if you are not comfortable with ODM on Kubernetes deployment, it is preferable to have a look at the blog explaining
how to deploy ODM on Kubernetes with the helm chart.
Decision Center allows you to define where the ruleset compiled version cache is located on the file system.
This feature allows to save a lot of time when deploying again a ruleset on the Rule Execution Server.
To find more details about this feature, you can have a look at the
Decision Center settings.However, when Decision Center is used in a Kubernetes context, there are specific constraints like:
- The existing cache files are lost after a Decision Center pod restart if no persistence is set
- The cache is not shared by several Decision Center pods if the deployment is scaled up
We will use some ODM on Kubernetes out-of-the-box features to solve these issues:
- The possibility to define a Decision Center persistence associated to a specific /config/customlib file path
- The possibility to define the Decision Center JVM options to set the location of build ruleset cache
1/ Create a Persistent Volume Claim
First of all, we will use the standard way to manage storage on Kubernetes with a
Persistent Volume (PV).
If only one Decision Center Pod is used, then the ReadWriteOnce access mode is enough.
But, if Decision Center is scaled up for better performance, it is preferable to change the
PVC access mode to ReadWriteMany to allow all DC pods to write on the PV.
Depending on the platform, the relevant storage must be chosen to allow the ReadWriteMany access mode.
For example, on OpenShift, you can find
here the supported storage volume according to the access mode.
ODM on Kubernetes allows you to manage
Decision Center Business Console customization using a Persistent Volume Claim definition.
a/ Create a PersistentVolumeClaim YAML file custom-dc-libs-pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-custom-dc-libs-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
b/ Create the PVC
Use the following command to create the PVC :
kubectl create -f custom-dc-libs-pvc.yaml
The my-custom-dc-libs-pvc Kubernetes resource is created. We can bind it to the Helm Chart parameter:
decisionCenter:
customlibPvc: my-custom-dc-libs-pvc
Now, the defined persistent volume is bound to the /config/customlib file path inside the Decision Center container.
2/ Define a custom Decision Center JVM options configmap
The ODM on Kubernetes Decision Center deployment uses some default JVM options that are stored in a configmap:
-Duser.timezone=Europe/Paris
-Dcom.ibm.jsse2.overrideDefaultTLS=true
-Dclient.encoding.override=UTF-8
-Dfile.encoding=UTF-8
As explained in Decision Center settings , the "Path of the location of the cache used to store build files" description mentions a user.name JVM option that will be combined to ilog.rules.teamserver.build.path to determine the location.
So, we will use these JVM environment variables to use the same location for all Decision Center pods and associate it to the /config/customlib file path that is bound to the previously created my-custom-dc-libs-pvc persistent volume claim.
a/ Create a Decision Center JVM options configmap YAML file my-dc-jvm-options-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: my-dc-jvm-options-configmap
data:
dc-jvm-options: |
-Duser.timezone=Europe/Paris
-Dcom.ibm.jsse2.overrideDefaultTLS=true
-Dclient.encoding.override=UTF-8
-Dfile.encoding=UTF-8
-Dilog.rules.teamserver.build.path=/config/customlib/buildcache
-Duser.name=all
b/ Create the Configmap
Use the following command to create the configmap :
kubectl create -f my-dc-jvm-options-configmap.yaml
Now the my-dc-jvm-options-configmap Kubernetes resource is created. We can bind it to the Helm Chart parameter:
decisionCenter:
jvmOptionsRef: my-dc-jvm-options-configmap
3/ Install the ODM release
Now, as explained in how to deploy ODM on k8s with the helm chart , we just have to use the previously created Kubernetes resources, the my-custom-dc-libs-pvc Persistent Volume Claim and the my-dc-jvm-options-configmap DC JVM options configmap when we create an ODM instance by setting the ODM on Kubernetes Helm chart parameters:
helm install myodmrelease ibmcharts/ibm-odm-prod \
--set image.repository=cp.icr.io/cp/cp4a/odm --set image.pullSecrets=icregistry-secret \
--set internalDatabase.persistence.enabled=false \
--set decisionCenter.customlibPvc=my-custom-dc-libs-pvc \
--set decisionCenter.jvmOptionsRef=my-dc-jvm-options-configmap