diff --git a/charts/flagsmith/Chart.yaml b/charts/flagsmith/Chart.yaml index 252afae..4545508 100644 --- a/charts/flagsmith/Chart.yaml +++ b/charts/flagsmith/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: flagsmith description: Flagsmith type: application -version: 0.65.0 +version: 0.66.0 appVersion: 2.159.0 dependencies: - name: postgresql diff --git a/charts/flagsmith/ci/e2e-test-values.yaml b/charts/flagsmith/ci/e2e-test-values.yaml index ea2a7fa..b131a30 100644 --- a/charts/flagsmith/ci/e2e-test-values.yaml +++ b/charts/flagsmith/ci/e2e-test-values.yaml @@ -6,10 +6,8 @@ frontend: SLACK_TOKEN: "${SLACK_TOKEN}" api: + analytics: + enabled: true extraEnv: - EMAIL_BACKEND: 'django.core.mail.backends.console.EmailBackend' + EMAIL_BACKEND: "django.core.mail.backends.console.EmailBackend" FE_E2E_TEST_USER_EMAIL: nightwatch@solidstategroup.com -influxdb2: - # Needed to set this for the tests to not fail. Possibly related to - # https://github.com/Flagsmith/flagsmith/issues/340 - enabled: false diff --git a/charts/flagsmith/ci/influxdb-test-values.yaml b/charts/flagsmith/ci/influxdb-test-values.yaml deleted file mode 100644 index fc2a058..0000000 --- a/charts/flagsmith/ci/influxdb-test-values.yaml +++ /dev/null @@ -1,11 +0,0 @@ -tests: - enabled: true - -api: - extraEnv: - ENABLE_INFLUXDB_FEATURES: 'true' - influxdbSetup: - enabled: true - -influxdb2: - enabled: true diff --git a/charts/flagsmith/templates/NOTES.txt b/charts/flagsmith/templates/NOTES.txt index 13bce81..d102039 100644 --- a/charts/flagsmith/templates/NOTES.txt +++ b/charts/flagsmith/templates/NOTES.txt @@ -47,4 +47,15 @@ generate a large random value, store it in a secret, and set the following value See https://docs.flagsmith.com/deployment/locally-api#creating-a-secret-key {{- end }} +{{- if .Values.influxdb2.enabled }} + +###################################### +##### Warning: influxdb2 ##### +###################################### + +InfluxDB2 is deprecated and will be removed in the next major version. +Please set values under the `influxdbExternal` key +or migrate your analytics data to PostgreSQL by enabling `jobs.migrateAnalytics`. +{{- end }} + -------------------------------------- diff --git a/charts/flagsmith/templates/_api_environment.yaml b/charts/flagsmith/templates/_api_environment.yaml index 6019e96..a0e0f21 100644 --- a/charts/flagsmith/templates/_api_environment.yaml +++ b/charts/flagsmith/templates/_api_environment.yaml @@ -52,6 +52,15 @@ name: {{ template "flagsmith.influxdb.fullname" . }}-external-auth key: admin-token {{- end }} +{{- else if .Values.UsePostgresForAnalytics.enabled }} +{{- if not .Values.taskProcessor.enabled }} +{{ fail "To use PostgreSQL for analytics, `taskProcessor.enabled` should be set to `true`" }} +{{- end}} +- name: USE_POSTGRES_FOR_ANALYTICS + value: 'true' +{{- else }} +- name: DISABLE_ANALYTICS_FEATURES + value: 'true' {{- end }} - name: DJANGO_ALLOWED_HOSTS value: '*' diff --git a/charts/flagsmith/templates/jobs-migrate-analytics-data.yaml b/charts/flagsmith/templates/jobs-migrate-analytics-data.yaml new file mode 100644 index 0000000..0a90d5f --- /dev/null +++ b/charts/flagsmith/templates/jobs-migrate-analytics-data.yaml @@ -0,0 +1,39 @@ +{{- if .Values.jobs.migrateAnalyticsData.enabled -}} +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ template "flagsmith.fullname" . }}-migrate-analytics-data-{{ .Release.Revision }}-{{ randAlphaNum 5 | lower }} + {{- $annotations := include "flagsmith.annotations" .Values.common }} + {{- with $annotations }} + annotations: + {{- . | nindent 4 }} + {{- end }} + labels: + {{- include "flagsmith.labels" . | nindent 4 }} + app.kubernetes.io/component: job-migrate-analytics-data +spec: + template: + spec: + restartPolicy: Never + {{- if .Values.jobs.migrateDb.serviceAccountName }} + serviceAccountName: {{ .Values.jobs.migrateDb.serviceAccountName }} + {{- end }} + {{- if .Values.jobs.migrateDb.shareProcessNamespace }} + {{- end }} + shareProcessNamespace: true + containers: + - name: migrate-analytics-data + image: {{ .Values.api.image.repository }}:{{ .Values.api.image.tag | default (printf "%s" .Chart.AppVersion) }} + command: ["python","manage.py", "migrate_analytics"] + {{- if .Values.jobs.migrateAnalyticsData.args }} + args: {{ toYaml .Values.jobs.migrateAnalyticsData.args | nindent 8 }} + {{- end }} + env: {{ include (print $.Template.BasePath "/_api_environment.yaml") . | nindent 8 }} +{{- with .Values.jobs.migrateDb.extraContainers }} +{{- toYaml . | nindent 6 }} +{{- end }} + volumes: +{{- with .Values.jobs.migrateDb.extraVolumes }} +{{- toYaml . | nindent 6 }} +{{- end }} +{{- end -}} diff --git a/charts/flagsmith/values.yaml b/charts/flagsmith/values.yaml index 0dd1016..fa09749 100644 --- a/charts/flagsmith/values.yaml +++ b/charts/flagsmith/values.yaml @@ -297,6 +297,9 @@ influxdbExternal: name: null key: null +UsePostgresForAnalytics: + enabled: false + # This is included primarily for easy testing of statsd integration from the application. graphite: enabled: false @@ -426,6 +429,11 @@ jobs: extraVolumes: [] command: [] args: [] + migrateAnalyticsData: + enabled: false + args: [] + extraContainers: [] + extraVolumes: [] # These tests just make non-destructive requests to the services in # the cluster. Enabling this and running helm test is safe.