From b52c56cc8e44e9e95b1837ec0e15bedf0dc80ec6 Mon Sep 17 00:00:00 2001 From: Musaed Albrikan Date: Mon, 26 Sep 2022 13:32:54 +0300 Subject: [PATCH 01/10] Add HPA support --- README.md | 5 +++++ anycable-go/templates/deployment.yml | 2 ++ anycable-go/templates/hpa.yaml | 23 +++++++++++++++++++++++ anycable-go/values.yaml | 6 ++++++ 4 files changed, 36 insertions(+) create mode 100644 anycable-go/templates/hpa.yaml diff --git a/README.md b/README.md index 95a89b6..d24c664 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,11 @@ These are the values used to configure anycable-go itself: |Value|Description|Default| |-----|-----------|-------| +|**replicas**|Number of replicas for `anycable-go` deployment (ignored when HPA is enabled)|`1`| +|**hpa.enabled**|Enable HorizontalPodAutoscaler|`false`| +|**hpa.minReplicas**|Minimum replicas for HPA|`1`| +|**hpa.maxReplicas**|Maximum replicas for HPA|`3`| +|**hpa.targetCPUUtilizationPercentage**|Target CPU utilization for HPA|`50`| |**pod.annotations**|User-specified Pod annotations|`{}`| |**pod.serviceAccountName**|User-specified ServiceAccount for Pod identity|| |**service.annotations**|User-specified Service annotations|`{}`| diff --git a/anycable-go/templates/deployment.yml b/anycable-go/templates/deployment.yml index bf86bf2..bb2a5d7 100644 --- a/anycable-go/templates/deployment.yml +++ b/anycable-go/templates/deployment.yml @@ -13,7 +13,9 @@ metadata: heritage: {{ $.Release.Service | quote }} spec: progressDeadlineSeconds: 600 + {{- if eq .hpa.enabled false }} replicas: {{ .replicas | default 2 }} + {{- end }} revisionHistoryLimit: {{ .revisionHistoryLimit | default 10 }} selector: matchLabels: diff --git a/anycable-go/templates/hpa.yaml b/anycable-go/templates/hpa.yaml new file mode 100644 index 0000000..9ba7845 --- /dev/null +++ b/anycable-go/templates/hpa.yaml @@ -0,0 +1,23 @@ +{{- $values := include "anycableGo.values" . | fromYaml }} +{{- with $values.hpa }} +{{- if .enabled }} +--- +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ template "anycableGo.fullname" $ }} + labels: + app: {{ template "anycableGo.name" $ }} + chart: "{{ $.Chart.Name }}-{{ $.Chart.Version | replace "+" "_" }}" + release: {{ $.Release.Name | quote }} + heritage: {{ $.Release.Service | quote }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ template "anycableGo.fullname" $ }} + minReplicas: {{ .minReplicas }} + maxReplicas: {{ .maxReplicas }} + targetCPUUtilizationPercentage: {{ .targetCPUUtilizationPercentage }} +{{- end }} +{{- end }} diff --git a/anycable-go/values.yaml b/anycable-go/values.yaml index b47bc17..e14215f 100644 --- a/anycable-go/values.yaml +++ b/anycable-go/values.yaml @@ -2,6 +2,12 @@ nodeSelector: {} replicas: 1 +hpa: + enabled: false + minReplicas: 1 + maxReplicas: 3 + targetCPUUtilizationPercentage: 50 + image: repository: anycable/anycable-go tag: 1.2.0 From 2844fdfb426024ad53ad5c331875adf4c349ea42 Mon Sep 17 00:00:00 2001 From: Jones Chi Date: Mon, 3 Oct 2022 19:09:48 +0800 Subject: [PATCH 02/10] Allow to override service type --- anycable-go/templates/service.yml | 2 +- anycable-go/values.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/anycable-go/templates/service.yml b/anycable-go/templates/service.yml index 9a2b319..2e97453 100644 --- a/anycable-go/templates/service.yml +++ b/anycable-go/templates/service.yml @@ -30,5 +30,5 @@ spec: app: {{ template "anycableGo.name" $ }} component: anycable-go release: {{ $.Release.Name | quote }} - type: ClusterIP + type: {{ $values.service.type }} {{- end }} diff --git a/anycable-go/values.yaml b/anycable-go/values.yaml index b47bc17..9eeb7f6 100644 --- a/anycable-go/values.yaml +++ b/anycable-go/values.yaml @@ -60,6 +60,7 @@ pod: service: annotations: {} + type: ClusterIP # Define names or additional secrets to overwrite env variables # from the `env-secret.yml`. From 24d221f5433e114d5f14b1c430d6fce48e55067f Mon Sep 17 00:00:00 2001 From: maxd-wttj Date: Fri, 7 Oct 2022 13:31:05 +0200 Subject: [PATCH 03/10] add extraLabels --- README.md | 1 + anycable-go/templates/deployment.yml | 3 +++ anycable-go/values.yaml | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 95a89b6..403e132 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,7 @@ These are the values used to configure anycable-go itself: |Value|Description|Default| |-----|-----------|-------| |**pod.annotations**|User-specified Pod annotations|`{}`| +|**pod.extraLabels**|User-specified Pod Labels|`{}`| |**pod.serviceAccountName**|User-specified ServiceAccount for Pod identity|| |**service.annotations**|User-specified Service annotations|`{}`| diff --git a/anycable-go/templates/deployment.yml b/anycable-go/templates/deployment.yml index bf86bf2..e1d9dd9 100644 --- a/anycable-go/templates/deployment.yml +++ b/anycable-go/templates/deployment.yml @@ -35,6 +35,9 @@ spec: chart: "{{ $.Chart.Name }}-{{ $.Chart.Version | replace "+" "_" }}" release: {{ $.Release.Name | quote }} heritage: {{ $.Release.Service | quote }} + {{- if (.pod | default dict).extraLabels }} + {{- .pod.extraLabels | toYaml | nindent 8 }} + {{- end }} annotations: checksum/config: {{ include (print $.Template.BasePath "/env-secret.yml") $ | sha256sum }} {{- if (.pod | default dict).annotations }} diff --git a/anycable-go/values.yaml b/anycable-go/values.yaml index b47bc17..e8292b1 100644 --- a/anycable-go/values.yaml +++ b/anycable-go/values.yaml @@ -53,7 +53,7 @@ resources: pod: annotations: {} - + extraLabels: {} # Use a different ServiceAccount # (leave blank for default) serviceAccountName: "" From 577486ac2a84f2cf3f144705b43651c84bfe42a7 Mon Sep 17 00:00:00 2001 From: Andrew Kozin Date: Wed, 19 Oct 2022 14:40:28 +0100 Subject: [PATCH 04/10] Fix api version for HPA --- anycable-go/templates/hpa.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/anycable-go/templates/hpa.yaml b/anycable-go/templates/hpa.yaml index 9ba7845..cc91efb 100644 --- a/anycable-go/templates/hpa.yaml +++ b/anycable-go/templates/hpa.yaml @@ -1,8 +1,9 @@ {{- $values := include "anycableGo.values" . | fromYaml }} {{- with $values.hpa }} {{- if .enabled }} +{{- $apiVersion := include "anycableGo.apiVersions.hpa" $ }} --- -apiVersion: autoscaling/v1 +apiVersion: {{ $apiVersion }} kind: HorizontalPodAutoscaler metadata: name: {{ template "anycableGo.fullname" $ }} From 03a06a0034aa84f89229ef47ff0c426c887f18d2 Mon Sep 17 00:00:00 2001 From: Andrew Kozin Date: Wed, 19 Oct 2022 14:44:56 +0100 Subject: [PATCH 05/10] Add default value ClusterIP for service --- anycable-go/templates/service.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anycable-go/templates/service.yml b/anycable-go/templates/service.yml index 2e97453..4fcc55c 100644 --- a/anycable-go/templates/service.yml +++ b/anycable-go/templates/service.yml @@ -30,5 +30,5 @@ spec: app: {{ template "anycableGo.name" $ }} component: anycable-go release: {{ $.Release.Name | quote }} - type: {{ $values.service.type }} + type: {{ $values.service.type | default "ClusterIP" }} {{- end }} From 05b8228b91ac49df4e81573a138106a0ab901da3 Mon Sep 17 00:00:00 2001 From: Andrew Kozin Date: Wed, 19 Oct 2022 16:02:19 +0100 Subject: [PATCH 06/10] Add configurable tolerations to pods https://github.com/anycable/anycable-helm/issues/28 --- README.md | 1 + anycable-go/templates/deployment.yml | 3 +++ anycable-go/values.yaml | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 2ae18ec..64585a0 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,7 @@ These are the values used to configure anycable-go itself: |**hpa.targetCPUUtilizationPercentage**|Target CPU utilization for HPA|`50`| |**pod.annotations**|User-specified Pod annotations|`{}`| |**pod.extraLabels**|User-specified Pod Labels|`{}`| +|**pod.tolerations**|User-specified Pod tolerations|`[]`| |**pod.serviceAccountName**|User-specified ServiceAccount for Pod identity|| |**service.annotations**|User-specified Service annotations|`{}`| diff --git a/anycable-go/templates/deployment.yml b/anycable-go/templates/deployment.yml index 3c3bac8..08a930e 100644 --- a/anycable-go/templates/deployment.yml +++ b/anycable-go/templates/deployment.yml @@ -63,6 +63,9 @@ spec: app: {{ template "anycableGo.name" $ }} release: {{ $.Release.Name | quote }} weight: 100 + {{- if (.pod | default dict).tolerations }} + tolerations: {{- .pod.tolerations | toYaml | nindent 8 }} + {{- end }} {{- if .image.pullSecrets.enabled }} imagePullSecrets: - name: "{{ $.Release.Name }}-docker-registry-secret" diff --git a/anycable-go/values.yaml b/anycable-go/values.yaml index 63344a4..a25c692 100644 --- a/anycable-go/values.yaml +++ b/anycable-go/values.yaml @@ -63,6 +63,13 @@ pod: # Use a different ServiceAccount # (leave blank for default) serviceAccountName: "" + # Add tolerations to pods + tolerations: [] + # - key: key1 + # operator: Equal + # value: value1 + # effect: NoExecute + # tolerationSeconds: 3600 service: annotations: {} From f1a50515ca6f5c5050a791ba5fbc2a785c2e9e5e Mon Sep 17 00:00:00 2001 From: Andrew Kozin Date: Wed, 19 Oct 2022 16:07:22 +0100 Subject: [PATCH 07/10] Fix spacing --- anycable-go/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anycable-go/values.yaml b/anycable-go/values.yaml index a25c692..a3a96db 100644 --- a/anycable-go/values.yaml +++ b/anycable-go/values.yaml @@ -7,7 +7,7 @@ hpa: minReplicas: 1 maxReplicas: 3 targetCPUUtilizationPercentage: 50 - + image: repository: anycable/anycable-go tag: 1.2.0 From 5b37b7430ac1ccf155e99f4c0627a59627e323a9 Mon Sep 17 00:00:00 2001 From: Andrew Kozin Date: Wed, 19 Oct 2022 16:08:20 +0100 Subject: [PATCH 08/10] Fix list of owners --- anycable-go/Chart.yaml | 4 ++-- anycable-go/OWNERS | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/anycable-go/Chart.yaml b/anycable-go/Chart.yaml index 967659e..61d0e19 100644 --- a/anycable-go/Chart.yaml +++ b/anycable-go/Chart.yaml @@ -11,11 +11,11 @@ keywords: sources: - https://github.com/anycable/anycable-go maintainers: - - name: gfrntz - email: takebsd@gmail.com - name: dragonsmith email: agon.smith@gmail.com - name: palkan email: dementiev.vm@gmail.com - name: envek email: envek@envek.name + - name: nepalez + email: nepalez@evilmartians.com diff --git a/anycable-go/OWNERS b/anycable-go/OWNERS index 7690a20..b3b9c45 100644 --- a/anycable-go/OWNERS +++ b/anycable-go/OWNERS @@ -1,10 +1,10 @@ approvers: -- gfrntz - dragonsmith - palkan - envek +- nepalez reviewers: -- gfrntz - dragonsmith - palkan - envek +- nepalez From 2d2e1c9ad0b6df588ad090dac00f9922c1d510a4 Mon Sep 17 00:00:00 2001 From: Andrew Kozin Date: Wed, 19 Oct 2022 16:11:17 +0100 Subject: [PATCH 09/10] Update default version of anycable image: 1.2.0 -> 1.2.4 --- anycable-go/Chart.yaml | 2 +- anycable-go/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/anycable-go/Chart.yaml b/anycable-go/Chart.yaml index 61d0e19..8bd58bd 100644 --- a/anycable-go/Chart.yaml +++ b/anycable-go/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 description: A Helm chart for anycable-go websocket server. name: anycable-go version: 0.5.5 -appVersion: 1.2.0 +appVersion: 1.2.4 home: https://anycable.io/ icon: https://docs.anycable.io/assets/images/logo.svg keywords: diff --git a/anycable-go/values.yaml b/anycable-go/values.yaml index a3a96db..06d0a02 100644 --- a/anycable-go/values.yaml +++ b/anycable-go/values.yaml @@ -10,7 +10,7 @@ hpa: image: repository: anycable/anycable-go - tag: 1.2.0 + tag: 1.2.4 pullPolicy: IfNotPresent pullSecrets: enabled: false From 8fc1130712abfb4bfd5e9738b3f857bd725f5259 Mon Sep 17 00:00:00 2001 From: Andrew Kozin Date: Wed, 19 Oct 2022 16:09:31 +0100 Subject: [PATCH 10/10] Update version to v0.5.6 --- anycable-go/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anycable-go/Chart.yaml b/anycable-go/Chart.yaml index 8bd58bd..2bdce12 100644 --- a/anycable-go/Chart.yaml +++ b/anycable-go/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: A Helm chart for anycable-go websocket server. name: anycable-go -version: 0.5.5 +version: 0.5.6 appVersion: 1.2.4 home: https://anycable.io/ icon: https://docs.anycable.io/assets/images/logo.svg