deploying the shard alongside the core

This commit is contained in:
arshamparity
2021-07-28 13:18:28 +03:00
parent 3802c75830
commit 99a3c474b9
7 changed files with 141 additions and 27 deletions
+5 -5
View File
@@ -5,16 +5,16 @@
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
{{- else if contains "NodePort" .Values.service.shard.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "substrate-telemetry.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
{{- else if contains "LoadBalancer" .Values.service.shard.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "substrate-telemetry.fullname" . }}'
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w telemetry-shard'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "substrate-telemetry.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
echo http://$SERVICE_IP:{{ .Values.service.shard.port }}
{{- else if contains "ClusterIP" .Values.service.shard.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "substrate-telemetry.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
@@ -1,12 +1,13 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "substrate-telemetry.fullname" . }}
name: telemetry-core
labels:
{{- include "substrate-telemetry.labels" . | nindent 4 }}
telemetry-component: core
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
replicas: {{ .Values.replicaCount.core }}
{{- end }}
selector:
matchLabels:
@@ -19,6 +20,7 @@ spec:
{{- end }}
labels:
{{- include "substrate-telemetry.selectorLabels" . | nindent 8 }}
telemetry-component: core
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
@@ -33,9 +35,14 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- "telemetry_core"
args:
- "--listen"
- "0.0.0.0:8000"
ports:
- name: http
containerPort: {{ .Values.service.targetPort }}
containerPort: {{ .Values.service.core.targetPort }}
protocol: TCP
#livenessProbe:
# httpGet:
+19
View File
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: telemetry-core
labels:
{{- include "substrate-telemetry.labels" . | nindent 4 }}
telemetry-component: core
annotations:
{{- toYaml .Values.service.core.annotations | nindent 4 }}
spec:
type: {{ .Values.service.core.type }}
ports:
- port: {{ .Values.service.core.port }}
targetPort: {{ .Values.service.core.targetPort }}
protocol: TCP
name: http
selector:
{{- include "substrate-telemetry.selectorLabels" . | nindent 4 }}
telemetry-component: core
-15
View File
@@ -1,15 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "substrate-telemetry.fullname" . }}
labels:
{{- include "substrate-telemetry.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
protocol: TCP
name: http
selector:
{{- include "substrate-telemetry.selectorLabels" . | nindent 4 }}
+70
View File
@@ -0,0 +1,70 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: telemetry-shard
labels:
{{- include "substrate-telemetry.labels" . | nindent 4 }}
telemetry-component: shard
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount.shard }}
{{- end }}
selector:
matchLabels:
{{- include "substrate-telemetry.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "substrate-telemetry.selectorLabels" . | nindent 8 }}
telemetry-component: shard
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "substrate-telemetry.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- "telemetry_shard"
args:
- "--listen"
- "0.0.0.0:8000"
- "--core"
- "http://telemetry-core/shard_submit"
ports:
- name: http
containerPort: {{ .Values.service.shard.targetPort }}
protocol: TCP
#livenessProbe:
# httpGet:
# path: /
# port: http
#readinessProbe:
# httpGet:
# path: /
# port: http
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 }}
+20
View File
@@ -0,0 +1,20 @@
apiVersion: v1
kind: Service
metadata:
name: telemetry-shard
labels:
{{- include "substrate-telemetry.labels" . | nindent 4 }}
telemetry-component: shard
annotations:
{{- toYaml .Values.service.shard.annotations | nindent 4 }}
spec:
type: {{ .Values.service.shard.type }}
ports:
- port: {{ .Values.service.shard.port }}
targetPort: {{ .Values.service.shard.targetPort }}
protocol: TCP
name: http
selector:
{{- include "substrate-telemetry.selectorLabels" . | nindent 4 }}
telemetry-component: shard
+17 -4
View File
@@ -2,7 +2,9 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 3
replicaCount:
shard: 3
core: 1
image:
repository: parity/substrate-telemetry-backend
@@ -37,9 +39,20 @@ securityContext: {}
# runAsUser: 1000
service:
type: LoadBalancer
port: 80
targetPort: 3000
shard:
type: LoadBalancer
port: 80
targetPort: 8000
annotations:
cloud.google.com/load-balancer-type: Internal
networking.gke.io/internal-load-balancer-allow-global-access: "true"
external-dns.alpha.kubernetes.io/hostname: substrate-telemetry.parity-stg.parity.io.
core:
type: ClusterIP
port: 80
targetPort: 8000
annotations: {}
ingress:
enabled: false