From 55537af6f5db33fb833acf232ed76bc036355912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arsham=20Teymour=C4=B1?= Date: Mon, 2 Aug 2021 12:00:42 +0300 Subject: [PATCH] extending the helm chart exposing telemetry core service adding hpa support for telemetry shard --- helm/templates/core-deployment.yaml | 2 +- helm/templates/shard-deployment.yaml | 4 +-- helm/templates/{hpa.yaml => shard-hpa.yaml} | 5 ++-- helm/templates/tests/test-connection.yaml | 15 ----------- helm/values.yaml | 29 ++++++++++++++------- 5 files changed, 26 insertions(+), 29 deletions(-) rename helm/templates/{hpa.yaml => shard-hpa.yaml} (88%) delete mode 100644 helm/templates/tests/test-connection.yaml diff --git a/helm/templates/core-deployment.yaml b/helm/templates/core-deployment.yaml index 87986b2..d4c47b0 100644 --- a/helm/templates/core-deployment.yaml +++ b/helm/templates/core-deployment.yaml @@ -39,7 +39,7 @@ spec: - "telemetry_core" args: - "--listen" - - "0.0.0.0:8000" + - "0.0.0.0:{{ .Values.service.core.targetPort }}" ports: - name: http containerPort: {{ .Values.service.core.targetPort }} diff --git a/helm/templates/shard-deployment.yaml b/helm/templates/shard-deployment.yaml index 04dba58..0b73dba 100644 --- a/helm/templates/shard-deployment.yaml +++ b/helm/templates/shard-deployment.yaml @@ -39,9 +39,9 @@ spec: - "telemetry_shard" args: - "--listen" - - "0.0.0.0:8000" + - "0.0.0.0:{{ .Values.service.shard.targetPort }}" - "--core" - - "http://telemetry-core/shard_submit" + - "http://telemetry-core:{{ .Values.service.core.targetPort }}/shard_submit" ports: - name: http containerPort: {{ .Values.service.shard.targetPort }} diff --git a/helm/templates/hpa.yaml b/helm/templates/shard-hpa.yaml similarity index 88% rename from helm/templates/hpa.yaml rename to helm/templates/shard-hpa.yaml index eb860dd..eabbced 100644 --- a/helm/templates/hpa.yaml +++ b/helm/templates/shard-hpa.yaml @@ -2,14 +2,15 @@ apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler metadata: - name: {{ include "substrate-telemetry.fullname" . }} + name: telemetry-shard labels: {{- include "substrate-telemetry.labels" . | nindent 4 }} + telemetry-component: shard spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ include "substrate-telemetry.fullname" . }} + name: telemetry-shard minReplicas: {{ .Values.autoscaling.minReplicas }} maxReplicas: {{ .Values.autoscaling.maxReplicas }} metrics: diff --git a/helm/templates/tests/test-connection.yaml b/helm/templates/tests/test-connection.yaml deleted file mode 100644 index a09cc32..0000000 --- a/helm/templates/tests/test-connection.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "substrate-telemetry.fullname" . }}-test-connection" - labels: - {{- include "substrate-telemetry.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": test -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "substrate-telemetry.fullname" . }}:{{ .Values.service.port }}'] - restartPolicy: Never diff --git a/helm/values.yaml b/helm/values.yaml index 3689ca7..1b38cef 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -7,10 +7,10 @@ replicaCount: core: 1 image: - repository: parity/substrate-telemetry-backend + repository: docker.io/parity/substrate-telemetry-backend pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: latest + tag: master-b4117d3a imagePullSecrets: [] nameOverride: "" @@ -48,10 +48,13 @@ service: 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 + type: LoadBalancer port: 80 targetPort: 8000 - annotations: {} + 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. ingress: @@ -83,11 +86,19 @@ resources: {} # memory: 128Mi autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 + shard: + enabled: true + minReplicas: 3 + maxReplicas: 6 + targetCPUUtilizationPercentage: 80 + targetMemoryUtilizationPercentage: 80 + # telemetry-core is not scalable atm. + core: + enabled: false + minReplicas: 3 + maxReplicas: 6 + targetCPUUtilizationPercentage: 80 + targetMemoryUtilizationPercentage: 80 nodeSelector: {}