Helm Charts for Expertflow CX Solution - Developer Edition
Instructions for Developers
Component Chart
A general Chart has a hierarchy like below
chart-name/
├── charts
├── Chart.yaml
├── templates
│ ├── configmap.yaml
│ ├── deployment.yaml
│ ├── _helpers.tpl
│ ├── hpa.yaml
│ ├── ingress.yaml
│ ├── NOTES.txt
│ ├── serviceaccount.yaml
│ └── service.yaml
└── values.yaml
Chart.yaml contains metadata about the chart, like its version, appVersion and related information. Whenever there is a change in the application , the appVersion is incremented using semantic versioning. The chart version is incremented when there is a change in the chart. In simpler words a single appVersion can be maintained across different chart version and vice a versa
templates directory contains actual deployment contents for the component, with every single file being evaluated by a certain variable or function in the values file ( details given below )
values.yaml file for component is main file where end-user is allowed to change/update their required parameters and based on those evaluations are made when generating templates.
Meta Chart ( ef-cx )
For Expertflow Solution, a global Chart is created which on its own doesn't do any thing except it
Create a generic FQDN variable which will be used across all the sub-charts
defines a global registry variable to provide offline deployments
creates commonEFConnection configmap which is populated in component charts where needed.
creates Image Pull Secret for the images to be pulled from a certain registry
creates SSL certificate as secrete required for all ingress routes.
declares sub-charts.
details are given below for actions performed by the meta-chart.( values.yaml ).
Generally, below given parameters are evaluated when the Chart is deployed.
{{ .Release.Name }} is replaced with the release name of the helm install command
{{ .Release.Namespace }} refers to the current namespace where the solution is to be deployed.
{{ .Values.global.ingressRouter }} will be replaced with the corresponding value from the values.yaml file.
Global Chart Details
In addition to sub-chart details, below given are the details for this meta chart. Any key:value pair present in this file supersedes the values file in sub-chart's values file.
Section | Item | Details | default |
---|---|---|---|
global | ingressRouter | FQDN used for the EF-CX Solution | “devops.ef.com” |
imageRegistry | default container registry to pull images from | "gitimages.expertflow.com" | |
ingressCertName | default ingress certificate secret name. must be created before install | "ef-ingress-tls-secret" | |
ingressClassName | ingress class name | “nginx” | |
commonIngressAnnotations | common annotations for all ingress resources | ““ | |
efCommonVars_IS_WRAP_UP_ENABLED | Common Environment Variable | true | |
efCommonVars_WRAPUP_TIME | Common Environment Variable | "60" | |
efCommonVars_DEFAULT_ROOM_NAME | Common Environment Variable | CC | |
efCommonVars_DEFAULT_ROOM_LABEL | Common Environment Variable | CC | |
efCommonVars_DEFAULT_ROOM_DESCRIPTION | Common Environment Variable | Contact Center Room | |
efCommonVars_CONVERSATION_SEARCH_WINDOW_HRS | Common Environment Variable | "24" | |
efCommonVars_TZ | Common Environment Variable | UTC | |
efCommonVars_MASK_ATTRIBUTES_PATH | Common Environment Variable | /sensitive.js | |
efCommonVars_LOGGING_CONFIG | Common Environment Variable | /logback/logback-spring.xml | |
efCommonVars_ROOM_IS_USER_ID | Common Environment Variable | false | |
clusterDomain | root domain for the cluster DNS | “cluster.local” | |
imageCredentials | registry | container image registry, must be same as global.imageRegistry | gitimages.expertflow.com |
username | username for the registry | efcx | |
password | password for the user of the registry | RecRpsuH34yqp56YRFUb | |
email address for the registry config | devops@expertflow.com | ||
efConnectionVars | Contains list of all the sub-charts related connection parameters | list of parameters. | |
sub-chart | |||
enabled | enable of disable a sub-chart deployment. true | false | true |
Image Pull Secret is created at runtime based on these variables, a valid dockerconfig in JSON format is created at runtime and added to the kubernetes engine as secret with the name of ef-gitlab-secret
All sub-charts are named after the component name for which it is developed and its values are evaluated from its values.yaml file
Create a new sub-chart
All sub-charts and their corresponding values.yaml
files are present for validation purposes. All values are being inherited from the global chart’s values.yaml
file, nothing is implemented at the sub-chart level.
To create a new sub chart, copy the kubernetes/helm/TEMPLATE
folder as the target component name. Replace all the occurences of <COMPONENET-NAME>
to appropriate name.
cd cim-solution/kubernetes/helm/Core
cp -rvp ../TEMPLATE charts/<COMPONENT-NAME>
Update the component details
sed -i -e 's@___COMPONENT___NAME___@<COMPONENET-NAME>@g' charts/<COMPONENT-NAME>/values.yaml charts/<COMPONENT-NAME>/Chart.yaml
Add the component to the global chart’s Chart.yaml
with an entry like below:
- name: <COMPONENET-NAME>
version: 1.0.0
condition: <COMPONENET-NAME>.enabled
repository: file://charts/<COMPONENET-NAME>
All sub-charts must adhere to semvers conventions used and should be updated whenever there is a change in the chart's structure like env, cm, svc or deployment is changed.
Change the version of the chart to next available semver number
update the sub-chart's version in global chart's Chart.yaml
Update the dependancies for the global chart by running
rm -f Chart.lock charts/*.tgz ;helm dependency update .;helm dependency build .
Sample Chart definition
Deploy the solution using helm ( local method )
This procedure expects that CX External components are already deployed using CX Deployment on Kubernetes
Clone the repo
git clone -b CX-4.6-helm-v1 https://efcx:RecRpsuH34yqp56YRFUb@gitlab.expertflow.com/cim/cim-solution.git CX-4.6-helm-v1
cd CX-4.6-helm-v1/kubernetes
Create expertflow namespace
kubectl create namespace expertflow
Create TLS Certificate for the ingress resources
kubectl -n ef-external create secret tls ef-ingress-tls-secret \
--key pre-deployment/certificates/server.key \
--cert pre-deployment/certificates/server.crt
Transfer the Mongo and Redis Certificates from ef-external namespace
kubectl get secret mongo-mongodb-ca -n ef-external -o yaml | sed 's/namespace: ef-external/namespace: expertflow/' | kubectl create -f -
kubectl get secret redis-crt -n ef-external -o yaml | sed 's/namespace: ef-external/namespace: expertflow/' | kubectl create -f -
kubectl get secret ef-postgresql-crt -n ef-external -o yaml | sed 's/namespace: ef-external/namespace: expertflow/' | kubectl create -f -
Setup default translation file for Agent Desk
kubectl -n expertflow create configmap ef-app-translations-cm --from-file=pre-deployment/app-translations/unified-agent/i18n
Setup default canned messages translations file for Agent Desk
kubectl -n expertflow create configmap ef-canned-messages-cm --from-file=pre-deployment/app-translations/unified-agent/canned-messages
Apply CRM ConfigMap for Agent Desk ( Option, only when Agent-Desk embedding in CRM is required )
kubectl -n expertflow create configmap ef-crm-service-cm --from-file=pre-deployment/crm-service/
Apply Conversation Controller ConfigMaps
kubectl -n expertflow create configmap ef-conversation-controller-actions-cm --from-file=pre-deployment/conversation-Controller/actions
kubectl -n expertflow create configmap ef-conversation-controller-actions-utils-cm --from-file=pre-deployment/conversation-Controller/utils
kubectl -n expertflow create configmap ef-conversation-controller-actions-pycache-cm --from-file=pre-deployment/conversation-Controller/__pycache__
Apply ConfigMap to enable log masking for all components in expertflow
namespace:-
kubectl apply -f pre-deployment/logback/
kubectl -n expertflow create configmap ef-logback-cm --from-file=pre-deployment/logback/logback-spring.xml
For development purposes, developers can update the global
chart’s values.yaml
file with the required changes and then deploy the CX solution on their local system using. Replace the <FQDN> with domain.
cd helm/Core
helm upgrade --install --namespace expertflow --create-namespace --set global.ingressRouter=<FQDN> --debug --values values.yaml ef-cx .
Troubleshooting Steps.
Rendering Helm charts without installing them
As a developer of helm charts, You can also render the changes without installing the helm chart directly by
helm install --namespace expertflow --set global.ingressRouter=<FQDN> --dry-run --debug "ef-cx" .
Or Just to render the templates ( inside the chart directory )
helm template --debug --values values.yaml .
there are certain scenarios where the YAML is not rendered correctly ( due to incorrect spaces or tab characters ) You can disable the api-validation using ( inside the chart directory )
helm install --namespace <namespace> <release-name> --dry-run --disable-openapi-validation --debug --values values.yaml .
Dumping all the rendered manifests to a folder
You can also dump all the generated/rendered manifests into a folder for evaluation using
Check if the Go language is installed on your system
go version
if go-lang is not installed, you can install the go-lang by following instruction on https://go.dev/doc/install
once go-lang is installed, run this command to fetch the required go module
go get -u github.com/databus23/schelm
export the required environment variables for go-lang
export GOPATH=$(go env GOPATH)
add the go-lang in your PATH
export PATH=$PATH:$GOPATH/bin
export all the rendered charts into /root/rendered
folder
helm install --namespace <namespace> <release-name> --set global.ingressRouter=<FQDN> --dry-run --debug .|schelm /root/rendered