diff --git a/frontend/Dockerfile b/frontend/Dockerfile index d5bc187..5206edf 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,5 +1,5 @@ #### BUILDER IMAGE #### -FROM node:12 as builder +FROM docker.io/node:12 as builder LABEL maintainer="Chevdor " 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 " LABEL description="Polkadot Telemetry frontend" diff --git a/helm/templates/core-deployment.yaml b/helm/templates/core-deployment.yaml index d4c47b0..393cf03 100644 --- a/helm/templates/core-deployment.yaml +++ b/helm/templates/core-deployment.yaml @@ -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: diff --git a/helm/templates/frontend-deployment.yaml b/helm/templates/frontend-deployment.yaml new file mode 100644 index 0000000..0b0a49a --- /dev/null +++ b/helm/templates/frontend-deployment.yaml @@ -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 }} diff --git a/helm/templates/ingress.yaml b/helm/templates/frontend-ingress.yaml similarity index 58% rename from helm/templates/ingress.yaml rename to helm/templates/frontend-ingress.yaml index 30dc97e..25b82a1 100644 --- a/helm/templates/ingress.yaml +++ b/helm/templates/frontend-ingress.yaml @@ -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 }} diff --git a/helm/templates/frontend-service.yaml b/helm/templates/frontend-service.yaml new file mode 100644 index 0000000..9083a25 --- /dev/null +++ b/helm/templates/frontend-service.yaml @@ -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 diff --git a/helm/templates/shard-deployment.yaml b/helm/templates/shard-deployment.yaml index 4ed4333..d5ecda5 100644 --- a/helm/templates/shard-deployment.yaml +++ b/helm/templates/shard-deployment.yaml @@ -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: diff --git a/helm/values.yaml b/helm/values.yaml index b6e61d6..f098e77 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -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: {}