Skip to content

ci: Add pgbouncer smoke tests #341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
8 changes: 0 additions & 8 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ jobs:
with:
fetch-depth: 0

- name: Envsubst
uses: danielr1996/[email protected]
env:
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
with:
input: charts/flagsmith/ci/e2e-test-values.yaml
output: charts/flagsmith/ci/e2e-test-values.yaml

- name: Set up Helm
uses: azure/setup-helm@v4
with:
Expand Down
13 changes: 2 additions & 11 deletions charts/flagsmith/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,11 @@ apiVersion: v2
name: flagsmith
description: Flagsmith
type: application
version: 0.73.1
version: 1.0.0-rc.1
appVersion: 2.171.0
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 12.5.8
condition: postgresql.enabled,devPostgresql.enabled
alias: devPostgresql
- name: influxdb2
repository: https://helm.influxdata.com/
version: 2.1.1
condition: influxdb2.enabled
- name: graphite
repository: https://kiwigrid.github.io
version: 0.7.3
condition: graphite.enabled

icon: https://docs.flagsmith.com/img/square-icon.png
13 changes: 0 additions & 13 deletions charts/flagsmith/ci/e2e-test-values.yaml

This file was deleted.

24 changes: 24 additions & 0 deletions charts/flagsmith/ci/test-replica-urls-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
tests:
enabled: true

influxdb2:
enabled: false

pgbouncer:
enabled: true

databaseExternal:
replicas:
databases:
- url: postgres://user:[email protected]:5432/flagsmith

- type: postgres
host: 127.0.0.1
port: 5433
database: flagsmith
username: user
password: password

- fromExistingSecret:
name: test-replica-secret
key: database-url
2 changes: 0 additions & 2 deletions charts/flagsmith/ci/test-values.yaml

This file was deleted.

124 changes: 64 additions & 60 deletions charts/flagsmith/templates/_api_environment.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,79 @@
- name: DATABASE_URL
valueFrom:
secretKeyRef:
{{- if and .Values.databaseExternal.enabled .Values.databaseExternal.urlFromExistingSecret.enabled }}
name: {{ .Values.databaseExternal.urlFromExistingSecret.name }}
key: {{ .Values.databaseExternal.urlFromExistingSecret.key }}
{{- else }}
name: {{ template "flagsmith.fullname" . }}
key: DATABASE_URL
{{- end }}
- name: DJANGO_SECRET_KEY
valueFrom:
secretKeyRef:
{{ include "flagsmith.api.secretKeySecretRef" . | nindent 6 }}
{{- 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

{{- with .Values.database }}

{{- if and .database.secret .database.key }}
- name: DJANGO_DB_NAME
valueFrom:
secretKeyRef:
{{- if .Values.influxdb2.adminUser.existingSecret }}
name: {{ .Values.influxdb2.adminUser.existingSecret }}
key: admin-token
{{- else }}
name: {{ template "flagsmith.influxdb.fullname" . }}-auth
key: admin-token
{{- end }}
{{- else if .Values.influxdbExternal.enabled }}
name: {{ .database.secret }}
key: {{ .database.key }}
{{- else }}
- name: DJANGO_DB_NAME
value: "postgres"
{{- end }}

{{- if and .username.secret .username.key }}
- name: DJANGO_DB_USER
valueFrom:
secretKeyRef:
name: {{ .username.secret }}
key: {{ .username.key }}
{{- else }}
- name: DJANGO_DB_USER
value: "postgres"
{{- end }}

{{- if and .host.secret .host.key }}
- name: DJANGO_DB_HOST
valueFrom:
secretKeyRef:
name: {{ .host.secret }}
key: {{ .host.key }}
{{- else }}
- name: DJANGO_DB_HOST
value: flagsmith-postgresql-hl
{{- end }}
{{- if and .portSecret .portKey }}
- name: DJANGO_DB_PORT
valueFrom:
secretKeyRef:
name: {{ .portSecret }}
key: {{ .portKey }}
{{- else if .port }}
- name: DJANGO_DB_PORT
value: {{ .port | quote }}
{{ end }}
{{- if and .password.secret .password.key }}
- name: DJANGO_DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .password.secret }}
key: {{ .password.key }}
{{- else }}
- name: DJANGO_DB_PASSWORD
valueFrom:
secretKeyRef:
name: flagsmith-postgresql
key: postgres-password
{{- end }}
{{- end }}
{{- if .Values.influxdb.enabled }}
- name: INFLUXDB_URL
value: {{ .Values.influxdbExternal.url | required "Must specify a URL for an external InfluxDB" }}
value: {{ .Values.influxdb.url | required "Must specify a URL for an external InfluxDB" }}
- name: INFLUXDB_BUCKET
value: {{ .Values.influxdbExternal.bucket | required "Must specify a bucket for an external InfluxDB" }}
value: {{ .Values.influxdb.bucket | required "Must specify a bucket for an external InfluxDB" }}
- name: INFLUXDB_ORG
value: {{ .Values.influxdbExternal.organization | required "Must specify an organization for an external InfluxDB" }}
value: {{ .Values.influxdb.organization | required "Must specify an organization for an external InfluxDB" }}
- name: INFLUXDB_TOKEN
valueFrom:
secretKeyRef:
{{- if .Values.influxdbExternal.tokenFromExistingSecret.enabled }}
name: {{ .Values.influxdbExternal.tokenFromExistingSecret.name | required "Must set secret name for external InfluxDB secret" }}
key: {{ .Values.influxdbExternal.tokenFromExistingSecret.key | required "Must set key for external InfluxDB secret" }}
{{- if .Values.influxdb.token.secret }}
name: {{ .Values.influxdb.token.secret | required "Must set secret name for external InfluxDB secret" }}
key: {{ .Values.influxdb.token.key | required "Must set key for external InfluxDB secret" }}
{{- else }}
name: {{ template "flagsmith.influxdb.fullname" . }}-external-auth
key: admin-token
Expand All @@ -62,32 +94,8 @@
- name: {{ $envName }}
value: {{ $envValue | quote }}
{{- end }}
{{- with .Values.api.statsd }}
{{- if .enabled }}
- name: STATSD_HOST
{{- if .host }}
value: {{ .host }}
{{- else if .hostFromNodeIp }}
valueFrom:
fieldRef:
fieldPath: status.hostIP
{{- else if (and $.Values.graphite.enabled $.Values.graphite.autoSetStatsdHostEnvVar) }}
value: {{ template "flagsmith.graphite.fullname" $ }}
{{- else }}
{{ fail "Must set api.statsd.host or api.statsd.hostFromNodeIp or enable graphite and set graphite.autoSetStatsdHostEnvVar" }}
{{- end }}
- name: STATSD_PORT
value: {{ .port | quote }}
{{- if .prefix }}
- name: STATSD_PREFIX
value: {{ .prefix }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.taskProcessor.enabled }}
- name: TASK_RUN_METHOD
value: TASK_PROCESSOR
{{- end }}
{{- range $envName, $secretKeyRef := .Values.api.extraEnvFromSecret }}
- name: {{ $envName }}
valueFrom:
Expand All @@ -99,10 +107,6 @@
- name: USE_X_FORWARDED_HOST
value: 'true'
{{- end }}
{{- if and .Values._destructiveTests.enabled .Values._destructiveTests.testToken }}
- name: E2E_TEST_AUTH_TOKEN
value: {{ .Values._destructiveTests.testToken | quote }}
{{- end }}
{{- if .Values.api.logging.format }}
- name: LOG_FORMAT
value: {{ .Values.api.logging.format }}
Expand Down
Loading
Loading