Modular logistics and supply chain operating system (LSOS)
JavaScript driver-appfleet-managementfreight-managementinfrastructureinventory-managementlast-mile-deliverylogisticsondemandopen-sourceorder-managementroute-optimizationsupply-chain-managementtracking-and-monitoringtransport-management-systemtransportationwarehouse-management
Add scheduler and events to deployments
Eugene Dementyevd9705bf4f4f8
diff --git a/infra/helm/templates/_helpers.tpl b/infra/helm/templates/_helpers.tplindex ba04c300..a50cbe62 100644--- a/infra/helm/templates/_helpers.tpl+++ b/infra/helm/templates/_helpers.tpl@@ -50,6 +50,16 @@ app.kubernetes.io/name: {{ include "helm.name" . }}app.kubernetes.io/instance: {{ .Release.Name }}{{- end }}+{{- define "helm.commonVariables" -}}+- name: CACHE_URL+ value: $(REDIS_SERVICE_PORT)/1+- name: CACHE_DRIVER+ value: redis+- name: SOCKETCLUSTER_PORT+ value: "8000"+- name: SOCKETCLUSTER_HOST+ value: $(SOCKETCLUSTER_SERVICE_HOST)+{{- end }}{{/*Create the name of the service account to use*/}}diff --git a/infra/helm/templates/certificate.yaml b/infra/helm/templates/certificate.yamlindex 4c373d43..66055ca4 100644--- a/infra/helm/templates/certificate.yaml+++ b/infra/helm/templates/certificate.yaml@@ -1,3 +1,4 @@+{{- if .Values.gcp }}apiVersion: networking.gke.io/v1kind: ManagedCertificatemetadata:@@ -15,3 +16,4 @@ spec:redirectToHttps:enabled: trueresponseCodeName: MOVED_PERMANENTLY_DEFAULT+{{- end }}diff --git a/infra/helm/templates/deployment.yaml b/infra/helm/templates/deployment.yamlindex 1522f102..2549a168 100644--- a/infra/helm/templates/deployment.yaml+++ b/infra/helm/templates/deployment.yaml@@ -3,6 +3,7 @@ kind: Deploymentmetadata:name: {{ include "helm.fullname" . }}labels:+ service: app{{- include "helm.labels" . | nindent 4 }}spec:{{- if not .Values.autoscaling.enabled }}@@ -10,6 +11,7 @@ spec:{{- end }}selector:matchLabels:+ service: app{{- include "helm.selectorLabels" . | nindent 6 }}template:metadata:@@ -18,6 +20,7 @@ spec:{{- toYaml . | nindent 8 }}{{- end }}labels:+ service: app{{- include "helm.selectorLabels" . | nindent 8 }}spec:{{- with .Values.imagePullSecrets }}@@ -59,12 +62,7 @@ spec:- secretRef:name: infra-provided-secretenv:- - name: CACHE_URL- value: $(REDIS_SERVICE_PORT)/1- - name: SOCKETCLUSTER_PORT- value: "8000"- - name: SOCKETCLUSTER_HOST- value: $(SOCKETCLUSTER_SERVICE_HOST)+ {{- include "helm.commonVariables" . | nindent 12 }}resources:{{- toYaml .Values.resources | nindent 12 }}{{- with .Values.nodeSelector }}diff --git a/infra/helm/templates/deployment_services.yaml b/infra/helm/templates/deployment_services.yamlnew file mode 100644index 00000000..26ba20b8--- /dev/null+++ b/infra/helm/templates/deployment_services.yaml@@ -0,0 +1,116 @@+apiVersion: apps/v1+kind: Deployment+metadata:+ name: {{ include "helm.fullname" . }}-events+ labels:+ service: events+ {{- include "helm.labels" . | nindent 4 }}+spec:+ {{- if not .Values.autoscaling.enabled }}+ replicas: {{ .Values.replicaCount }}+ {{- end }}+ selector:+ matchLabels:+ service: events+ {{- include "helm.selectorLabels" . | nindent 6 }}+ template:+ metadata:+ {{- with .Values.podAnnotations }}+ annotations:+ {{- toYaml . | nindent 8 }}+ {{- end }}+ labels:+ service: events+ {{- include "helm.selectorLabels" . | nindent 8 }}+ spec:+ {{- with .Values.imagePullSecrets }}+ imagePullSecrets:+ {{- toYaml . | nindent 8 }}+ {{- end }}+ serviceAccountName: {{ include "helm.serviceAccountName" . }}+ securityContext:+ {{- toYaml .Values.podSecurityContext | nindent 8 }}+ containers:+ - name: events+ command: ["php", "artisan", "queue:work"]+ securityContext:+ {{- toYaml .Values.securityContext | nindent 12 }}+ image: "{{ .Values.image.repository }}/events:{{ .Values.image.tag | default .Chart.AppVersion }}"+ imagePullPolicy: {{ .Values.image.pullPolicy }}+ envFrom:+ - secretRef:+ name: infra-provided-secret+ env:+ {{- include "helm.commonVariables" . | 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 }}+---+apiVersion: apps/v1+kind: Deployment+metadata:+ name: {{ include "helm.fullname" . }}-scheduler+ labels:+ service: scheduler+ {{- include "helm.labels" . | nindent 4 }}+spec:+ {{- if not .Values.autoscaling.enabled }}+ replicas: {{ .Values.replicaCount }}+ {{- end }}+ selector:+ matchLabels:+ service: scheduler+ {{- include "helm.selectorLabels" . | nindent 6 }}+ template:+ metadata:+ {{- with .Values.podAnnotations }}+ annotations:+ {{- toYaml . | nindent 8 }}+ {{- end }}+ labels:+ service: scheduler+ {{- include "helm.selectorLabels" . | nindent 8 }}+ spec:+ {{- with .Values.imagePullSecrets }}+ imagePullSecrets:+ {{- toYaml . | nindent 8 }}+ {{- end }}+ serviceAccountName: {{ include "helm.serviceAccountName" . }}+ securityContext:+ {{- toYaml .Values.podSecurityContext | nindent 8 }}+ containers:+ - name: scheduler+ securityContext:+ {{- toYaml .Values.securityContext | nindent 12 }}+ image: "{{ .Values.image.repository }}/scheduler:{{ .Values.image.tag | default .Chart.AppVersion }}"+ imagePullPolicy: {{ .Values.image.pullPolicy }}+ envFrom:+ - secretRef:+ name: infra-provided-secret+ env:+ {{- include "helm.commonVariables" . | 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 }}diff --git a/infra/helm/templates/hooks.yaml b/infra/helm/templates/hooks.yamlnew file mode 100644index 00000000..22a5c868--- /dev/null+++ b/infra/helm/templates/hooks.yaml@@ -0,0 +1,45 @@+---+apiVersion: batch/v1+kind: Job+metadata:+ name: "{{ .Release.Name }}-deploy"+ labels:+ app.kubernetes.io/managed-by: {{ .Release.Service | quote }}+ app.kubernetes.io/instance: {{ .Release.Name | quote }}+ app.kubernetes.io/version: {{ .Chart.AppVersion }}+ helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"+ annotations:+ "helm.sh/hook": pre-install,pre-upgrade+ "helm.sh/hook-weight": "0"+ "helm.sh/hook-delete-policy": before-hook-creation+spec:+ template:+ metadata:+ name: "{{ .Release.Name }}-deploy"+ labels:+ app.kubernetes.io/managed-by: {{ .Release.Service | quote }}+ app.kubernetes.io/instance: {{ .Release.Name | quote }}+ helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"+ spec:+ restartPolicy: Never+ securityContext:+ {{- toYaml .Values.podSecurityContext | nindent 8 }}+ containers:+ - name: deployment-job+ securityContext:+ {{- toYaml .Values.securityContext | nindent 10 }}+ image: "{{ .Values.image.repository }}/app:{{ .Values.image.tag | default .Chart.AppVersion }}"+ command: ["./deploy.sh"]+ env:+ {{- include "helm.commonVariables" . | nindent 12 }}+ envFrom:+ - secretRef:+ name: infra-provided-secret+ {{- with .Values.nodeSelector }}+ nodeSelector:+ {{- toYaml . | nindent 8 }}+ {{- end }}+ {{- with .Values.tolerations }}+ tolerations:+ {{- toYaml . | nindent 8 }}+ {{- end }}diff --git a/infra/helm/templates/service.yaml b/infra/helm/templates/service.yamlindex de450fc5..7c32fbdc 100644--- a/infra/helm/templates/service.yaml+++ b/infra/helm/templates/service.yaml@@ -13,3 +13,4 @@ spec:name: httpselector:{{- include "helm.selectorLabels" . | nindent 4 }}+ service: appdiff --git a/infra/helm/values.yaml b/infra/helm/values.yamlindex e4e4cbe0..b830926c 100644--- a/infra/helm/values.yaml+++ b/infra/helm/values.yaml@@ -78,3 +78,5 @@ nodeSelector: {}tolerations: []affinity: {}++gcp: true