Repository navigation
Add standalone pgsql-exporter for external databases - #969
Open
marcleblanc2 wants to merge 2 commits into
Open
marcleblanc2 wants to merge 2 commits into
marcleblanc2 wants to merge 2 commits into
Conversation
Adds <database>.postgresExporter.standalone (default false) for pgsql, codeIntelDB and codeInsightsDB. When the database is external (<database>.enabled: false) and the toggle is set, the chart deploys pgsql-exporter as its own Deployment and Service, so the Postgres panels in the Grafana dashboards work against e.g. AWS RDS. The exporter connects with the database's auth credentials; the sourcegraph.dataSource helper now builds DATA_SOURCE_URI from the secret's host and sslmode keys when the database is external, and is unchanged for the sidecar on internal databases. The Service carries app: <database name>, which Prometheus maps to the job label the dashboards group by. Also corrects the external-databases example README, which named the secret key pgsslmode; the chart reads sslmode. Closes #388 Amp-Thread-ID: https://ampcode.com/threads/T-01a1572d-c025-75ec-bf69-eaddc520e31c Co-authored-by: Amp <amp@ampcode.com>
…positive helm-unittest v1.0.2 short-circuits containsDocument with any: true when run with -q, as CI does, so assert by documentIndex instead. Both templates now iterate the databases in the same list order, so the indexes are predictable. Use the same existingSecret value as pgsqlAuth_test.yaml, since Checkov flagged the previous one as a secret. Amp-Thread-ID: https://ampcode.com/threads/T-01a1572d-c025-75ec-bf69-eaddc520e31c Co-authored-by: Amp <amp@ampcode.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #388
Checklist
What
Adds
<database>.postgresExporter.standalone(defaultfalse) forpgsql,codeIntelDBandcodeInsightsDB. When a database is external (<database>.enabled: false) and the toggle is set, the chart deployspgsql-exporteras its own Deployment + Service, so the Postgres panels in the Grafana dashboards work against managed databases such as AWS RDS.sourcegraph.dataSourcenow buildsDATA_SOURCE_URIfrom the auth secret'shostandsslmodekeys when the database is external. The sidecar on internal databases still renderslocalhost:...?sslmode=disable, unchanged.app: <database name>, which the Prometheus relabel config maps to thejoblabel the dashboards group by (job="codeinsights-db"is matched literally in the dashboard queries).podSecurityContext,nodeSelector,affinity,tolerations,priorityClassName,serviceAccount,podLabels/podAnnotationsandpostgresExporter.env, plus the globalpostgresExporter.image/resources.sourcegraph.disableKubernetesSecretsistrue, noDATA_SOURCE_*env is rendered; supply the DSN viapostgresExporter.env.pgsslmode; the chart readssslmode(already required by the application containers), so it's corrected.Test plan
helm lint charts/sourcegraph/: cleanhelm unittest charts/sourcegraph: 202 passed, including newtests/postgresExporterStandalone_test.yaml(no render by default, no render for internal DB with toggle on, no render for external DB with toggle off, one Deployment+Service per enabled DB, env wiring withexistingSecret, Service labels/annotations, sidecar DSN unchanged)helm templatewith default values diffed againstorigin/main: identicalhelm templatewith all three databases external andstandalone: true: three Deployments and Services render as expected (seecharts/sourcegraph/examples/external-databases/override.yaml)./scripts/helm-docs.sh: README regenerated, tree clean