diff --git a/helm/templates/core-ingress.yaml b/helm/templates/core-ingress.yaml new file mode 100644 index 0000000..95b5620 --- /dev/null +++ b/helm/templates/core-ingress.yaml @@ -0,0 +1,62 @@ +{{- if .Values.ingress.core.enabled -}} +{{- $fullName := include "substrate-telemetry.fullname" . -}} +{{- $svcPort := .Values.service.core.port -}} +{{- if and .Values.ingress.core.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.core.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.core.annotations "kubernetes.io/ingress.class" .Values.ingress.core.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: telemetry-core + labels: + {{- include "substrate-telemetry.labels" . | nindent 4 }} + telemetry-component: core + {{- with .Values.ingress.core.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.core.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.core.className }} + {{- end }} + {{- if .Values.ingress.core.tls }} + tls: + {{- range .Values.ingress.core.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.core.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: telemetry-core + port: + number: {{ $svcPort }} + {{- else }} + serviceName: telemetry-core + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/helm/templates/frontend-deployment.yaml b/helm/templates/frontend-deployment.yaml index 6b066de..8bb737f 100644 --- a/helm/templates/frontend-deployment.yaml +++ b/helm/templates/frontend-deployment.yaml @@ -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.frontend.repository }}:{{ .Values.image.frontend.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.frontend.pullPolicy }} {{- if .Values.envVars.frontend }} env: {{- range $key, $val := .Values.envVars.frontend }} @@ -48,18 +48,20 @@ spec: protocol: TCP livenessProbe: httpGet: - path: /health + path: / port: http readinessProbe: httpGet: - path: /health + path: / port: http volumeMounts: - name: nginx - mountPath: "/etc/nginx/nginx.conf" + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf readOnly: true - name: env-config - mountPath: "/usr/share/nginx/html/env-config.js" + mountPath: /usr/share/nginx/html/env-config.js + subPath: env-config.js readOnly: true resources: {{- toYaml .Values.resources | nindent 12 }} diff --git a/helm/templates/frontend-env-config.yaml b/helm/templates/frontend-env-config.yaml index f2856d2..4d2a563 100644 --- a/helm/templates/frontend-env-config.yaml +++ b/helm/templates/frontend-env-config.yaml @@ -5,6 +5,6 @@ metadata: data: env-config.js: | window.process_env = { - SUBSTRATE_TELEMETRY_URL: "ws://feed.telemetry.parity-stg.parity.io/feed", + SUBSTRATE_TELEMETRY_URL: "wss://feed.telemetry.parity-stg.parity.io/feed", SUBSTRATE_TELEMETRY_SAMPLE: "", } diff --git a/helm/templates/frontend-nginx-configmap.yaml b/helm/templates/frontend-nginx-configmap.yaml index 52a34d2..15dbb01 100644 --- a/helm/templates/frontend-nginx-configmap.yaml +++ b/helm/templates/frontend-nginx-configmap.yaml @@ -10,21 +10,13 @@ data: error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; - server { - root /usr/share/nginx/html; - index index.html; - listen 80; - listen [::]:80; - server_name _; - } - events { worker_connections 8000; } http { - include /etc/nginx/mime.types; default_type application/octet-stream; + include /etc/nginx/mime.types; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; @@ -34,4 +26,16 @@ data: keepalive_timeout 65; gzip on; include /etc/nginx/conf.d/*.conf; + #server_tokens off; + + server { + root /usr/share/nginx/html; + index index.html; + listen 8000; + server_name _; + + location = /favicon.ico { + return 204; + } + } } diff --git a/helm/values.yaml b/helm/values.yaml index 86922a0..fcd55ed 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -12,12 +12,12 @@ image: repository: docker.io/parity/substrate-telemetry-backend pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: master-b4117d3a + tag: f089ad17 frontend: repository: docker.io/parity/substrate-telemetry-frontend pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: master-b4117d3a + tag: f089ad17 imagePullSecrets: [] nameOverride: "" @@ -26,8 +26,8 @@ fullnameOverride: "" envVars: shard: {} core: {} - frontend: - SUBSTRATE_TELEMETRY_URL: telemetry-core + frontend: {} + serviceAccount: @@ -60,13 +60,13 @@ service: annotations: external-dns.alpha.kubernetes.io/hostname: submit.telemetry.parity-stg.parity.io. core: - type: LoadBalancer + type: ClusterIP 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: feed.telemetry.parity-stg.parity.io. + annotations: {} + # cloud.google.com/load-balancer-type: Internal + # networking.gke.io/internal-load-balancer-allow-global-access: "true" + # external-dns.alpha.kubernetes.io/hostname: feed.telemetry.parity-stg.parity.io. frontend: type: ClusterIP port: 80 @@ -90,28 +90,32 @@ ingress: # 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" + className: "" 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. + traefik.ingress.kubernetes.io/router.tls: "true" + hosts: + - host: feed.telemetry.parity-stg.parity.io + paths: + - path: / + pathType: ImplementationSpecific + tls: + - secretName: feed.telemetry.parity-stg.parity.io + hosts: + - feed.telemetry.parity-stg.parity.io + 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. + traefik.ingress.kubernetes.io/router.tls: "true" hosts: - host: telemetry.parity-stg.parity.io paths: @@ -139,7 +143,7 @@ resources: {} autoscaling: shard: enabled: true - minReplicas: 3 + minReplicas: 2 maxReplicas: 6 targetCPUUtilizationPercentage: 80 targetMemoryUtilizationPercentage: 80 @@ -151,8 +155,8 @@ autoscaling: targetCPUUtilizationPercentage: 80 targetMemoryUtilizationPercentage: 80 frontend: - enabled: true - minReplicas: 3 + enabled: false + minReplicas: 1 maxReplicas: 6 targetCPUUtilizationPercentage: 80 targetMemoryUtilizationPercentage: 80