Skip to content

Commit

Permalink
SB-25552 - UCI odk deployment (#2726)
Browse files Browse the repository at this point in the history
UCI ODK Heml Chart
  • Loading branch information
shiva-rakshith authored Jul 20, 2021
1 parent 634240b commit 8800eaa
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 1 deletion.
23 changes: 22 additions & 1 deletion ansible/roles/stack-sunbird/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ service_env:
- ../../../../ansible/roles/stack-sunbird/templates/outbound_logback.xml
transformer:
- ../../../../ansible/roles/stack-sunbird/templates/transformer.env
- ../../../../ansible/roles/stack-sunbird/templates/transformer_industry_feedback.xml
- ../../../../ansible/roles/stack-sunbird/templates/transformer_industry_feedback.xml
odk: ../../../../ansible/roles/stack-sunbird/templates/odk.env
orchestrator:
- ../../../../ansible/roles/stack-sunbird/templates/orchestrator.env

Expand Down Expand Up @@ -890,6 +891,26 @@ uci_orchestrator_liveness_readiness:
timeoutSeconds: 5
failureThreshold: 2

uci_odk_liveness_readiness:
healthcheck: true
readinessProbe:
httpGet:
path: /service/health
port: 8080
initialDelaySeconds: 15
periodSeconds: 15
timeoutSeconds: 5
failureThreshold: 2
successThreshold: 1
livenessProbe:
httpGet:
path: /service/health
port: 8080
initialDelaySeconds: 15
periodSeconds: 15
timeoutSeconds: 5
failureThreshold: 2

adminutil__access_keyprefix: "access"
adminutil__access_keystart: 0
adminutil__access_keycount: 0
Expand Down
7 changes: 7 additions & 0 deletions ansible/roles/stack-sunbird/templates/odk.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DB_URL=jdbc:postgres://{{uci_postgres_host}}:5432/{{uci_odk_postgres_database}}?user={{uci_postgres_user}}&password={{uci_postgres_password}}&sslmode=require
DB_RESOURCE_NAME=jdbc/{{uci_odk_postgres_database}}
DB_USERNAME={{uci_postgres_user}}
DB_PASSWORD={{uci_postgres_password}}
DB_SCHEMA=aggregate
DB_NAME={{uci_odk_postgres_database}}
DB_PORT=5432
5 changes: 5 additions & 0 deletions kubernetes/helm_charts/core/odk/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: odk
version: 0.1.0
62 changes: 62 additions & 0 deletions kubernetes/helm_charts/core/odk/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
namespace: {{ .Values.namespace }}
annotations:
reloader.stakater.com/auto: "true"
spec:
replicas: {{ .Values.replicaCount }}
strategy:
rollingUpdate:
maxSurge: {{ .Values.strategy.maxsurge }}
maxUnavailable: {{ .Values.strategy.maxunavailable }}
selector:
matchLabels:
app: {{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Chart.Name }}
spec:
{{- if .Values.imagepullsecrets }}
imagePullSecrets:
- name: {{ .Values.imagepullsecrets }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.dockerhub }}/{{ .Values.repository }}:{{ .Values.image_tag }}"
imagePullPolicy: Always
env:
- name: JAVA_OPTIONS
value: {{ .Values.env.javaoptions | quote }}
envFrom:
- configMapRef:
name: {{ .Chart.Name }}-config
resources:
{{ toYaml .Values.resources | indent 10 }}
ports:
- containerPort: {{ .Values.network.port }}
{{- if .Values.healthcheck }}
livenessProbe:
{{ toYaml .Values.livenessProbe | indent 10 }}
readinessProbe:
{{ toYaml .Values.readinessProbe | indent 10 }}
{{- end }}

---
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}-service
namespace: {{ .Values.namespace }}
labels:
app: {{ .Chart.Name }}
spec:
ports:
- name: http-{{ .Chart.Name }}
protocol: TCP
port: {{ .Values.network.targetport }}
selector:
app: {{ .Chart.Name }}
27 changes: 27 additions & 0 deletions kubernetes/helm_charts/core/odk/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ .Chart.Name }}
namespace: {{ .Values.namespace }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ .Chart.Name }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
35 changes: 35 additions & 0 deletions kubernetes/helm_charts/core/odk/values.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
### Default variable file for cert-service ###

namespace: {{ namespace }}
imagepullsecrets: {{ imagepullsecrets }}
dockerhub: {{ dockerhub }}

env:
javaoptions: {{uci_odk_java_mem_limit|default('-Xmx600m')}}

replicaCount: {{uci_odk_replicacount|default(1)}}
repository: {{uci_odk_repository|default('odk')}}
image_tag: {{ image_tag }}
resources:
requests:
cpu: {{uci_odk_cpu_req|default('100m')}}
memory: {{uci_odk_mem_req|default('100Mi')}}
limits:
cpu: {{uci_odk_cpu_limit|default('1')}}
memory: {{uci_odk_mem_limit|default('1024Mi')}}
network:
port: 8080
targetport: 8080
strategy:
type: RollingUpdate
maxsurge: {{ uci_odk_maxsurge|default('25%') }}
maxunavailable: {{ uci_odk_maxunavailable|default('25%') }}

{{ uci_odk_liveness_readiness | to_nice_yaml }}

autoscaling:
enabled: {{ uci_odk_autoscaling_enabled | default('false') }}
minReplicas: {{ uci_odk_autoscaling_minReplicas|default(1) }}
maxReplicas: {{ uci_odk_autoscaling_maxReplicas|default(2) }}
targetCPUUtilizationPercentage: {{ uci_odk_autoscaling_targetCPUUtilizationPercentage|default(60) }}
targetMemoryUtilizationPercentage: {{ uci_odk_autoscaling_targetMemoryUtilizationPercentage|default('') }}

0 comments on commit 8800eaa

Please sign in to comment.