Skip to content

Commit 653b524

Browse files
khvn26gagantrivedi
authored andcommitted
feat: allow for PosgreSQL-based analytics, deprecate the in-chart InfluxDB usage
1 parent ceede85 commit 653b524

File tree

5 files changed

+58
-36
lines changed

5 files changed

+58
-36
lines changed

charts/flagsmith/ci/e2e-test-values.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ frontend:
66
SLACK_TOKEN: "${SLACK_TOKEN}"
77

88
api:
9+
analytics:
10+
enabled: true
911
extraEnv:
10-
EMAIL_BACKEND: 'django.core.mail.backends.console.EmailBackend'
12+
EMAIL_BACKEND: "django.core.mail.backends.console.EmailBackend"
1113
FE_E2E_TEST_USER_EMAIL: [email protected]
12-
influxdb2:
13-
# Needed to set this for the tests to not fail. Possibly related to
14-
# https://github.com/Flagsmith/flagsmith/issues/340
15-
enabled: false

charts/flagsmith/ci/influxdb-test-values.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

charts/flagsmith/templates/NOTES.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,35 @@ for information about how to gain web access to the application.
2424

2525
{{- end }}
2626

27+
{{- if not .Values.api.analytics.enabled }}
28+
29+
######################################################
30+
##### Analytics capabilities are off! #####
31+
##### Chart-provisioned InfluxDB is deprecated. #####
32+
######################################################
33+
34+
If you were provisioning an InfluxDB instance for Flagsmith's
35+
analytics with these charts, your data is safe, but no new data
36+
will be written to it.
37+
38+
*In a subsequent release, chart-provisioned InfluxDB and all related
39+
values under the `influxdb2` key will be removed.*
40+
41+
When you enable analytics by setting `api.analytics.enabled`
42+
to `true`, the following database backend will be used for analytics,
43+
in the order of preference:
44+
45+
1. External InfluxDB if `influxdbExternal.enabled` set to `true`
46+
2. Dedicated PostgreSQL specified by the `ANALYTICS_DATABASE_URL`
47+
environment variable
48+
3. External PostgreSQL if `databaseExternal.enabled` set to `true`
49+
4. Chart-provisioned PostgreSQL
50+
51+
Note that you can use a dedicated PostgreSQL instance by providing the
52+
value for `ANALYTICS_DATABASE_URL` environment variable under the
53+
`extraEnvFromSecret` key.
54+
{{- end}}
55+
2756
{{- if not .Values.api.secretKey }}
2857

2958
######################################

charts/flagsmith/templates/_api_environment.yaml

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,8 @@
1717
{{- else }}
1818
name: {{ template "flagsmith.fullname" . }}
1919
key: DJANGO_SECRET_KEY
20-
{{- end }}
21-
{{- if .Values.influxdb2.enabled }}
22-
- name: INFLUXDB_URL
23-
value: http://{{- template "flagsmith.influxdb.hostname" . -}}:80
24-
- name: INFLUXDB_BUCKET
25-
value: {{ .Values.influxdb2.adminUser.bucket }}
26-
- name: INFLUXDB_ORG
27-
value: {{ .Values.influxdb2.adminUser.organization }}
28-
- name: INFLUXDB_TOKEN
29-
valueFrom:
30-
secretKeyRef:
31-
{{- if .Values.influxdb2.adminUser.existingSecret }}
32-
name: {{ .Values.influxdb2.adminUser.existingSecret }}
33-
key: admin-token
34-
{{- else }}
35-
name: {{ template "flagsmith.influxdb.fullname" . }}-auth
36-
key: admin-token
37-
{{- end }}
38-
{{- else if .Values.influxdbExternal.enabled }}
20+
{{- if .Values.api.analytics.enabled }}
21+
{{- if .Values.influxdbExternal.enabled }}
3922
- name: INFLUXDB_URL
4023
value: {{ .Values.influxdbExternal.url | required "Must specify a URL for an external InfluxDB" }}
4124
- name: INFLUXDB_BUCKET
@@ -52,6 +35,13 @@
5235
name: {{ template "flagsmith.influxdb.fullname" . }}-external-auth
5336
key: admin-token
5437
{{- end }}
38+
{{- else }}
39+
- name: USE_POSTGRES_FOR_ANALYTICS
40+
value: 'true'
41+
{{- end }}
42+
{{- else }}
43+
- name: DISABLE_ANALYTICS_FEATURES
44+
value: 'true'
5545
{{- end }}
5646
- name: DJANGO_ALLOWED_HOSTS
5747
value: '*'

charts/flagsmith/values.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ api:
1010
tag: null # defaults to .Chart.AppVersion
1111
imagePullPolicy: IfNotPresent
1212
imagePullSecrets: []
13-
# Note that if setting this to false, need to set
13+
#
14+
# Note that if `separateApiAndFrontend` is `false`, you'll need to set
1415
# api.image.repository to flagsmith/flagsmith (or some other
1516
# repository hosting the image with combined frontend and backend)
1617
# and that the image tag exists (for flagsmith/flagsmith, >=2.10.0)
@@ -19,6 +20,21 @@ api:
1920
# (unless explicitly switched off), but both are handled by the api
2021
# deployment's pods.
2122
separateApiAndFrontend: true
23+
#
24+
# If `analytics.enabled` flag is `true`, the following database backend
25+
# will be used for analytics, in the order of preference:
26+
#
27+
# 1. External InfluxDB if `influxdbExternal.enabled` set to `true`
28+
# 2. Dedicated PostgreSQL specified by the `ANALYTICS_DATABASE_URL`
29+
# environment variable
30+
# 3. External PostgreSQL if `databaseExternal.enabled` set to `true`
31+
# 4. Chart-provisioned PostgreSQL
32+
#
33+
# Note that you can use a dedicated PostgreSQL instance by providing the
34+
# value for `ANALYTICS_DATABASE_URL` environment variable under the
35+
# `extraEnvFromSecret` key.
36+
analytics:
37+
enabled: false
2238
replicacount: 1
2339
deploymentStrategy: null
2440
podAnnotations: {}

0 commit comments

Comments
 (0)