Skip to content

Commit

Permalink
Added hpa configuration for core-services and metrics (#2157)
Browse files Browse the repository at this point in the history
  • Loading branch information
SriPadma8997-egov authored Dec 6, 2023
1 parent 8d0c5b9 commit 046be21
Show file tree
Hide file tree
Showing 105 changed files with 502 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,8 @@ controller:
## @param controller.resources.requests The requested resources for the container
##
resources:
limits: {}
requests: {}
limits: 2Gi
requests: 1.5Gi
## Kafka pods' Security Context
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod
## @param controller.podSecurityContext.enabled Enable security context for the pods
Expand Down
30 changes: 30 additions & 0 deletions deploy-as-code/helm/charts/common/templates/_hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{- define "common.hpa" -}}
{{- if .Values.hpa.enabled -}}
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "common.name" . }}
namespace: {{ .Values.namespace }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ template "common.name" . }}
minReplicas: 1
maxReplicas: 1
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 90
- type: Resource
resource:
name: memory
target:
type: Utilization
averageValue: 90
{{- end -}}
{{- end -}}
12 changes: 10 additions & 2 deletions deploy-as-code/helm/charts/common/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,22 @@ lifecycle:
- -c
- "sleep 10"

memory_limits: "256Mi"
memory_limits: "512Mi"
memory_requests: "256Mi"
cpu_limits: "50m"
cpu_requests: "10m"
resources: |
{{- if eq .Values.appType "java-spring" -}}
requests:
memory: {{ .Values.memory_limits | quote }}
cpu: {{ .Values.cpu_requests | quote }}
memory: {{ .Values.memory_requests | quote }}
limits:
cpu: {{ .Values.cpu_limits | quote }}
memory: {{ .Values.memory_limits | quote }}
{{- end -}}
hpa:
enabled: true
## Allows specification of additional environment variables
extraEnv:
java: |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# hpa.yaml
{{- template "common.hpa" . -}}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ initContainers:
# Container Configs
image:
repository: "audit-service"
replicas: "1"
#replicas: "1"
healthChecks:
enabled: true
livenessProbePath: "/audit-service/health"
Expand All @@ -30,6 +30,11 @@ tracing-enabled: true
heap: "-Xmx64m -Xms64m"
java-args: "-Dspring.profiles.active=monitoring"

memory_requests: "256Mi"
memory_limits: "256Mi"
cpu_limits: "20m"
cpu_requests: "10m"

# Additional Container Envs
env: |
- name: SPRING_KAFKA_CONSUMER_GROUP_ID
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# hpa.yaml
{{- template "common.hpa" . -}}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ initContainers:
# Container Configs
image:
repository: "boundary-service"
replicas: "1"
#replicas: "1"
healthChecks:
enabled: true
livenessProbePath: "/boundary-service/health"
Expand All @@ -35,6 +35,11 @@ kafka-topics-update-boundary-hierarchy: "update-boundary-hierarchy-definition"
kafka-topics-create-boundary-relationship: "save-boundary-relationship"
kafka-topics-update-boundary-relationship: "update-boundary-relationship"

memory_requests: "256Mi"
memory_limits: "512Mi"
cpu_limits: "20m"
cpu_requests: "10m"

# Additional Container Envs
env: |
- name: SERVER_CONTEXT_PATH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ initContainers:
# Container Configs
image:
repository: "chatbot"
replicas: "1"
#replicas: "1"
appType: "java-spring"
tracing-enabled: true
heap: "-Xmx192m -Xms192m"
java-args: ""

memory_requests: "256Mi"
memory_limits: "256Mi"
cpu_limits: "20m"
cpu_requests: "10m"

# Additional Container Envs
env: |
- name: KAFKA_BOOTSTRAP_SERVER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,16 @@ initContainers:
# Container Configs
image:
repository: "chatbot"
replicas: "1"
#replicas: "1"
tracing-enabled: true
heap: "-Xmx192m -Xms192m"
java-args: ""

memory_requests: "256Mi"
memory_limits: "256Mi"
cpu_limits: "20m"
cpu_requests: "10m"

