From 0b097e6eafd917e01e954f88deaafde5dd955d1c Mon Sep 17 00:00:00 2001 From: shahargl Date: Thu, 10 Oct 2024 18:45:50 +0300 Subject: [PATCH 1/7] feat: gke --- .../backend-gke-healthcheck-config.yaml | 16 ++++ charts/keep/templates/backend-service.yaml | 4 + charts/keep/templates/db-pvc.yaml | 4 +- .../frontend-gke-healthcheck-config.yaml | 16 ++++ charts/keep/templates/frontend-service.yaml | 6 +- charts/keep/values.yaml | 85 +++++++++++-------- 6 files changed, 95 insertions(+), 36 deletions(-) create mode 100644 charts/keep/templates/backend-gke-healthcheck-config.yaml create mode 100644 charts/keep/templates/frontend-gke-healthcheck-config.yaml diff --git a/charts/keep/templates/backend-gke-healthcheck-config.yaml b/charts/keep/templates/backend-gke-healthcheck-config.yaml new file mode 100644 index 0000000..5c868ec --- /dev/null +++ b/charts/keep/templates/backend-gke-healthcheck-config.yaml @@ -0,0 +1,16 @@ +{{- if and .Values.isGKE .Values.backend.backendConfig.enabled -}} +apiVersion: cloud.google.com/v1 +kind: BackendConfig +metadata: + name: {{ include "keep.fullname" . }}-backend-backendconfig + namespace: {{ .Release.Namespace }} +spec: + healthCheck: + checkIntervalSec: {{ .Values.frontend.backendConfig.healthCheck.checkIntervalSec }} + timeoutSec: {{ .Values.backend.backendConfig.healthCheck.timeoutSec }} + healthyThreshold: {{ .Values.backend.backendConfig.healthCheck.healthyThreshold }} + unhealthyThreshold: {{ .Values.backend.backendConfig.healthCheck.unhealthyThreshold }} + requestPath: {{ .Values.backend.backendConfig.healthCheck.path }} + port: {{ .Values.backend.backendConfig.healthCheck.port }} + type: {{ .Values.backend.backendConfig.healthCheck.type }} +{{- end }} \ No newline at end of file diff --git a/charts/keep/templates/backend-service.yaml b/charts/keep/templates/backend-service.yaml index 570b4f3..7c7cac3 100644 --- a/charts/keep/templates/backend-service.yaml +++ b/charts/keep/templates/backend-service.yaml @@ -6,6 +6,10 @@ metadata: labels: {{- include "keep.labels" . | nindent 4 }} keep-component: backend-service + annotations: + {{- if .Values.isGKE }} + cloud.google.com/backend-config: '{"default": "{{ include "keep.fullname" . }}-backend-backendconfig"}' + {{- end }} spec: type: {{ .Values.backend.service.type }} ports: diff --git a/charts/keep/templates/db-pvc.yaml b/charts/keep/templates/db-pvc.yaml index 5f8b4a3..8e0aa3d 100644 --- a/charts/keep/templates/db-pvc.yaml +++ b/charts/keep/templates/db-pvc.yaml @@ -6,8 +6,10 @@ metadata: spec: accessModes: - ReadWriteOnce + {{- if .Values.database.pvc.storageClass }} storageClassName: {{ .Values.database.pvc.storageClass }} + {{- end }} resources: requests: storage: {{ .Values.database.pvc.size }} -{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/keep/templates/frontend-gke-healthcheck-config.yaml b/charts/keep/templates/frontend-gke-healthcheck-config.yaml new file mode 100644 index 0000000..c81feea --- /dev/null +++ b/charts/keep/templates/frontend-gke-healthcheck-config.yaml @@ -0,0 +1,16 @@ +{{- if and .Values.isGKE .Values.frontend.backendConfig.enabled -}} +apiVersion: cloud.google.com/v1 +kind: BackendConfig +metadata: + name: {{ include "keep.fullname" . }}-frontend-backendconfig + namespace: {{ .Release.Namespace }} +spec: + healthCheck: + checkIntervalSec: {{ .Values.frontend.backendConfig.healthCheck.checkIntervalSec }} + timeoutSec: {{ .Values.frontend.backendConfig.healthCheck.timeoutSec }} + healthyThreshold: {{ .Values.frontend.backendConfig.healthCheck.healthyThreshold }} + unhealthyThreshold: {{ .Values.frontend.backendConfig.healthCheck.unhealthyThreshold }} + requestPath: {{ .Values.frontend.backendConfig.healthCheck.path }} + port: {{ .Values.frontend.backendConfig.healthCheck.port }} + type: {{ .Values.frontend.backendConfig.healthCheck.type }} +{{- end }} \ No newline at end of file diff --git a/charts/keep/templates/frontend-service.yaml b/charts/keep/templates/frontend-service.yaml index 2800e19..7908ac0 100644 --- a/charts/keep/templates/frontend-service.yaml +++ b/charts/keep/templates/frontend-service.yaml @@ -6,6 +6,10 @@ metadata: labels: {{- include "keep.labels" . | nindent 4 }} keep-component: frontend-service + annotations: + {{- if .Values.isGKE }} + cloud.google.com/backend-config: '{"default": "{{ include "keep.fullname" . }}-frontend-backendconfig"}' + {{- end }} spec: type: {{ .Values.frontend.service.type }} ports: @@ -22,4 +26,4 @@ spec: selector: {{- include "keep.selectorLabels" . | nindent 4 }} keep-component: frontend -{{- end}} +{{- end }} diff --git a/charts/keep/values.yaml b/charts/keep/values.yaml index d11e5df..dd728bf 100644 --- a/charts/keep/values.yaml +++ b/charts/keep/values.yaml @@ -5,6 +5,7 @@ serviceAccount: name: "" nameOverride: "" fullnameOverride: "" +isGKE: false backend: # if true, the backend will be enabled @@ -68,6 +69,17 @@ backend: path: / tls: [] wildcardPolicy: None + # GKE healthcheck config (backend) + backendConfig: + enabled: false + healthCheck: + checkIntervalSec: 30 + timeoutSec: 10 + healthyThreshold: 1 + unhealthyThreshold: 3 + path: "/" + port: 8080 + type: HTTP resources: {} autoscaling: enabled: false @@ -99,10 +111,12 @@ frontend: value: secret - name: NEXTAUTH_URL value: http://localhost:3000 + # Shahar: took me whole day to figure out that I need to set this to 1 + # https://github.com/nextauthjs/next-auth/issues/600 + - name: VERCEL + value: 1 - name: API_URL value: http://keep-backend:8080 - - name: NEXT_PUBLIC_API_URL - value: "" - name: NEXT_PUBLIC_POSTHOG_KEY value: "phc_muk9qE3TfZsX3SZ9XxX52kCGJBclrjhkP9JxAQcm1PZ" - name: NEXT_PUBLIC_POSTHOG_HOST @@ -139,10 +153,9 @@ frontend: className: "" annotations: {} hosts: - - host: chart-example.local - paths: + - paths: - path: / - pathType: ImplementationSpecific + pathType: Prefix tls: [] route: enabled: false @@ -150,6 +163,17 @@ frontend: path: / tls: [] wildcardPolicy: None + # GKE healthcheck config + backendConfig: + enabled: false + healthCheck: + checkIntervalSec: 30 + timeoutSec: 10 + healthyThreshold: 1 + unhealthyThreshold: 3 + path: "/signin" + port: 3000 + type: HTTP resources: {} autoscaling: enabled: false @@ -199,26 +223,6 @@ websocket: service: type: ClusterIP port: 6001 - ingress: - enabled: true - className: "" - annotations: - kubernetes.io/ingress.class: nginx - nginx.ingress.kubernetes.io/enable-websocket: "true" - nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" - nginx.ingress.kubernetes.io/proxy-send-timeout: "3600" - hosts: - - host: websocket.example.local - paths: - - path: / - pathType: ImplementationSpecific - tls: [] - route: - enabled: false - host: websocket.example.local - path: / - tls: [] - wildcardPolicy: None resources: {} autoscaling: enabled: false @@ -233,15 +237,28 @@ websocket: enabled: false probes: livenessProbe: - tcpSocket: - port: 6001 - initialDelaySeconds: 30 - periodSeconds: 10 + httpGet: + path: / + port: http readinessProbe: - tcpSocket: - port: 6001 - initialDelaySeconds: 30 - periodSeconds: 10 + httpGet: + path: / + port: http + ingress: + enabled: false + className: "nginx" + hosts: + - host: chart-example-websocket.local + paths: + - path: / + pathType: Prefix + tls: [] + annotations: {} + route: + enabled: false + host: chart-example.local + wildcardPolicy: None + tls: [] database: enabled: true @@ -253,7 +270,7 @@ database: pvc: enabled: true size: 5Gi - storageClass: "" + storageClass: "standard-rwo" image: repository: mysql pullPolicy: IfNotPresent From 45d89f33de7ca8c33298b99500449d3865e25e6c Mon Sep 17 00:00:00 2001 From: shahargl Date: Thu, 10 Oct 2024 18:46:57 +0300 Subject: [PATCH 2/7] feat: gke --- charts/keep/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/keep/Chart.yaml b/charts/keep/Chart.yaml index 96aa116..b8cda33 100644 --- a/charts/keep/Chart.yaml +++ b/charts/keep/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: keep -version: 0.1.20 +version: 0.1.21 description: Keep Helm Chart type: application icon: https://platform.keephq.dev/_next/image?url=%2Fkeep.png&w=48&q=75 From 0519c4c3e744574c15cb0a4b5ab98a05d43fd93d Mon Sep 17 00:00:00 2001 From: shahargl Date: Sun, 13 Oct 2024 10:31:33 +0300 Subject: [PATCH 3/7] feat: gke --- charts/keep/templates/frontend-ingress.yaml | 2 +- .../templates/{ => gke}/backend-gke-healthcheck-config.yaml | 2 +- .../{ => gke}/frontend-gke-healthcheck-config.yaml | 2 +- charts/keep/values.yaml | 6 +----- 4 files changed, 4 insertions(+), 8 deletions(-) rename charts/keep/templates/{ => gke}/backend-gke-healthcheck-config.yaml (91%) rename charts/keep/templates/{ => gke}/frontend-gke-healthcheck-config.yaml (91%) diff --git a/charts/keep/templates/frontend-ingress.yaml b/charts/keep/templates/frontend-ingress.yaml index f6bf0f0..c113f3f 100644 --- a/charts/keep/templates/frontend-ingress.yaml +++ b/charts/keep/templates/frontend-ingress.yaml @@ -61,4 +61,4 @@ spec: {{- if .Values.frontend.extraIngress -}} {{ toYaml .Values.frontend.extraIngress | nindent 2 }} {{- end }} -{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/keep/templates/backend-gke-healthcheck-config.yaml b/charts/keep/templates/gke/backend-gke-healthcheck-config.yaml similarity index 91% rename from charts/keep/templates/backend-gke-healthcheck-config.yaml rename to charts/keep/templates/gke/backend-gke-healthcheck-config.yaml index 5c868ec..3767863 100644 --- a/charts/keep/templates/backend-gke-healthcheck-config.yaml +++ b/charts/keep/templates/gke/backend-gke-healthcheck-config.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.isGKE .Values.backend.backendConfig.enabled -}} +{{- if .Values.isGKE -}} apiVersion: cloud.google.com/v1 kind: BackendConfig metadata: diff --git a/charts/keep/templates/frontend-gke-healthcheck-config.yaml b/charts/keep/templates/gke/frontend-gke-healthcheck-config.yaml similarity index 91% rename from charts/keep/templates/frontend-gke-healthcheck-config.yaml rename to charts/keep/templates/gke/frontend-gke-healthcheck-config.yaml index c81feea..09afffe 100644 --- a/charts/keep/templates/frontend-gke-healthcheck-config.yaml +++ b/charts/keep/templates/gke/frontend-gke-healthcheck-config.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.isGKE .Values.frontend.backendConfig.enabled -}} +{{- if .Values.isGKE -}} apiVersion: cloud.google.com/v1 kind: BackendConfig metadata: diff --git a/charts/keep/values.yaml b/charts/keep/values.yaml index dd728bf..048744a 100644 --- a/charts/keep/values.yaml +++ b/charts/keep/values.yaml @@ -26,8 +26,6 @@ backend: value: k8s - name: PORT value: "8080" - - name: SECRET_MANAGER_DIRECTORY - value: /state - name: PUSHER_APP_ID value: 1 - name: PUSHER_APP_KEY @@ -69,9 +67,8 @@ backend: path: / tls: [] wildcardPolicy: None - # GKE healthcheck config (backend) + # GKE healthcheck config backendConfig: - enabled: false healthCheck: checkIntervalSec: 30 timeoutSec: 10 @@ -165,7 +162,6 @@ frontend: wildcardPolicy: None # GKE healthcheck config backendConfig: - enabled: false healthCheck: checkIntervalSec: 30 timeoutSec: 10 From e43a2ad169e75384a22add6ba8951f135edc6142 Mon Sep 17 00:00:00 2001 From: shahargl Date: Sun, 13 Oct 2024 10:36:10 +0300 Subject: [PATCH 4/7] feat remove spaces --- charts/keep/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/keep/values.yaml b/charts/keep/values.yaml index 048744a..3f29225 100644 --- a/charts/keep/values.yaml +++ b/charts/keep/values.yaml @@ -251,10 +251,10 @@ websocket: tls: [] annotations: {} route: - enabled: false + enabled: false host: chart-example.local wildcardPolicy: None - tls: [] + tls: [] database: enabled: true From 01fd2b0a911585aa9e863a4a20b3fba10df5e198 Mon Sep 17 00:00:00 2001 From: shahargl Date: Sun, 13 Oct 2024 10:43:57 +0300 Subject: [PATCH 5/7] feat remove spaces --- charts/keep/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/keep/values.yaml b/charts/keep/values.yaml index 3f29225..0ab4fef 100644 --- a/charts/keep/values.yaml +++ b/charts/keep/values.yaml @@ -266,7 +266,7 @@ database: pvc: enabled: true size: 5Gi - storageClass: "standard-rwo" + storageClass: "" image: repository: mysql pullPolicy: IfNotPresent From c34514256404da8d24ca0aed4b1f40d36cd50548 Mon Sep 17 00:00:00 2001 From: shahargl Date: Sun, 13 Oct 2024 10:45:21 +0300 Subject: [PATCH 6/7] feat remove spaces --- charts/keep/templates/db-pvc.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/charts/keep/templates/db-pvc.yaml b/charts/keep/templates/db-pvc.yaml index 8e0aa3d..6ab6274 100644 --- a/charts/keep/templates/db-pvc.yaml +++ b/charts/keep/templates/db-pvc.yaml @@ -6,9 +6,7 @@ metadata: spec: accessModes: - ReadWriteOnce - {{- if .Values.database.pvc.storageClass }} storageClassName: {{ .Values.database.pvc.storageClass }} - {{- end }} resources: requests: storage: {{ .Values.database.pvc.size }} From 3c9982f30590988186d2ed75441cc817003369b1 Mon Sep 17 00:00:00 2001 From: shahargl Date: Sun, 13 Oct 2024 10:47:02 +0300 Subject: [PATCH 7/7] feat remove spaces --- charts/keep/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/keep/values.yaml b/charts/keep/values.yaml index 0ab4fef..dd4cc31 100644 --- a/charts/keep/values.yaml +++ b/charts/keep/values.yaml @@ -74,7 +74,7 @@ backend: timeoutSec: 10 healthyThreshold: 1 unhealthyThreshold: 3 - path: "/" + path: "/docs" port: 8080 type: HTTP resources: {}