Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onest hackthon #3896

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ansible/roles/stack-sunbird/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ service_env:
search:
- ../../../../ansible/roles/stack-sunbird/templates/search-service_application.conf
- ../../../../ansible/roles/stack-sunbird/templates/search-service_logback.xml
bpp-search:
- ../../../../ansible/roles/stack-sunbird/templates/search-service_application.conf
- ../../../../ansible/roles/stack-sunbird/templates/search-service_logback.xml
taxonomy:
- ../../../../ansible/roles/stack-sunbird/templates/taxonomy-service_application.conf
- ../../../../ansible/roles/stack-sunbird/templates/taxonomy-service_logback.xml
Expand Down
5 changes: 5 additions & 0 deletions kubernetes/helm_charts/core/bpp-search/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: bpp-search
version: 0.1.0
78 changes: 78 additions & 0 deletions kubernetes/helm_charts/core/bpp-search/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
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 }}
volumes:
- name: {{ .Chart.Name }}-config
configMap:
name: {{ .Chart.Name }}-config
- name: {{ .Chart.Name }}-xml-config
configMap:
name: {{ .Chart.Name }}-xml-config
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.dockerhub }}/{{ .Values.repository }}:{{ .Values.image_tag }}"
imagePullPolicy: Always
env:
- name: JAVA_OPTIONS
value: {{ .Values.env.javaoptions | quote }}
- name: _JAVA_OPTIONS
value: -Dlog4j2.formatMsgNoLookups=true
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 }}
volumeMounts:
- name: {{ .Chart.Name }}-config
mountPath: /home/sunbird/search-service-1.0-SNAPSHOT/config/application.conf
subPath: search-service_application.conf
- name: {{ .Chart.Name }}-xml-config
mountPath: /home/sunbird/search-service-1.0-SNAPSHOT/config/logback.xml
subPath: search-service_logback.xml

---
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/bpp-search/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/bpp-search/values.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
### Default variable file for search-service ###

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

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

replicaCount: {{search_replicacount|default(1)}}
repository: {{search_repository|default('search-service')}}
image_tag: {{ image_tag }}
resources:
requests:
cpu: {{search_cpu_req|default('100m')}}
memory: {{search_mem_req|default('100Mi')}}
limits:
cpu: {{search_cpu_limit|default('1')}}
memory: {{search_mem_limit|default('1024Mi')}}
network:
port: 9004
targetport: 9000
strategy:
type: RollingUpdate
maxsurge: {{ search_maxsurge|default('25%') }}
maxunavailable: {{ search_maxunavailable|default('25%') }}

{{ search_liveness_readiness | to_nice_yaml }}

autoscaling:
enabled: {{ search_autoscaling_enabled | default('false') }}
minReplicas: {{ search_autoscaling_minReplicas|default(1) }}
maxReplicas: {{ search_autoscaling_maxReplicas|default(2) }}
targetCPUUtilizationPercentage: {{ search_autoscaling_targetCPUUtilizationPercentage|default(60) }}
targetMemoryUtilizationPercentage: {{ search_autoscaling_targetMemoryUtilizationPercentage|default('') }}
60 changes: 60 additions & 0 deletions kubernetes/helm_charts/core/nginx-public-ingress/values.j2
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,66 @@ proxyconfig: |-
proxy_set_header X-Request-ID $sb_request_id;
proxy_pass http://$dial_upstream_host;
}
# This is Caching mechanism for BPP search
location ~ /onest/bpp/ {
rewrite ^/onest/bpp/(.*) /$1 break;
# Enabling compression
include /etc/nginx/defaults.d/compression.conf;
# Enabling caching
# caching include Accept-Encoding header also, to provide gziped or plain content as per request
proxy_cache_key "$http_accept_encoding|$request_uri|$request_body";
proxy_cache {{proxy_cache_path.large_cache.keys_zone.split(':') | first}};
add_header X-Proxy-Cache $upstream_cache_status;
add_header X-Proxy-Cache-Date $upstream_http_date;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_methods GET HEAD POST;
proxy_cache_revalidate on;
proxy_cache_background_update on;
proxy_cache_lock on;
proxy_cache_valid 200 {{proxy_cache_valid.medium_validity}};
# Increasing the proxy buffer size
proxy_buffer_size 16k;
proxy_busy_buffers_size 16k;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Real-IP {{ nginx_client_public_ip_header | d('$remote_addr') }};
proxy_connect_timeout 5;
proxy_send_timeout 60;
proxy_read_timeout 70;
proxy_http_version 1.1;
proxy_pass http://bpp-search-service.staging.svc.cluster.local:9000;
}
# This is Caching mechanism for BAP
location ~ /onest/bap/ {
rewrite ^/onest/bap/(.*) /$1 break;
# Enabling compression
include /etc/nginx/defaults.d/compression.conf;
# Enabling caching
# caching include Accept-Encoding header also, to provide gziped or plain content as per request
proxy_cache_key "$http_accept_encoding|$request_uri|$request_body";
proxy_cache {{proxy_cache_path.large_cache.keys_zone.split(':') | first}};
add_header X-Proxy-Cache $upstream_cache_status;
add_header X-Proxy-Cache-Date $upstream_http_date;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_methods GET HEAD POST;
proxy_cache_revalidate on;
proxy_cache_background_update on;
proxy_cache_lock on;
proxy_cache_valid 200 {{proxy_cache_valid.medium_validity}};
# Increasing the proxy buffer size
proxy_buffer_size 16k;
proxy_busy_buffers_size 16k;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Real-IP {{ nginx_client_public_ip_header | d('$remote_addr') }};
proxy_connect_timeout 5;
proxy_send_timeout 60;
proxy_read_timeout 70;
proxy_http_version 1.1;
proxy_pass http://11.3.0.6:3004;
}
{% if apple_app_site_association is defined %}
location /apple-app-site-association {
alias /var/www/html/;
Expand Down