Skip to main content

Deployment

Prerequisites

In order to deploy dialogflow-connector you can apply the following Kubernetes Deployment descriptor to your Airy Core Kubernetes cluster. You can also adapt the following configuration to work with your favorite deployment tool like terraform.

  1. Get google cloud credentials see documentation
  2. Create configmap using the snippet called dialogflow-config.yaml
  3. Deploy the connector by using the snippet called dialogflow-deployment.yaml

There are some variables that need to be taken into account:

  • Dialogflow project ID given by the Google Cloud Console: see documentation
  • The confidence level tells the connector the amount of confidence it should have in order to suggest or give a reply. This value is a percentage so it should be between 0 and 1.
  • The processor waiting time and check periods (in milliseconds) adjust the enrichment of the message before it is being processed by Dialogflow.
    • The processor waiting time represents the amount of time before the message can be enriched by other connectors in the airy cluster before sending it to Dialogflow (for example: 2500).
    • The processor check time represents the amount of time before the message can be enriched by other connectors before forwarding it to Dialogflow (for example: 5000).
  • Default language: if the language in which the message is written cannot be determined, it will default to this value (for example: en for English).

dialogflow-config.yaml

apiVersion: v1
data:
dialogflow-credentials.json: <the content of google json credentials>
kind: ConfigMap
metadata:
name: dialogflow-config
kubectl -n staging create -f dialogflow-configmap.yaml

dialogflow-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
name: enterprise-dialogflow-connector
namespace: staging
labels:
app: dialogflow-connector
type: api
core.airy.co/managed: 'false'
core.airy.co/mandatory: 'false'
core.airy.co/component: enterprise-dialogflow-connector
spec:
replicas: 1
selector:
matchLabels:
app: dialogflow-connector
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app: dialogflow-connector
spec:
containers:
- name: app
image: ghcr.io/airyhq/enterprise/dialogflow-connector:release

imagePullPolicy: Always
envFrom:
- configMapRef:
name: security
- configMapRef:
name: kafka-config
env:
- name: DIALOGFLOW_PROJECT_ID
value: <your dialogflow project id>
- name: GOOGLE_APPLICATION_CREDENTIALS
value: '/app/dialogflow-credentials.json'
- name: CONNECTOR_SUGGESTION_CONFIDENCE_LEVEL
value: <suggestion confidence level a value between 0 and 1>
- name: CONNECTOR_REPLY_CONFIDENCE_LEVEL
value: <reply confidence level a value between 0 and 1>
- name: CONNECTOR_STORE_MESSAGES_PROCESSOR_MAX_WAIT_MILLIS
value: 5000
- name: CONNECTOR_STORE_MESSAGES_PROCESSOR_CHECK_PERIOD_MILLIS
value: 2500
- name: CONNECTOR_DEFAULT_LANGUAGE
value: 'en'
- name: SERVICE_NAME
value: dialogflow-connector
- name: POD_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: REQUESTED_CPU
valueFrom:
resourceFieldRef:
containerName: app
resource: requests.cpu
- name: LIMIT_CPU
valueFrom:
resourceFieldRef:
containerName: app
resource: limits.cpu
- name: LIMIT_MEMORY
valueFrom:
resourceFieldRef:
containerName: app
resource: limits.memory
volumeMounts:
- name: dialogflow-config
mountPath: /app/dialogflow-credentials.json
subPath: dialogflow-credentials.json
livenessProbe:
httpGet:
path: /actuator/health
port: 8080
httpHeaders:
- name: Health-Check
value: health-check
initialDelaySeconds: 60
periodSeconds: 10
failureThreshold: 3
volumes:
- name: dialogflow-config
configMap:
name: dialogflow-config
---
apiVersion: v1
kind: Service
metadata:
name: enterprise-dialogflow-connector
namespace: default
labels:
core.airy.co/prometheus: spring
spec:
ports:
- name: web
port: 80
targetPort: 8080
protocol: TCP
type: NodePort
selector:
app: enterprise-dialogflow-connector
kubectl apply -f dialogflow-deployment.yaml