Skip to content

Commit

Permalink
Merge pull request #114 from sandagomipieris/master
Browse files Browse the repository at this point in the history
Adding Django backend server helm artifacts
  • Loading branch information
sajithaliyanage authored Jul 8, 2021
2 parents 9b2e305 + 25bb569 commit a6c0785
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crawlerx_helm/templates/backend/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: "v1"
kind: "ConfigMap"
metadata:
name: {{ include "crawlerx_helm.fullname" . }}-backend-configs
data:
MONGODB_URL: {{ include "crawlerx_helm.fullname" . }}-mongodb-service
RABBITMQ_URL: {{ include "crawlerx_helm.fullname" . }}-rabbitmq-service
75 changes: 75 additions & 0 deletions crawlerx_helm/templates/backend/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "crawlerx_helm.fullname" . }}-backend-deployment
namespace: {{ .Release.Namespace }}
labels:
chart: '{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}'
spec:
replicas: {{ .Values.crawlerx.deployment.backend.replicas }}
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: {{ .Values.crawlerx.deployment.backend.strategy.rollingUpdate.maxSurge }}
maxSurge: {{ .Values.crawlerx.deployment.backend.strategy.rollingUpdate.maxSurge }}
selector:
matchLabels:
app: {{ include "crawlerx_helm.fullname" . }}-backend-selector
version: "current"
template:
metadata:
labels:
app: {{ include "crawlerx_helm.fullname" . }}-backend-selector
version: "current"
spec:
containers:
- name: "crawlerx_web_appication"
{{- if .Values.crawlerx.deployment.backend.dockerRegistry }}
image: "{{ .Values.crawlerx.deployment.backend.dockerRegistry }}/{{ .Values.crawlerx.deployment.backend.imageName }}:{{ .Values.crawlerx.deployment.backend.imageTag }}"
{{- else }}
image: "{{ .Values.crawlerx.deployment.backend.imageName }}:{{ .Values.crawlerx.deployment.backend.imageTag }}"
{{ end }}
imagePullPolicy: Always
ports:
- containerPort: 8000
resources:
requests:
memory: {{ .Values.crawlerx.deployment.backend.resources.requests.memory }}
cpu: {{ .Values.crawlerx.deployment.backend.resources.requests.cpu }}
limits:
memory: {{ .Values.crawlerx.deployment.backend.resources.limits.memory }}
cpu: {{ .Values.crawlerx.deployment.backend.resources.limits.cpu }}
{{- if .Values.crawlerx.deployment.backend.envs }}
env:
{{- range $key, $val := .Values.crawlerx.deployment.backend.envs }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
{{- end }}
envFrom:
- configMapRef:
name: {{ include "crawlerx_helm.fullname" . }}-backend-configs
{{- if .Values.image.livenessProbe }}
livenessProbe:
exec:
command:
- /bin/sh
- -c
- nc -z localhost 8000
initialDelaySeconds: {{ .Values.crawlerx.deployment.backend.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.crawlerx.deployment.backend.livenessProbe.periodSeconds }}
readinessProbe:
exec:
command:
- /bin/sh
- -c
- nc -z localhost 8000
initialDelaySeconds: {{ .Values.crawlerx.deployment.backend.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.crawlerx.deployment.backend.readinessProbe.periodSeconds }}
{{- if .Values.crawlerx.deployment.backend.imagePullSecrets }}
imagePullSecrets:
- name: {{ .Values.crawlerx.deployment.backend.imagePullSecrets }}
{{- else if and (not (eq .Values.crawlerx.subscription.username "")) (not (eq .Values.crawlerx.subscription.password "")) }}
imagePullSecrets:
- name: crawlerx-deployment-secret
{{ end }}
14 changes: 14 additions & 0 deletions crawlerx_helm/templates/backend/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "crawlerx_helm.fullname" . }}-backend-service
namespace : {{ .Release.Namespace }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
spec:
type: ClusterIP
ports:
- name: http
port: 8000
selector:
app: "{{ include "crawlerx_helm.fullname" . }}-backend-selector"
41 changes: 41 additions & 0 deletions crawlerx_helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,47 @@ crawlerx:
envs:
# ENV_NAME: ENV_VALUE

webApp:
# dockerRegistry: ""
imageName: "scorelabs/crawlerx-backend"
imageTag: "1.0.0"
# imagePullSecrets: secret
# Number of deployment replicas
replicas: 1
strategy:
rollingUpdate:
# The maximum number of pods that can be scheduled above the desired number of pods.
maxSurge: 1
# The maximum number of pods that can be unavailable during the update.
maxUnavailable: 0
# Indicates whether the container is running.
livenessProbe:
# Number of seconds after the container has started before liveness probes are initiated.
initialDelaySeconds: 35
# How often (in seconds) to perform the probe.
periodSeconds: 10
# Indicates whether the container is ready to service requests.
readinessProbe:
# Number of seconds after the container has started before readiness probes are initiated.
initialDelaySeconds: 35
# How often (in seconds) to perform the probe.
periodSeconds: 10
# These are the minimum resource recommendations
resources:
requests:
# The minimum amount of memory that should be allocated for a Pod
memory: "512Mi"
# The minimum amount of CPU that should be allocated for a Pod
cpu: "400m"
limits:
# The maximum amount of memory that should be allocated for a Pod
memory: "1Gi"
# The maximum amount of CPU that should be allocated for a Pod
cpu: "1000m"
# Environment variables for the deployment.
envs:
# ENV_NAME: ENV_VALUE

# Ingress level values for the CrawlerX deployments
ingress:
webApp:
Expand Down

0 comments on commit a6c0785

Please sign in to comment.