adding frontend to the helm chart

This commit is contained in:
Arsham Teymourı
2021-08-10 13:36:28 +03:00
parent 2dae6c90ce
commit ac20d3d845
7 changed files with 184 additions and 43 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
#### BUILDER IMAGE ####
FROM node:12 as builder
FROM docker.io/node:12 as builder
LABEL maintainer="Chevdor <chevdor@gmail.com>"
LABEL description="Polkadot Telemetry frontend builder image"
@@ -11,7 +11,7 @@ RUN yarn install && \
yarn cache clean
#### OUTPUT IMAGE ####
FROM nginx:stable-alpine
FROM docker.io/nginx:stable-alpine
LABEL maintainer="Chevdor <chevdor@gmail.com>"
LABEL description="Polkadot Telemetry frontend"
+3 -3
View File
@@ -6,7 +6,7 @@ metadata:
{{- include "substrate-telemetry.labels" . | nindent 4 }}
telemetry-component: core
spec:
{{- if not .Values.autoscaling.enabled }}
{{- if not .Values.autoscaling.core.enabled }}
replicas: {{ .Values.replicaCount.core }}
{{- end }}
selector:
@@ -33,8 +33,8 @@ spec:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
image: "{{ .Values.image.backend.repository }}:{{ .Values.image.backend.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.backend.pullPolicy }}
command:
- "telemetry_core"
args:
+68
View File
@@ -0,0 +1,68 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: telemetry-frontend
labels:
{{- include "substrate-telemetry.labels" . | nindent 4 }}
telemetry-component: frontend
spec:
{{- if not .Values.autoscaling.frontend.enabled }}
replicas: {{ .Values.replicaCount.frontend }}
{{- 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: frontend
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_frontend"
args:
- "--listen"
- "0.0.0.0:{{ .Values.service.frontend.targetPort }}"
ports:
- name: http
containerPort: {{ .Values.service.frontend.targetPort }}
protocol: TCP
livenessProbe:
httpGet:
path: /health
port: http
readinessProbe:
httpGet:
path: /health
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 }}
@@ -1,9 +1,9 @@
{{- if .Values.ingress.enabled -}}
{{- if .Values.ingress.frontend.enabled -}}
{{- $fullName := include "substrate-telemetry.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- $svcPort := .Values.service.frontend.port -}}
{{- if and .Values.ingress.frontend.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.frontend.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.frontend.annotations "kubernetes.io/ingress.class" .Values.ingress.frontend.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
@@ -15,20 +15,21 @@ apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
name: telemetry-frontend
labels:
{{- include "substrate-telemetry.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
telemetry-component: frontend
{{- with .Values.ingress.frontend.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- if and .Values.ingress.frontend.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.frontend.className }}
{{- end }}
{{- if .Values.ingress.tls }}
{{- if .Values.ingress.frontend.tls }}
tls:
{{- range .Values.ingress.tls }}
{{- range .Values.ingress.frontend.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
@@ -37,7 +38,7 @@ spec:
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
{{- range .Values.ingress.frontend.hosts }}
- host: {{ .host | quote }}
http:
paths:
@@ -49,11 +50,11 @@ spec:
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
name: telemetry-frontend
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
serviceName: telemetry-frontend
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
+19
View File
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: telemetry-frontend
labels:
{{- include "substrate-telemetry.labels" . | nindent 4 }}
telemetry-component: frontend
annotations:
{{- toYaml .Values.service.frontend.annotations | nindent 4 }}
spec:
type: {{ .Values.service.frontend.type }}
ports:
- port: {{ .Values.service.frontend.port }}
targetPort: {{ .Values.service.frontend.targetPort }}
protocol: TCP
name: http
selector:
{{- include "substrate-telemetry.selectorLabels" . | nindent 4 }}
telemetry-component: frontend
+3 -3
View File
@@ -6,7 +6,7 @@ metadata:
{{- include "substrate-telemetry.labels" . | nindent 4 }}
telemetry-component: shard
spec:
{{- if not .Values.autoscaling.enabled }}
{{- if not .Values.autoscaling.shard.enabled }}
replicas: {{ .Values.replicaCount.shard }}
{{- end }}
selector:
@@ -33,8 +33,8 @@ spec:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
image: "{{ .Values.image.backend.repository }}:{{ .Values.image.backend.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.backend.pullPolicy }}
command:
- "telemetry_shard"
args:
+74 -21
View File
@@ -5,12 +5,19 @@
replicaCount:
shard: 3
core: 1
frontend: 1
image:
repository: docker.io/parity/substrate-telemetry-backend
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: master-b4117d3a
backend:
repository: docker.io/parity/substrate-telemetry-backend
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: master-b4117d3a
frontend:
repository: docker.io/parity/substrate-telemetry-frontend
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: master-b4117d3a
imagePullSecrets: []
nameOverride: ""
@@ -44,7 +51,7 @@ service:
port: 80
targetPort: 8000
annotations:
external-dns.alpha.kubernetes.io/hostname: substrate-telemetry.parity-stg.parity.io.
external-dns.alpha.kubernetes.io/hostname: submit.telemetry.parity-stg.parity.io.
core:
type: LoadBalancer
port: 80
@@ -52,24 +59,63 @@ service:
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-core.parity-stg.parity.io.
external-dns.alpha.kubernetes.io/hostname: feed.telemetry.parity-stg.parity.io.
frontend:
type: ClusterIP
port: 80
targetPort: 8000
annotations: {}
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
shard:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
core:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
frontend:
enabled: true
className: "traefik-internal"
annotations:
kubernetes.io/ingress.class: traefik-internal
traefik.ingress.kubernetes.io/router.entrypoints: web,websecure
cert-manager.io/cluster-issuer: letsencrypt-dns01
external-dns.alpha.kubernetes.io/target: traefik-internal.parity-stg.parity.io.
hosts:
- host: telemetry.parity-stg.parity.io
paths:
- path: /
pathType: ImplementationSpecific
tls:
- secretName: telemetry.parity-stg.parity.io
hosts:
- telemetry.parity-stg.parity.io
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
@@ -97,6 +143,13 @@ autoscaling:
maxReplicas: 6
targetCPUUtilizationPercentage: 80
targetMemoryUtilizationPercentage: 80
frontend:
enabled: true
minReplicas: 3
maxReplicas: 6
targetCPUUtilizationPercentage: 80
targetMemoryUtilizationPercentage: 80
nodeSelector: {}