Skip to content

Commit

Permalink
Make PGO backwards compatible with older crunchy-postgres-exporter im… (
Browse files Browse the repository at this point in the history
#3728)

* Make PGO backwards compatible with older crunchy-postgres-exporter images.

* Github action kuttl tests are failing due to recent changes to PGO. Get pgmonitor files and set QUERIES_CONFIG_DIR.

Co-authored-by: Chris Bandy <bandy.chris@gmail.com>

---------

Co-authored-by: Drew Sessler <drew.sessler@crunchydata.com>
Co-authored-by: Chris Bandy <bandy.chris@gmail.com>
  • Loading branch information
3 people authored Sep 22, 2023
1 parent e51f118 commit c4d39af
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ jobs:
- name: Build executable
run: PGO_VERSION='${{ github.sha }}' make build-postgres-operator

- name: Get pgMonitor files.
run: make get-pgmonitor
env:
PGMONITOR_DIR: "${{ github.workspace }}/hack/tools/pgmonitor"
QUERIES_CONFIG_DIR: "${{ github.workspace }}/hack/tools/queries"

# Start a Docker container with the working directory mounted.
- name: Start PGO
run: |
Expand All @@ -120,6 +126,7 @@ jobs:
hack/create-kubeconfig.sh postgres-operator pgo
docker run --detach --network host --read-only \
--volume "$(pwd):/mnt" --workdir '/mnt' --env 'PATH=/mnt/bin' \
--env 'QUERIES_CONFIG_DIR=/mnt/hack/tools/queries' \
--env 'KUBECONFIG=hack/.kube/postgres-operator/pgo' \
--env 'RELATED_IMAGE_PGADMIN=registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-4.30-17' \
--env 'RELATED_IMAGE_PGBACKREST=registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.47-0' \
Expand All @@ -133,6 +140,7 @@ jobs:
--env 'PGO_FEATURE_GATES=TablespaceVolumes=true' \
--name 'postgres-operator' ubuntu \
postgres-operator
- name: Install kuttl
run: |
curl -Lo /usr/local/bin/kubectl-kuttl https://github.com/kudobuilder/kuttl/releases/download/v0.13.0/kubectl-kuttl_0.13.0_linux_x86_64
Expand Down
3 changes: 3 additions & 0 deletions internal/pgmonitor/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ func GenerateDefaultExporterQueries(ctx context.Context, cluster *v1beta1.Postgr
// the source queries files.
func ExporterStartCommand(commandFlags []string) []string {
script := strings.Join([]string{
// Older images do not have the command on the PATH.
`PATH="$PATH:$(echo /opt/cpm/bin/postgres_exporter-*)"`,

// Set up temporary file to hold postgres_exporter process id
`POSTGRES_EXPORTER_PIDFILE=/tmp/postgres_exporter.pid`,

Expand Down

0 comments on commit c4d39af

Please sign in to comment.