mirror of
https://github.com/Telecominfraproject/wlan-cloud-helm.git
synced 2025-10-29 09:42:29 +00:00
270 lines
12 KiB
YAML
270 lines
12 KiB
YAML
{{- $kafka := include "kafka.service" . -}}
|
|
{{- $cassandra := include "cassandra.service" . -}}
|
|
{{- $ns := include "common.namespace" . -}}
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ include "common.fullname" . }}
|
|
namespace: {{ include "common.namespace" . }}
|
|
labels:
|
|
{{- include "common.labels" . | nindent 4 }}
|
|
spec:
|
|
replicas: {{ .Values.replicaCount }}
|
|
selector:
|
|
matchLabels:
|
|
{{- include "common.selectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{- include "common.selectorLabels" . | nindent 8 }}
|
|
spec:
|
|
imagePullSecrets:
|
|
- name: "{{ include "common.namespace" . }}-docker-registry-key"
|
|
serviceAccountName: {{ include "common.serviceAccountName" . }}
|
|
securityContext:
|
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
|
initContainers:
|
|
{{- include "jmxPrometheus.initContainer" . | nindent 8 }}
|
|
- name: wait-for-services
|
|
image: {{ .Values.waitForServicesImage.registry }}/{{ .Values.waitForServicesImage.repository }}:{{ .Values.waitForServicesImage.tag }}
|
|
args:
|
|
- "-service={{ .Release.Name }}-kafka-headless"
|
|
- "-service={{ .Release.Name }}-cassandra"
|
|
- -check_interval=5
|
|
- name: {{ include "common.name" . }}-create-db-schema-cassandra
|
|
env:
|
|
- name: CASSANDRA_PORT_NUMBER
|
|
value: "{{ .Values.cassandra.port }}"
|
|
- name: SCHEMA_REPO_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "common.fullname" . }}-creds
|
|
key: schema-repo-user
|
|
- name: SCHEMA_REPO_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "common.fullname" . }}-creds
|
|
key: schema-repo-password
|
|
image: {{ .Values.cassandra.registry }}/{{ .Values.cassandra.repository }}:{{ .Values.cassandra.tag }}
|
|
imagePullPolicy: {{ .Values.pullPolicy | default .Values.global.pullPolicy }}
|
|
command:
|
|
- sh
|
|
- -c
|
|
- |
|
|
apt update
|
|
apt -y install curl
|
|
echo "***** Fetching cloud-sdk-schema-cassandra.cql from JFrog *****"
|
|
curl --insecure -u$SCHEMA_REPO_USER:$SCHEMA_REPO_PASSWORD -O "https://tip-tip-wlan-cloud-docker-repo.jfrog.io/artifactory/tip-wlan-cloud-schemas/1.3.0-SNAPSHOT/cql/cloud-sdk-schema-cassandra.cql"
|
|
echo "***** Now executing cloud-sdk-schema-cassandra.cql and creating/updating schema on Cassandra instance *****"
|
|
counter=0
|
|
status=1
|
|
while [ $counter -lt 20 ] && [ $status -ne 0 ]
|
|
do
|
|
echo {{ $cassandra }} service isnt ready. Tried $counter times
|
|
cqlsh --cqlshrc /opt/tip-wlan/cqlshrc.tip-wlan -f /cloud-sdk-schema-cassandra.cql
|
|
status=$(echo $?)
|
|
echo Response when executing cqlsh on {{ $cassandra }} service = $status
|
|
counter=`expr $counter + 1`
|
|
sleep 5
|
|
done
|
|
if [ $status -eq 0 ]
|
|
then
|
|
## TW-892: get tip_user from user table
|
|
cqlsh --cqlshrc /opt/tip-wlan/cqlshrc.tip-wlan -e "list roles of 'tip_user';"
|
|
# if tip_user does not exists, status would be non-zero (generally 2)
|
|
status=$(echo $?)
|
|
if [ $status -eq 0 ]
|
|
then
|
|
echo 'tip_user exists'
|
|
else
|
|
## tip_user does not exist; run the CQL again to create it
|
|
cqlsh --cqlshrc /opt/tip-wlan/cqlshrc.tip-wlan -f /cloud-sdk-schema-cassandra.cql
|
|
fi
|
|
echo DB-Schema has been created/updated in Cassandra
|
|
else
|
|
echo Failed to create/update schema in Cassandra after 100 secs.
|
|
echo Check if at least 2 Cassandra nodes are in Running state.
|
|
exit 1
|
|
fi
|
|
ports:
|
|
- containerPort: {{ .Values.cassandra.port }}
|
|
name: tcp-cassandra
|
|
protocol: TCP
|
|
resources:
|
|
requests:
|
|
cpu: 50m
|
|
memory: 256Mi
|
|
terminationMessagePath: /dev/termination-log
|
|
terminationMessagePolicy: File
|
|
volumeMounts:
|
|
- mountPath: /opt/tip-wlan/cqlshrc.tip-wlan
|
|
name: ssc-configurations
|
|
subPath: cqlshrc.tip-wlan
|
|
- mountPath: /opt/tip-wlan/certs/cassandraservercert.pem
|
|
name: certificates
|
|
subPath: cassandraservercert.pem
|
|
- mountPath: /opt/tip-wlan/certs/cassandraserverkey_dec.pem
|
|
name: certificates
|
|
subPath: cassandraserverkey_dec.pem
|
|
- mountPath: /opt/tip-wlan/certs/cacert.pem
|
|
name: certificates
|
|
subPath: cacert.pem
|
|
containers:
|
|
- name: {{ .Chart.Name }}
|
|
securityContext:
|
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
|
{{- if .Values.global.testingEnabled }}
|
|
image: {{ .Values.global.repository.registry }}/{{ .Values.image.name }}:{{ .Values.image.tag }}-{{.Values.global.testingTimestamp}}
|
|
{{- else }}
|
|
image: {{ .Values.global.repository.registry }}/{{ .Values.image.name }}:{{ .Values.image.tag }}
|
|
{{- end }}
|
|
imagePullPolicy: {{ .Values.pullPolicy | default .Values.global.pullPolicy }}
|
|
env:
|
|
{{- include "common.env" . | nindent 12 }}
|
|
- name: tip.wlan.kafka.bootstrapServers
|
|
value: {{ .Release.Name }}-kafka-headless:9093
|
|
- name: tip.wlan.kafka.sslKeyPassword
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "common.fullname" . }}-creds
|
|
key: sslKeyPassword
|
|
- name: tip.wlan.kafka.sslKeystoreLocation
|
|
value: /opt/tip-wlan/certs/kafka-server.pkcs12
|
|
- name: tip.wlan.kafka.sslKeystorePassword
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "common.fullname" . }}-creds
|
|
key: sslKeystorePassword
|
|
- name: tip.wlan.kafka.sslKeystoreType
|
|
value: PKCS12
|
|
- name: tip.wlan.kafka.sslTruststoreLocation
|
|
value: /opt/tip-wlan/certs/truststore.jks
|
|
- name: tip.wlan.kafka.sslTruststorePassword
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "common.fullname" . }}-creds
|
|
key: sslTruststorePassword
|
|
- name: tip.wlan.kafka.sslTruststoreType
|
|
value: JKS
|
|
- name: tip.wlan.kafka.securityProtocol
|
|
value: SSL
|
|
- name: tip.wlan.kafka.sslEndpointIdentificationAlgorithm
|
|
value: ''
|
|
- name: CASSANDRA_TIP_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "common.fullname" . }}-creds
|
|
key: cassandra_tip_password
|
|
- name: CASSANDRA_TIP_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "common.fullname" . }}-creds
|
|
key: cassandra_tip_user
|
|
- name: CASSANDRA_HOST
|
|
value: {{ $cassandra }}:{{ .Values.cassandra.port }}
|
|
- name: tip_wlan_AsyncExecutor_CorePoolSize
|
|
value: "{{ .Values.scalability.tip_wlan_AsyncExecutor_CorePoolSize }}"
|
|
- name: tip_wlan_AsyncExecutor_MaxPoolSize
|
|
value: "{{ .Values.scalability.tip_wlan_AsyncExecutor_MaxPoolSize }}"
|
|
- name: tip_wlan_AsyncExecutor_QueueCapacity
|
|
value: "{{ .Values.scalability.tip_wlan_AsyncExecutor_QueueCapacity }}"
|
|
- name: tip_wlan_httpClientConfig_maxConnectionsTotal
|
|
value: "{{ .Values.scalability.tip_wlan_httpClientConfig_maxConnectionsTotal }}"
|
|
- name: tip_wlan_httpClientConfig_maxConnectionsPerRoute
|
|
value: "{{ .Values.scalability.tip_wlan_httpClientConfig_maxConnectionsPerRoute }}"
|
|
- name: tip_wlan_maxHttpThreads
|
|
value: "{{ .Values.scalability.tip_wlan_maxHttpThreads }}"
|
|
- name: JVM_MEM_OPTIONS
|
|
value: "{{ .Values.scalability.JVM_MEM_OPTIONS }} {{ include "jmxPrometheus.jvmOpts" . }}"
|
|
|
|
{{- if .Values.probes.enabled }}
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /ping
|
|
port: {{ .Values.service.port2 }}
|
|
scheme: {{ .Values.probes.livenessProbe.scheme }}
|
|
initialDelaySeconds: {{ .Values.probes.livenessProbe.initialDelaySeconds }}
|
|
timeoutSeconds: {{ .Values.probes.livenessProbe.timeoutSeconds }}
|
|
failureThreshold: {{ .Values.probes.livenessProbe.failureThreshold }}
|
|
periodSeconds: {{ .Values.probes.livenessProbe.periodSeconds }}
|
|
successThreshold: {{ .Values.probes.livenessProbe.successThreshold }}
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /ping
|
|
port: {{ .Values.service.port2 }}
|
|
scheme: {{ .Values.probes.readinessProbe.scheme }}
|
|
initialDelaySeconds: {{ .Values.probes.readinessProbe.initialDelaySeconds }}
|
|
timeoutSeconds: {{ .Values.probes.readinessProbe.timeoutSeconds }}
|
|
failureThreshold: {{ .Values.probes.readinessProbe.failureThreshold }}
|
|
periodSeconds: {{ .Values.probes.readinessProbe.periodSeconds }}
|
|
successThreshold: {{ .Values.probes.readinessProbe.successThreshold }}
|
|
startupProbe:
|
|
httpGet:
|
|
path: /ping
|
|
port: {{ .Values.service.port2 }}
|
|
scheme: {{ .Values.probes.readinessProbe.scheme }}
|
|
failureThreshold: {{ .Values.probes.startupProbe.failureThreshold }}
|
|
periodSeconds: {{ .Values.probes.startupProbe.periodSeconds}}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- mountPath: /opt/tip-wlan/certs/client_keystore.jks
|
|
name: certificates
|
|
subPath: client_keystore.jks
|
|
- mountPath: /opt/tip-wlan/certs/truststore.jks
|
|
name: certificates
|
|
subPath: truststore.jks
|
|
- mountPath: /opt/tip-wlan/certs/server.pkcs12
|
|
name: certificates
|
|
subPath: server.pkcs12
|
|
- mountPath: /opt/tip-wlan/certs/kafka-server.pkcs12
|
|
name: certificates
|
|
subPath: kafka-server.pkcs12
|
|
- mountPath: /opt/tip-wlan/certs/cassandra_server_keystore.jks
|
|
name: certificates
|
|
subPath: cassandra_server_keystore.jks
|
|
- mountPath: /app/ssc/logback.xml
|
|
name: ssc-configurations
|
|
subPath: logback.xml
|
|
- mountPath: /app/ssc/cassandra-application.conf
|
|
name: ssc-configurations
|
|
subPath: cassandra-application.conf
|
|
{{- include "jmxPrometheus.configVolumeMount" . | nindent 10 }}
|
|
{{- include "jmxPrometheus.tmpVolumeMount" . | nindent 10 }}
|
|
ports:
|
|
- name: {{ .Values.service.name1 }}
|
|
containerPort: {{ .Values.service.port1 }}
|
|
protocol: TCP
|
|
- name: {{ .Values.service.name2 }}
|
|
containerPort: {{ .Values.service.port2 }}
|
|
protocol: TCP
|
|
{{- if .Values.debug.enabled }}
|
|
- name: {{ .Values.service.name3 }}
|
|
containerPort: {{ .Values.service.port3 }}
|
|
protocol: TCP
|
|
{{- end }}
|
|
{{- include "jmxPrometheus.port" . | nindent 12 }}
|
|
resources:
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
|
{{- with .Values.nodeSelector }}
|
|
nodeSelector:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.affinity }}
|
|
affinity:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
|
|
volumes:
|
|
- name: certificates
|
|
secret:
|
|
secretName: tip-common-cassandra-client-certs
|
|
- name: ssc-configurations
|
|
configMap:
|
|
name: {{ include "common.fullname" . }}-ssc-config
|
|
{{- include "jmxPrometheus.configVolume" . | nindent 6 }}
|
|
{{- include "jmxPrometheus.tmpVolume" . | nindent 6 }}
|