From 0b229146cbb0e3a7a1cf714a49b23055d4479cca Mon Sep 17 00:00:00 2001 From: Ilker Ispir Date: Sat, 11 Nov 2023 01:45:26 +1000 Subject: [PATCH] feat: adding external redis option (#87) * feat: adding external redis option * Update to 3.10.1 --- README.md | 1 + charts/terrakube/Chart.yaml | 3 ++- charts/terrakube/templates/secrets-api.yaml | 12 +++++++++++- charts/terrakube/templates/secrets-executor.yaml | 12 +++++++++++- charts/terrakube/values.schema.json | 6 +++++- charts/terrakube/values.yaml | 3 +++ 6 files changed, 33 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c334b55..7e3b22d 100644 --- a/README.md +++ b/README.md @@ -256,6 +256,7 @@ Once you have completed the above steps you can complete the file values.yaml to | postgres.* | No | Setup based on https://github.com/bitnami/charts/tree/main/bitnami/postgres | | redis.* | No | Setup based on https://github.com/bitnami/charts/tree/main/bitnami/redis | | api.enabled | Yes | true/false | +| api.defaultRedis | No | Enable default Redis using Bitnami helm chart | | api.defaultDatabase | No | Enable default database using postgresql helm chart | | api.version | Yes | Terrakube API version | | api.replicaCount | Yes | | diff --git a/charts/terrakube/Chart.yaml b/charts/terrakube/Chart.yaml index 36f4e71..11a0bd1 100644 --- a/charts/terrakube/Chart.yaml +++ b/charts/terrakube/Chart.yaml @@ -15,7 +15,7 @@ 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: 3.10.0 +version: 3.10.1 # 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 @@ -41,4 +41,5 @@ dependencies: - name: redis version: "17.10.1" + condition: api.defaultRedis repository: "https://charts.bitnami.com/bitnami" diff --git a/charts/terrakube/templates/secrets-api.yaml b/charts/terrakube/templates/secrets-api.yaml index 044df70..36e672e 100644 --- a/charts/terrakube/templates/secrets-api.yaml +++ b/charts/terrakube/templates/secrets-api.yaml @@ -16,10 +16,20 @@ stringData: AzBuilderExecutorUrl: 'http://terrakube-executor-service:8090/api/v1/terraform-rs' TerrakubeUiURL: '{{- if .Values.ingress.useTls }}https{{else}}http{{ end }}://{{ .Values.ingress.ui.domain }}' TERRAKUBE_ADMIN_GROUP: '{{ .Values.security.adminGroup }}' + + {{- if .Values.api.defaultRedis -}} + TerrakubeRedisHostname: 'terrakube-redis-master' - TerrakubeRedisPort: '6379' TerrakubeRedisPassword: '{{ .Values.redis.auth.password }}' + {{ else }} + + TerrakubeRedisHostname: '{{ .Values.api.properties.redisHostname }}' + TerrakubeRedisPassword: '{{ .Values.api.properties.redisPassword }}' + + {{- end }} + + TerrakubeRedisPort: '6379' {{- if .Values.storage.defaultStorage -}} diff --git a/charts/terrakube/templates/secrets-executor.yaml b/charts/terrakube/templates/secrets-executor.yaml index 7f4eb2c..45ca13e 100644 --- a/charts/terrakube/templates/secrets-executor.yaml +++ b/charts/terrakube/templates/secrets-executor.yaml @@ -16,10 +16,20 @@ stringData: TerrakubeEnableSecurity: 'true' TerrakubeRegistryDomain: '{{ .Values.ingress.registry.domain }}' TerrakubeApiUrl: '{{- if .Values.ingress.useTls }}https{{else}}http{{ end }}://{{ .Values.ingress.api.domain }}' + + {{- if .Values.api.defaultRedis -}} + TerrakubeRedisHostname: 'terrakube-redis-master' - TerrakubeRedisPort: '6379' TerrakubeRedisPassword: '{{ .Values.redis.auth.password }}' + {{ else }} + + TerrakubeRedisHostname: '{{ .Values.api.properties.redisHostname }}' + TerrakubeRedisPassword: '{{ .Values.api.properties.redisPassword }}' + + {{- end }} + + TerrakubeRedisPort: '6379' {{- if .Values.storage.defaultStorage -}} diff --git a/charts/terrakube/values.schema.json b/charts/terrakube/values.schema.json index 4c77e95..5eef183 100644 --- a/charts/terrakube/values.schema.json +++ b/charts/terrakube/values.schema.json @@ -154,7 +154,7 @@ }, "api": { "type": "object", - "required": ["enabled", "replicaCount", "properties", "defaultDatabase", "loadSampleData", "terraformReleasesUrl"], + "required": ["enabled", "replicaCount", "properties", "defaultDatabase", "defaultRedis", "loadSampleData", "terraformReleasesUrl"], "properties": { "enabled": { "description": "Enable API", @@ -217,6 +217,10 @@ "description": "Enable Default Database", "type": "boolean" }, + "defaultRedis": { + "description": "Enable Default Redis", + "type": "boolean" + }, "properties": { "type": "object", "required": ["databaseType", "databaseHostname", "databaseName", "databaseUser", "databasePassword"], diff --git a/charts/terrakube/values.yaml b/charts/terrakube/values.yaml index fe3ec99..bce1062 100644 --- a/charts/terrakube/values.yaml +++ b/charts/terrakube/values.yaml @@ -163,6 +163,7 @@ api: serviceAccountName: "" resources: {} defaultDatabase: true + defaultRedis: true loadSampleData: true terraformReleasesUrl: "https://releases.hashicorp.com/terraform/index.json" cache: @@ -179,6 +180,8 @@ api: databasePassword: "" databaseSslMode: "disable" databasePort: "3306" + redisHostname: "" + redisPassword: "" ## The database port is only used for mysql databases