From fcf8d81e225cca9d8472bf49c531c36b3952aa7b Mon Sep 17 00:00:00 2001 From: Lily Cohen <lilithmooncohen@gmail.com> Date: Wed, 7 Jun 2023 13:34:43 -0600 Subject: [PATCH] helm chart version 0.1.3 for v14.0.0-rc2c --- charts/calckey/Chart.yaml | 4 +- charts/calckey/README.md | 44 ++++--- charts/calckey/templates/_helpers.tpl | 110 +++++++++++------- ...deployment.yaml => deployment-server.yaml} | 46 ++++++-- .../calckey/templates/deployment-worker.yaml | 98 ++++++++++++++++ charts/calckey/templates/hpa-server.yaml | 28 +++++ charts/calckey/templates/hpa-worker.yaml | 28 +++++ charts/calckey/templates/hpa.yaml | 28 ----- charts/calckey/templates/job-db-migrate.yaml | 2 +- .../templates/secret-config-server.yaml | 9 ++ .../templates/secret-config-worker.yaml | 11 ++ charts/calckey/templates/secret-config.yaml | 9 -- charts/calckey/templates/service.yaml | 1 + charts/calckey/values.yaml | 75 ++++++++---- 14 files changed, 365 insertions(+), 128 deletions(-) rename charts/calckey/templates/{deployment.yaml => deployment-server.yaml} (59%) create mode 100644 charts/calckey/templates/deployment-worker.yaml create mode 100644 charts/calckey/templates/hpa-server.yaml create mode 100644 charts/calckey/templates/hpa-worker.yaml delete mode 100644 charts/calckey/templates/hpa.yaml create mode 100644 charts/calckey/templates/secret-config-server.yaml create mode 100644 charts/calckey/templates/secret-config-worker.yaml delete mode 100644 charts/calckey/templates/secret-config.yaml diff --git a/charts/calckey/Chart.yaml b/charts/calckey/Chart.yaml index 820c2313ae..c77dbc0323 100644 --- a/charts/calckey/Chart.yaml +++ b/charts/calckey/Chart.yaml @@ -15,13 +15,13 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.2 +version: 0.1.3 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "rc" +appVersion: "v14.0.0-rc2c" dependencies: - name: elasticsearch diff --git a/charts/calckey/README.md b/charts/calckey/README.md index 1bcbd87537..d6c3e0fa8b 100644 --- a/charts/calckey/README.md +++ b/charts/calckey/README.md @@ -1,6 +1,6 @@ # calckey -   +   A fun, new, open way to experience social media https://calckey.org @@ -17,25 +17,29 @@ A fun, new, open way to experience social media https://calckey.org | Key | Type | Default | Description | |-----|------|---------|-------------| | affinity | object | `{}` | | -| autoscaling.enabled | bool | `false` | | -| autoscaling.maxReplicas | int | `100` | | -| autoscaling.minReplicas | int | `1` | | -| autoscaling.targetCPUUtilizationPercentage | int | `80` | | | calckey.allowedPrivateNetworks | list | `[]` | If you want to allow calckey to connect to private ips, enter the cidrs here. | | calckey.deepl.authKey | string | `""` | | | calckey.deepl.isPro | bool | `false` | | | calckey.deepl.managed | bool | `false` | | | calckey.domain | string | `"calckey.local"` | | -| calckey.isManagedHosting | bool | `true` | | +| calckey.email.from_address | string | `"notifications@example.com"` | | +| calckey.email.login | string | `""` | | +| calckey.email.managed | bool | `false` | | +| calckey.email.password | string | `""` | | +| calckey.email.port | int | `587` | | +| calckey.email.server | string | `"smtp.mailgun.org"` | | +| calckey.email.useImplicitSslTls | bool | `false` | | +| calckey.isManagedHosting | bool | `false` | | | calckey.libreTranslate.apiKey | string | `""` | | | calckey.libreTranslate.apiUrl | string | `""` | | | calckey.libreTranslate.managed | bool | `false` | | +| calckey.logTime | bool | `true` | | | calckey.objectStorage.access_key | string | `""` | | | calckey.objectStorage.access_secret | string | `""` | | | calckey.objectStorage.baseUrl | string | `""` | | | calckey.objectStorage.bucket | string | `""` | | | calckey.objectStorage.endpoint | string | `""` | | -| calckey.objectStorage.managed | bool | `true` | | +| calckey.objectStorage.managed | bool | `false` | | | calckey.objectStorage.prefix | string | `"files"` | | | calckey.objectStorage.region | string | `""` | | | calckey.reservedUsernames[0] | string | `"root"` | | @@ -43,17 +47,23 @@ A fun, new, open way to experience social media https://calckey.org | calckey.reservedUsernames[2] | string | `"administrator"` | | | calckey.reservedUsernames[3] | string | `"me"` | | | calckey.reservedUsernames[4] | string | `"system"` | | -| calckey.smtp.from_address | string | `"notifications@example.com"` | | -| calckey.smtp.login | string | `""` | | -| calckey.smtp.managed | bool | `true` | | -| calckey.smtp.password | string | `""` | | -| calckey.smtp.port | int | `587` | | -| calckey.smtp.server | string | `"smtp.mailgun.org"` | | -| calckey.smtp.useImplicitSslTls | bool | `false` | | +| calckey.separateWorker | bool | `true` | | +| calckey.server.autoscaling.enabled | bool | `false` | | +| calckey.server.autoscaling.maxReplicas | int | `100` | | +| calckey.server.autoscaling.minReplicas | int | `1` | | +| calckey.server.autoscaling.targetCPUUtilizationPercentage | int | `80` | | +| calckey.server.replicaCount | int | `1` | | +| calckey.server.resources | object | `{}` | | +| calckey.worker.autoscaling.enabled | bool | `false` | | +| calckey.worker.autoscaling.maxReplicas | int | `100` | | +| calckey.worker.autoscaling.minReplicas | int | `1` | | +| calckey.worker.autoscaling.targetCPUUtilizationPercentage | int | `80` | | +| calckey.worker.replicaCount | int | `1` | | +| calckey.worker.resources | object | `{}` | | | elasticsearch | object | `{"auth":{},"enabled":false,"hostname":"","port":9200,"ssl":false}` | https://github.com/bitnami/charts/tree/master/bitnami/elasticsearch#parameters | | fullnameOverride | string | `""` | | | image.pullPolicy | string | `"IfNotPresent"` | | -| image.repository | string | `"docker.io/thatonecalculator/calckey"` | | +| image.repository | string | `"docker.io/lilthmooncohen/calckey"` | | | image.tag | string | `""` | | | imagePullSecrets | list | `[]` | | | ingress.annotations | object | `{}` | | @@ -72,11 +82,11 @@ A fun, new, open way to experience social media https://calckey.org | postgresql.auth.username | string | `"calckey"` | | | postgresql.enabled | bool | `true` | disable if you want to use an existing db; in which case the values below must match those of that external postgres instance | | redis.auth.password | string | `""` | you must set a password; the password generated by the redis chart will be rotated on each upgrade: | +| redis.db | string | `nil` | | | redis.enabled | bool | `true` | | | redis.hostname | string | `""` | | | redis.port | int | `6379` | | -| replicaCount | int | `1` | | -| resources | object | `{}` | | +| redis.prefix | string | `nil` | | | securityContext | object | `{}` | | | service.port | int | `80` | | | service.type | string | `"ClusterIP"` | | diff --git a/charts/calckey/templates/_helpers.tpl b/charts/calckey/templates/_helpers.tpl index b732fa5a4b..8e664ca275 100644 --- a/charts/calckey/templates/_helpers.tpl +++ b/charts/calckey/templates/_helpers.tpl @@ -78,9 +78,9 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- end -}} {{/* -config/default.yml content +Create the common config */}} -{{- define "calckey.configDir.default.yml" -}} +{{- define "calckey.config.common" -}} #━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ # Calckey configuration #━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -119,10 +119,10 @@ port: 3000 db: {{- if .Values.postgresql.enabled }} host: {{ template "calckey.postgresql.fullname" . }} - port: '5432' + port: 5432 {{- else }} host: {{ .Values.postgresql.postgresqlHostname }} - port: {{ .Values.postgresql.postgresqlPort | default "5432" | quote }} + port: {{ .Values.postgresql.postgresqlPort | default "5432" }} {{- end }} # Database name @@ -148,11 +148,26 @@ redis: {{- else }} host: {{ required "When the redis chart is disabled .Values.redis.hostname is required" .Values.redis.hostname }} {{- end }} - port: {{ .Values.redis.port | default "6379" | quote }} + port: {{ .Values.redis.port | default "6379" }} #family: 0 # 0=Both, 4=IPv4, 6=IPv6 pass: {{ .Values.redis.auth.password | quote }} - #prefix: example-prefix - #db: 1 + {{- if .Values.redis.prefix }} + prefix: {{ .Values.redis.prefix | quote }} + {{- end }} + {{- if .Values.redis.db }} + db: {{ .Values.redis.db }} + {{- end }} + +# Please configure either MeiliSearch *or* Sonic. +# If both MeiliSearch and Sonic configurations are present, MeiliSearch will take precedence. + +# ┌───────────────────────────┐ +#───┘ MeiliSearch configuration └───────────────────────────────────── +#meilisearch: +# host: meilisearch +# port: 7700 +# ssl: false +# apiKey: # ┌─────────────────────┐ #───┘ Sonic configuration └───────────────────────────────────── @@ -183,31 +198,13 @@ elasticsearch: {{- end }} {{- end }} -# ┌───────────────┐ -#───┘ ID generation └─────────────────────────────────────────── - -# You can select the ID generation method. -# You don't usually need to change this setting, but you can -# change it according to your preferences. - -# Available methods: -# aid ... Short, Millisecond accuracy -# meid ... Similar to ObjectID, Millisecond accuracy -# ulid ... Millisecond accuracy -# objectid ... This is left for backward compatibility - -# ONCE YOU HAVE STARTED THE INSTANCE, DO NOT CHANGE THE -# ID SETTINGS AFTER THAT! - -id: 'aid' - # ┌─────────────────────┐ #───┘ Other configuration └───────────────────────────────────── -# Max note length, should be < 8000. +# Maximum length of a post (default 3000, max 8192) #maxNoteLength: 3000 -# Maximum lenght of an image caption or file comment (default 1500, max 8192) +# Maximum length of an image caption (default 1500, max 8192) #maxCaptionLength: 1500 # Reserved usernames that only the administrator can register with @@ -244,6 +241,7 @@ reservedUsernames: #proxy: http://127.0.0.1:3128 #proxyBypassHosts: [ +# 'web.kaiteki.app', # 'example.com', # '192.0.2.8' #] @@ -271,19 +269,27 @@ allowedPrivateNetworks: # Upload or download file size limits (bytes) #maxFileSize: 262144000 +#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +# Congrats, you've reached the end of the config file needed for most deployments! +# Enjoy your Calckey server! +#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + + + +#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ # Managed hosting settings -# !!!!!!!!!! -# >>>>>> NORMAL SELF-HOSTERS, STAY AWAY! <<<<<< -# >>>>>> YOU DON'T NEED THIS! <<<<<< -# !!!!!!!!!! +# >>> NORMAL SELF-HOSTERS, STAY AWAY! <<< +# >>> YOU DON'T NEED THIS! <<< # Each category is optional, but if each item in each category is mandatory! # If you mess this up, that's on you, you've been warned... +#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ #maxUserSignups: 100 isManagedHosting: {{ .Values.calckey.isManagedHosting }} deepl: managed: {{ .Values.calckey.deepl.managed }} - authKey: {{ .Values.calckey.deepl.authKey | quote}} + authKey: {{ .Values.calckey.deepl.authKey | quote }} isPro: {{ .Values.calckey.deepl.isPro }} libreTranslate: @@ -292,13 +298,14 @@ libreTranslate: apiKey: {{ .Values.calckey.libreTranslate.apiKey | quote }} email: - managed: {{ .Values.calckey.smtp.managed }} - address: {{ .Values.calckey.smtp.from_address | quote }} - host: {{ .Values.calckey.smtp.server | quote }} - port: {{ .Values.calckey.smtp.port }} - user: {{ .Values.calckey.smtp.login | quote }} - pass: {{ .Values.calckey.smtp.password | quote }} - useImplicitSslTls: {{ .Values.calckey.smtp.useImplicitSslTls }} + managed: {{ .Values.calckey.email.managed }} + address: {{ .Values.calckey.email.from_address | quote }} + host: {{ .Values.calckey.email.server | quote }} + port: {{ .Values.calckey.email.port }} + user: {{ .Values.calckey.email.login | quote }} + pass: {{ .Values.calckey.email.password | quote }} + useImplicitSslTls: {{ .Values.calckey.email.useImplicitSslTls }} + objectStorage: managed: {{ .Values.calckey.objectStorage.managed }} baseUrl: {{ .Values.calckey.objectStorage.baseUrl | quote }} @@ -320,4 +327,29 @@ objectStorage: # Seriously. Do NOT fill out the above settings if you're self-hosting. # They're much better off being set from the control panel. + +{{- end }} + +{{/* +Create the server config +*/}} +{{- define "calckey.config.server" -}} +{{ include "calckey.config.common" . }} +{{- if .Values.calckey.separateWorker }} +# Worker only mode +onlyQueueProcessor: false +{{- end }} + +{{- end }} + +{{/* +Create the worker config +*/}} +{{- define "calckey.config.worker" -}} +{{ include "calckey.config.common" . }} +{{- if .Values.calckey.separateWorker }} +# Worker only mode +onlyQueueProcessor: true +{{- end }} + {{- end }} diff --git a/charts/calckey/templates/deployment.yaml b/charts/calckey/templates/deployment-server.yaml similarity index 59% rename from charts/calckey/templates/deployment.yaml rename to charts/calckey/templates/deployment-server.yaml index 9b0c60694d..ef2cea2bb5 100644 --- a/charts/calckey/templates/deployment.yaml +++ b/charts/calckey/templates/deployment-server.yaml @@ -1,25 +1,29 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "calckey.fullname" . }} + name: {{ include "calckey.fullname" . }}-server labels: {{- include "calckey.labels" . | nindent 4 }} spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} + {{- if not .Values.calckey.server.autoscaling.enabled }} + replicas: {{ .Values.calckey.server.replicaCount }} {{- end }} selector: matchLabels: {{- include "calckey.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: server + app.kubernetes.io/part-of: calckey template: metadata: annotations: - checksum/secret-config: {{ include ( print $.Template.BasePath "/secret-config.yaml" ) . | sha256sum | quote }} + checksum/secret-config: {{ include ( print $.Template.BasePath "/secret-config-server.yaml" ) . | sha256sum | quote }} {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "calckey.selectorLabels" . | nindent 8 }} + app.kubernetes.io/component: server + app.kubernetes.io/part-of: calckey spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: @@ -31,7 +35,27 @@ spec: volumes: - name: config-volume secret: - secretName: {{ template "calckey.fullname" . }}-config + secretName: {{ template "calckey.fullname" . }}-config-server + - name: calckey-config-dir + emptyDir: {} + initContainers: + - name: init-config + image: alpine + command: ["/bin/sh"] + args: + - -c + - >- + cat /mnt/default.yml > /calckey/.config/default.yml && + echo "" >> /calckey/.config/default.yml && + echo "cuid:" >> /calckey/.config/default.yml && + echo " fingerprint: $HOSTNAME" >> /calckey/.config/default.yml && + echo "" >> /calckey/.config/default.yml && + echo "Config initialized!" + volumeMounts: + - name: config-volume + mountPath: /mnt + - name: calckey-config-dir + mountPath: /calckey/.config containers: - name: {{ .Chart.Name }} securityContext: @@ -45,8 +69,16 @@ spec: env: - name: "NODE_ENV" value: "production" + {{- if .Values.calckey.logTime }} + - name: "MK_WITH_LOG_TIME" + value: "true" + {{- end }} + {{- if .Values.calckey.separateWorker }} + - name: "MK_ONLY_SERVER" + value: "true" + {{- end }} volumeMounts: - - name: config-volume + - name: calckey-config-dir mountPath: /calckey/.config ports: - name: http @@ -67,7 +99,7 @@ spec: path: / port: http resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml .Values.calckey.server.resources | nindent 12 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/calckey/templates/deployment-worker.yaml b/charts/calckey/templates/deployment-worker.yaml new file mode 100644 index 0000000000..90b21cedf4 --- /dev/null +++ b/charts/calckey/templates/deployment-worker.yaml @@ -0,0 +1,98 @@ +{{- if .Values.calckey.separateWorker }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "calckey.fullname" . }}-worker + labels: + {{- include "calckey.labels" . | nindent 4 }} +spec: + {{- if not .Values.calckey.worker.autoscaling.enabled }} + replicas: {{ .Values.calckey.worker.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "calckey.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: worker + app.kubernetes.io/part-of: calckey + template: + metadata: + annotations: + checksum/secret-config: {{ include ( print $.Template.BasePath "/secret-config-worker.yaml" ) . | sha256sum | quote }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "calckey.selectorLabels" . | nindent 8 }} + app.kubernetes.io/component: worker + app.kubernetes.io/part-of: calckey + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "calckey.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + - name: config-volume + secret: + secretName: {{ template "calckey.fullname" . }}-config-worker + - name: calckey-config-dir + emptyDir: {} + initContainers: + - name: init-config + image: alpine + command: ["/bin/sh"] + args: + - -c + - >- + cat /mnt/default.yml > /calckey/.config/default.yml && + echo "" >> /calckey/.config/default.yml && + echo "cuid:" >> /calckey/.config/default.yml && + echo " fingerprint: $HOSTNAME" >> /calckey/.config/default.yml && + echo "" >> /calckey/.config/default.yml && + echo "Config initialized!" + volumeMounts: + - name: config-volume + mountPath: /mnt + - name: calckey-config-dir + mountPath: /calckey/.config + 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: + - pnpm + - run + - start + env: + - name: "NODE_ENV" + value: "production" + {{- if .Values.calckey.logTime }} + - name: "MK_WITH_LOG_TIME" + value: "true" + {{- end }} + {{- if .Values.calckey.separateWorker }} + - name: "MK_ONLY_QUEUE" + value: "true" + {{- end }} + volumeMounts: + - name: calckey-config-dir + mountPath: /calckey/.config + resources: + {{- toYaml .Values.calckey.worker.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 }} +{{- end }} diff --git a/charts/calckey/templates/hpa-server.yaml b/charts/calckey/templates/hpa-server.yaml new file mode 100644 index 0000000000..4f51c23faa --- /dev/null +++ b/charts/calckey/templates/hpa-server.yaml @@ -0,0 +1,28 @@ +{{- if .Values.calckey.server.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "calckey.fullname" . }}-server + labels: + {{- include "calckey.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "calckey.fullname" . }} + minReplicas: {{ .Values.calckey.server.autoscaling.minReplicas }} + maxReplicas: {{ .Values.calckey.server.autoscaling.maxReplicas }} + metrics: + {{- if .Values.calckey.server.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.calckey.server.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.calckey.server.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.calckey.server.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/calckey/templates/hpa-worker.yaml b/charts/calckey/templates/hpa-worker.yaml new file mode 100644 index 0000000000..9d346f6ebe --- /dev/null +++ b/charts/calckey/templates/hpa-worker.yaml @@ -0,0 +1,28 @@ +{{- if .Values.calckey.worker.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "calckey.fullname" . }}-worker + labels: + {{- include "calckey.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "calckey.fullname" . }} + minReplicas: {{ .Values.calckey.worker.autoscaling.minReplicas }} + maxReplicas: {{ .Values.calckey.worker.autoscaling.maxReplicas }} + metrics: + {{- if .Values.calckey.worker.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.calckey.worker.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.calckey.worker.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.calckey.worker.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/calckey/templates/hpa.yaml b/charts/calckey/templates/hpa.yaml deleted file mode 100644 index 4cdd2b6255..0000000000 --- a/charts/calckey/templates/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "calckey.fullname" . }} - labels: - {{- include "calckey.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "calckey.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/charts/calckey/templates/job-db-migrate.yaml b/charts/calckey/templates/job-db-migrate.yaml index e006aef3bd..fbaeaba51c 100644 --- a/charts/calckey/templates/job-db-migrate.yaml +++ b/charts/calckey/templates/job-db-migrate.yaml @@ -28,7 +28,7 @@ spec: volumes: - name: config-volume secret: - secretName: {{ template "calckey.fullname" . }}-config + secretName: {{ template "calckey.fullname" . }}-config-server containers: - name: {{ .Chart.Name }} securityContext: diff --git a/charts/calckey/templates/secret-config-server.yaml b/charts/calckey/templates/secret-config-server.yaml new file mode 100644 index 0000000000..6ba26e0d85 --- /dev/null +++ b/charts/calckey/templates/secret-config-server.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "calckey.fullname" . }}-config-server + labels: + {{- include "calckey.labels" . | nindent 4 }} +type: Opaque +data: + default.yml: {{ include "calckey.config.server" . | b64enc }} diff --git a/charts/calckey/templates/secret-config-worker.yaml b/charts/calckey/templates/secret-config-worker.yaml new file mode 100644 index 0000000000..b88dc988d0 --- /dev/null +++ b/charts/calckey/templates/secret-config-worker.yaml @@ -0,0 +1,11 @@ +{{- if .Values.calckey.separateWorker }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "calckey.fullname" . }}-config-worker + labels: + {{- include "calckey.labels" . | nindent 4 }} +type: Opaque +data: + default.yml: {{ include "calckey.config.worker" . | b64enc }} +{{- end }} diff --git a/charts/calckey/templates/secret-config.yaml b/charts/calckey/templates/secret-config.yaml deleted file mode 100644 index 2dad134c56..0000000000 --- a/charts/calckey/templates/secret-config.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: {{ template "calckey.fullname" . }}-config - labels: - {{- include "calckey.labels" . | nindent 4 }} -type: Opaque -data: - default.yml: {{ include "calckey.configDir.default.yml" . | b64enc }} diff --git a/charts/calckey/templates/service.yaml b/charts/calckey/templates/service.yaml index d46067a406..029aa0883f 100644 --- a/charts/calckey/templates/service.yaml +++ b/charts/calckey/templates/service.yaml @@ -13,3 +13,4 @@ spec: name: http selector: {{- include "calckey.selectorLabels" . | nindent 4 }} + app.kubernetes.io/component: server diff --git a/charts/calckey/values.yaml b/charts/calckey/values.yaml index 84c0536e5d..eb44a8260b 100644 --- a/charts/calckey/values.yaml +++ b/charts/calckey/values.yaml @@ -2,18 +2,20 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. -replicaCount: 1 image: - repository: docker.io/thatonecalculator/calckey + repository: docker.io/lilthmooncohen/calckey pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. tag: "" calckey: - isManagedHosting: true domain: calckey.local + separateWorker: true + isManagedHosting: false + logTime: true + deepl: managed: false authKey: "" @@ -24,8 +26,8 @@ calckey: apiUrl: "" apiKey: "" - smtp: - managed: true + email: + managed: false from_address: notifications@example.com port: 587 server: smtp.mailgun.org @@ -34,7 +36,7 @@ calckey: password: "" objectStorage: - managed: true + managed: false access_key: "" access_secret: "" baseUrl: "" # e.g. "https://my-bucket.nyc3.cdn.digitaloceanspaces.com" @@ -54,6 +56,46 @@ calckey: - me - system + server: + replicaCount: 1 + resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + + worker: + replicaCount: 1 + resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + # https://github.com/bitnami/charts/tree/master/bitnami/postgresql#parameters postgresql: # -- disable if you want to use an existing db; in which case the values below @@ -76,6 +118,8 @@ redis: enabled: true hostname: "" port: 6379 + prefix: + db: auth: # -- you must set a password; the password generated by the redis chart will be # rotated on each upgrade: @@ -142,25 +186,6 @@ ingress: # hosts: # - chart-example.local -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - nodeSelector: {} tolerations: []