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 #### #### BUILDER IMAGE ####
FROM node:12 as builder FROM docker.io/node:12 as builder
LABEL maintainer="Chevdor <chevdor@gmail.com>" LABEL maintainer="Chevdor <chevdor@gmail.com>"
LABEL description="Polkadot Telemetry frontend builder image" LABEL description="Polkadot Telemetry frontend builder image"
@@ -11,7 +11,7 @@ RUN yarn install && \
yarn cache clean yarn cache clean
#### OUTPUT IMAGE #### #### OUTPUT IMAGE ####
FROM nginx:stable-alpine FROM docker.io/nginx:stable-alpine
LABEL maintainer="Chevdor <chevdor@gmail.com>" LABEL maintainer="Chevdor <chevdor@gmail.com>"
LABEL description="Polkadot Telemetry frontend" LABEL description="Polkadot Telemetry frontend"
+3 -3
View File
@@ -6,7 +6,7 @@ metadata:
{{- include "substrate-telemetry.labels" . | nindent 4 }} {{- include "substrate-telemetry.labels" . | nindent 4 }}
telemetry-component: core telemetry-component: core
spec: spec:
{{- if not .Values.autoscaling.enabled }} {{- if not .Values.autoscaling.core.enabled }}
replicas: {{ .Values.replicaCount.core }} replicas: {{ .Values.replicaCount.core }}
{{- end }} {{- end }}
selector: selector:
@@ -33,8 +33,8 @@ spec:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
securityContext: securityContext:
{{- toYaml .Values.securityContext | nindent 12 }} {{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" image: "{{ .Values.image.backend.repository }}:{{ .Values.image.backend.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.backend.pullPolicy }}
command: command:
- "telemetry_core" - "telemetry_core"
args: 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" . -}} {{- $fullName := include "substrate-telemetry.fullname" . -}}
{{- $svcPort := .Values.service.port -}} {{- $svcPort := .Values.service.frontend.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} {{- if and .Values.ingress.frontend.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} {{- if not (hasKey .Values.ingress.frontend.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} {{- $_ := set .Values.ingress.frontend.annotations "kubernetes.io/ingress.class" .Values.ingress.frontend.className}}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
@@ -15,20 +15,21 @@ apiVersion: extensions/v1beta1
{{- end }} {{- end }}
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ $fullName }} name: telemetry-frontend
labels: labels:
{{- include "substrate-telemetry.labels" . | nindent 4 }} {{- include "substrate-telemetry.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }} telemetry-component: frontend
{{- with .Values.ingress.frontend.annotations }}
annotations: annotations:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} {{- if and .Values.ingress.frontend.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }} ingressClassName: {{ .Values.ingress.frontend.className }}
{{- end }} {{- end }}
{{- if .Values.ingress.tls }} {{- if .Values.ingress.frontend.tls }}
tls: tls:
{{- range .Values.ingress.tls }} {{- range .Values.ingress.frontend.tls }}
- hosts: - hosts:
{{- range .hosts }} {{- range .hosts }}
- {{ . | quote }} - {{ . | quote }}
@@ -37,7 +38,7 @@ spec:
{{- end }} {{- end }}
{{- end }} {{- end }}
rules: rules:
{{- range .Values.ingress.hosts }} {{- range .Values.ingress.frontend.hosts }}
- host: {{ .host | quote }} - host: {{ .host | quote }}
http: http:
paths: paths:
@@ -49,11 +50,11 @@ spec:
backend: backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service: service:
name: {{ $fullName }} name: telemetry-frontend
port: port:
number: {{ $svcPort }} number: {{ $svcPort }}
{{- else }} {{- else }}
serviceName: {{ $fullName }} serviceName: telemetry-frontend
servicePort: {{ $svcPort }} servicePort: {{ $svcPort }}
{{- end }} {{- end }}
{{- 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 }} {{- include "substrate-telemetry.labels" . | nindent 4 }}
telemetry-component: shard telemetry-component: shard
spec: spec:
{{- if not .Values.autoscaling.enabled }} {{- if not .Values.autoscaling.shard.enabled }}
replicas: {{ .Values.replicaCount.shard }} replicas: {{ .Values.replicaCount.shard }}
{{- end }} {{- end }}
selector: selector:
@@ -33,8 +33,8 @@ spec:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
securityContext: securityContext:
{{- toYaml .Values.securityContext | nindent 12 }} {{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" image: "{{ .Values.image.backend.repository }}:{{ .Values.image.backend.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.backend.pullPolicy }}
command: command:
- "telemetry_shard" - "telemetry_shard"
args: args:
+74 -21
View File
@@ -5,12 +5,19 @@
replicaCount: replicaCount:
shard: 3 shard: 3
core: 1 core: 1
frontend: 1
image: image:
repository: docker.io/parity/substrate-telemetry-backend backend:
pullPolicy: IfNotPresent repository: docker.io/parity/substrate-telemetry-backend
# Overrides the image tag whose default is the chart appVersion. pullPolicy: IfNotPresent
tag: master-b4117d3a # 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: [] imagePullSecrets: []
nameOverride: "" nameOverride: ""
@@ -44,7 +51,7 @@ service:
port: 80 port: 80
targetPort: 8000 targetPort: 8000
annotations: 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: core:
type: LoadBalancer type: LoadBalancer
port: 80 port: 80
@@ -52,24 +59,63 @@ service:
annotations: annotations:
cloud.google.com/load-balancer-type: Internal cloud.google.com/load-balancer-type: Internal
networking.gke.io/internal-load-balancer-allow-global-access: "true" 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: ingress:
enabled: false shard:
className: "" enabled: false
annotations: {} className: ""
# kubernetes.io/ingress.class: nginx annotations: {}
# kubernetes.io/tls-acme: "true" # kubernetes.io/ingress.class: nginx
hosts: # kubernetes.io/tls-acme: "true"
- host: chart-example.local hosts:
paths: - host: chart-example.local
- path: / paths:
pathType: ImplementationSpecific - path: /
tls: [] pathType: ImplementationSpecific
# - secretName: chart-example-tls tls: []
# hosts: # - secretName: chart-example-tls
# - chart-example.local # 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: {} resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious # We usually recommend not to specify default resources and to leave this as a conscious
@@ -97,6 +143,13 @@ autoscaling:
maxReplicas: 6 maxReplicas: 6
targetCPUUtilizationPercentage: 80 targetCPUUtilizationPercentage: 80
targetMemoryUtilizationPercentage: 80 targetMemoryUtilizationPercentage: 80
frontend:
enabled: true
minReplicas: 3
maxReplicas: 6
targetCPUUtilizationPercentage: 80
targetMemoryUtilizationPercentage: 80
nodeSelector: {} nodeSelector: {}