# Additional Container Envs
env: |
- name: SPRING_DATASOURCE_URL
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# hpa.yaml
{{- template "common.hpa" . -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# hpa.yaml
{{- template "common.hpa" . -}}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ initContainers: {}
# Container Configs
image:
repository: "egov-accesscontrol"
replicas: "1"
#replicas: "1"
healthChecks:
enabled: true
livenessProbePath: "/access/health"
Expand All @@ -25,6 +25,11 @@ tracing-enabled: true
heap: "-Xmx192m -Xms192m"
java-args: ""

memory_requests: "256Mi"
memory_limits: "256Mi"
cpu_limits: "20m"
cpu_requests: "10m"

# Additional Container Envs
env: |
- name: SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# hpa.yaml
{{- template "common.hpa" . -}}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@ initContainers:
# Container Configs
image:
repository: "egov-common-masters"
replicas: "1"
#replicas: "1"
appType: "java-spring"
tracing-enabled: true
heap: "-Xmx192m -Xms192m"

memory_requests: "256Mi"
memory_limits: "256Mi"
cpu_limits: "20m"
cpu_requests: "10m"

# Additional Container Envs
env: |
- name: SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# hpa.yaml
{{- template "common.hpa" . -}}
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@ initContainers:
# Container Configs
image:
repository: "egov-data-uploader"
replicas: "1"
#replicas: "1"
appType: "java-spring"
tracing-enabled: true
heap: "-Xmx64m -Xms64m"
upload-json-path: ""
template-download-prefix: ""
internal-file-folder-path: ""

memory_requests: "256Mi"
memory_limits: "256Mi"
cpu_limits: "20m"
cpu_requests: "10m"

# Additional Container Envs
env: |
- name: UPLOAD_JSON_PATH
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# hpa.yaml
{{- template "common.hpa" . -}}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ initContainers:
# Container Configs
image:
repository: "egov-document-uploader"
replicas: "1"
#replicas: "1"
healthChecks:
enabled: true
livenessProbePath: "/egov-document-uploader/health"
Expand All @@ -30,6 +30,11 @@ tracing-enabled: true
heap: "-Xmx64m -Xms64m"
java-args: "-Dspring.profiles.active=monitoring"

memory_requests: "256Mi"
memory_limits: "256Mi"
cpu_limits: "20m"
cpu_requests: "10m"

# Additional Container Envs
env: |
- name: SPRING_KAFKA_CONSUMER_GROUP_ID
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# hpa.yaml
{{- template "common.hpa" . -}}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ initContainers:
# Container Configs
image:
repository: "egov-enc-service"
replicas: "1"
#replicas: "1"
# healthChecks:
# enabled: true
# livenessProbePath: "/egov-enc-service/health"
Expand All @@ -36,6 +36,11 @@ java-args: "-Dspring.profiles.active=monitoring"

master-password-provider: software

memory_requests: "256Mi"
memory_limits: "512Mi"
cpu_limits: "20m"
cpu_requests: "10m"

# Additional Container Envs
env: |
- name: SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# hpa.yaml
{{- template "common.hpa" . -}}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ingress:
# Container Configs
image:
repository: "egov-filestore"
replicas: "1"
#replicas: "1"
healthChecks:
enabled: true
livenessProbePath: "/filestore/health"
Expand All @@ -36,6 +36,11 @@ is-s3-enabled: true
persistence:
enabled: false

memory_requests: "256Mi"
memory_limits: "512Mi"
cpu_limits: "20m"
cpu_requests: "10m"

# Additional Container Envs
env: |
- name: SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# hpa.yaml
{{- template "common.hpa" . -}}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ initContainers:
# Container Configs
image:
repository: "egov-idgen"
replicas: "1"
#replicas: "1"
healthChecks:
enabled: true
livenessProbePath: "/egov-idgen/health"
Expand All @@ -32,6 +32,11 @@ java-args: "-Dspring.profiles.active=monitoring"
idformat-from-mdms: "false"
autocreate-new-seq: "false"

memory_requests: "256Mi"
memory_limits: "512Mi"
cpu_limits: "20m"
cpu_requests: "10m"

# Additional Container Envs
env: |
- name: SERVER_PORT
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# hpa.yaml
{{- template "common.hpa" . -}}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ initContainers: {}
# Container Configs
image:
repository: "egov-index-custom-consumer"
replicas: "1"
#replicas: "1"
appType: "java-spring"
tracing-enabled: true
heap: "-Xmx192m -Xms192m"

memory_requests: "256Mi"
memory_limits: "256Mi"
cpu_limits: "20m"
cpu_requests: "10m"

# Additional Container Envs
env: |
- name: EGOV_PT_HOST
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# hpa.yaml
{{- template "common.hpa" . -}}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ initContainers:
# Container Configs
image:
repository: "egov-indexer"
replicas: "1"
#replicas: "1"
healthChecks:
enabled: true
livenessProbePath: "/egov-indexer/health"
Expand All @@ -34,6 +34,11 @@ tracing-enabled: true
egov-indexer-yaml-repo-path: "file:///work-dir/configs/egov-indexer/billingservices-indexer.yml,file:///work-dir/configs/egov-indexer/collection-indexer.yml,file:///work-dir/configs/egov-indexer/egov-telemetry-indexer.yml,file:///work-dir/configs/egov-indexer/egov-uploader-indexer.yml,file:///work-dir/configs/egov-indexer/error-queue.yml,file:///work-dir/configs/egov-indexer/finance-rolloutadotpion-indexer.yml,file:///work-dir/configs/egov-indexer/payment-indexer.yml,file:///work-dir/configs/egov-indexer/rainmaker-pgr-indexer.yml,file:///work-dir/configs/egov-indexer/rainmaker-pt-indexer.yml,file:///work-dir/configs/egov-indexer/tradelicense-indexer.yml,file:///work-dir/configs/egov-indexer/rainmaker-tl-indexer.yml"
heap: "-Xmx192m -Xms192m"

memory_requests: "512Mi"
memory_limits: "768Mi"
cpu_limits: "50m"
cpu_requests: "10m"

# Additional Container Envs
env: |
- name: EGOV_SERVICES_INFRA_INDEXER_HOST
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# hpa.yaml
{{- template "common.hpa" . -}}
Loading

0 comments on commit 046be21

Please sign in to comment.