Skip to content

Commit

Permalink
feat: allow for PosgreSQL-based analytics, deprecate the in-chart Inf…
Browse files Browse the repository at this point in the history
…luxDB usage
  • Loading branch information
khvn26 committed Apr 20, 2023
1 parent fac7085 commit b167961
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 22 deletions.
4 changes: 2 additions & 2 deletions charts/flagsmith/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: flagsmith
description: Flagsmith
type: application
version: 0.17.0
appVersion: 2.42.1
version: 0.18.0
appVersion: 2.50.2
dependencies:
- name: postgresql
repository: https://charts.helm.sh/stable
Expand Down
26 changes: 26 additions & 0 deletions charts/flagsmith/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,32 @@ for information about how to gain web access to the application.

{{- end }}

{{- if not .Values.api.analytics.enabled }}

######################################################
##### Analytics capabilities are off! #####
##### Chart-provisioned InfluxDB is deprecated. #####
######################################################

If you were provisioning an InfluxDB instance for Flagsmith's
analytics with these charts, your data is safe, but no new data
will be written to it.

*In a subsequent release, chart-provisioned InfluxDB and all related
values under the `influxdb2` key will be removed.*

When you enable analytics by setting `api.analytics.enabled`
to `true`, the following database backend will be used for analytics,
in the order of preference:

1. External InfluxDB if `influxdbExternal.enabled` set to `true`
2. External PostgreSQL if `databaseExternal.enabled` set to `true`
3. Chart-provisioned PostgreSQL

Note that you can use a dedicated PostgreSQL instance by providing the
value for `ANALYTICS_URL` environment variable under the `extraEnv` key.
{{- end}}

{{- if not .Values.api.secretKey }}

######################################
Expand Down
22 changes: 9 additions & 13 deletions charts/flagsmith/templates/_api_environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,8 @@
secretKeyRef:
name: {{ template "flagsmith.fullname" . }}
key: DJANGO_SECRET_KEY
{{- if .Values.influxdb2.enabled }}
- name: INFLUXDB_URL
value: http://{{- template "flagsmith.influxdb.hostname" . -}}:80
- name: INFLUXDB_BUCKET
value: {{ .Values.influxdb2.adminUser.bucket }}
- name: INFLUXDB_ORG
value: {{ .Values.influxdb2.adminUser.organization }}
- name: INFLUXDB_TOKEN
valueFrom:
secretKeyRef:
name: {{ template "flagsmith.influxdb.fullname" . }}-auth
key: admin-token
{{- else if .Values.influxdbExternal.enabled }}
{{- if .Values.api.analytics.enabled }}
{{- if .Values.influxdbExternal.enabled }}
- name: INFLUXDB_URL
value: {{ .Values.influxdbExternal.url | required "Must specify a URL for an external InfluxDB" }}
- name: INFLUXDB_BUCKET
Expand All @@ -42,6 +31,13 @@
name: {{ template "flagsmith.influxdb.fullname" . }}-external-auth
key: admin-token
{{- end }}
{{- else }}
- name: USE_POSTGRES_FOR_ANALYTICS
value: 'true'
{{- end }}
{{- else }}
- name: DISABLE_ANALYTICS_FEATURES
value: 'true'
{{- end }}
- name: DJANGO_ALLOWED_HOSTS
value: '*'
Expand Down
25 changes: 18 additions & 7 deletions charts/flagsmith/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ api:
tag: null # defaults to .Chart.AppVersion
imagePullPolicy: IfNotPresent
imagePullSecrets: []
# Note that if setting this to false, need to set
#
# Note that if setting `separateApiAndFrontend` is `false`, need to set
# api.image.repository to flagsmith/flagsmith (or some other
# repository hosting the image with combined frontend and backend)
# and that the image tag exists (for flagsmith/flagsmith, >=2.10.0)
Expand All @@ -13,6 +14,16 @@ api:
# (unless explicitly switched off), but both are handled by the api
# deployment's pods.
separateApiAndFrontend: true
#
# If `analytics.enabled` flag is `true`, the following database backend
# will be used for analytics, in the order of preference:
# 1. External InfluxDB if `influxdbExternal.enabled` set to `true`
# 2. External PostgreSQL if `databaseExternal.enabled` set to `true`
# 3. Chart-provisioned PostgreSQL
# Note that you can use a dedicated PostgreSQL instance by providing the
# value for `ANALYTICS_URL` environment variable under the `extraEnv` key.
analytics:
enabled: false
replicacount: 1
deploymentStrategy: null
podAnnotations: {}
Expand Down Expand Up @@ -233,14 +244,14 @@ pgbouncer:
influxdb2:
enabled: true
adminUser:
organization: 'influxdata'
bucket: 'default'
user: 'admin'
retention_policy: '0s'
organization: "influxdata"
bucket: "default"
user: "admin"
retention_policy: "0s"
## Leave empty to generate a random password and token.
## Or fill any of these values to use fixed values.
password: ''
token: ''
password: ""
token: ""
persistence:
enabled: false
# storageClass: "-"
Expand Down

0 comments on commit b167961

Please sign in to comment.