Skip to content

Commit

Permalink
trying to get around SCL Postgres container limitations
Browse files Browse the repository at this point in the history
  • Loading branch information
alecmerdler committed Oct 17, 2020
1 parent 5e21bfc commit 71e1031
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
1 change: 0 additions & 1 deletion kustomize/components/clair/postgres.deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ spec:
claimName: clair-postgres
securityContext:
fsGroup: 0
defaultMode: 0740
containers:
- name: postgres
image: postgres:latest
Expand Down
1 change: 1 addition & 0 deletions kustomize/components/postgres/create-extensions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

echo "attempting to install required pg_trgm extension"

# FIXME(alecmerdler): Wait until `PG_INITIALIZED` is not false, then run the below command
psql -d $POSTGRESQL_DATABASE -c 'CREATE EXTENSION pg_trgm;'
1 change: 1 addition & 0 deletions kustomize/components/postgres/migrate.job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ spec:
- "--format"
- "c"
- "--file"
# FIXME(alecmerdler): Fix this for SCL Postgres container.
- "/var/lib/postgresql/data/dump.sql"
volumeMounts:
- name: postgres-data
Expand Down
14 changes: 11 additions & 3 deletions kustomize/components/postgres/postgres.deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ spec:
- name: postgres-bootstrap
secret:
secretName: postgres-bootstrap
defaultMode: 0777
items:
- key: create-extensions.sh
path: create-extensions.sh
- key: restore.sh
path: restore.sh
securityContext:
fsGroup: 0
# FIXME(alecmerdler): This is not being marshaled from octal correctly (probably due to our YAML library) and is turing into `420`
defaultMode: 0740
containers:
- name: postgres
image: postgres:latest
Expand All @@ -51,5 +50,14 @@ spec:
volumeMounts:
- name: postgres-data
mountPath: /var/lib/pgsql/data
# FIXME(alecmerdler): `postgresql-init` does not work because the Quay database hasn't been created yet...
# - name: postgres-bootstrap
# mountPath: /opt/app-root/src/postgresql-init
# TODO(alecmerdler): Run another container which runs installs the `pg_trgm` extension to the Quay database (since the SCL container does not support post-init hooks...)
- name: postgres-extensions
image: postgres:latest
command:
- /opt/app-root/src/docker-entrypoint-initdb.d/create-extensions.sh
volumeMounts:
- name: postgres-bootstrap
mountPath: /opt/app-root/src/postgresql-init
mountPath: /opt/app-root/src/docker-entrypoint-initdb.d
2 changes: 1 addition & 1 deletion kustomize/overlays/downstream/v3.4.0/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ images:
newName: registry.access.redhat.com/rhscl/redis-32-rhel7
- name: postgres
newName: registry.access.redhat.com/rhscl/postgresql-10-rhel7
newTag: 1-35
newTag: latest
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ images:
newName: registry.access.redhat.com/rhscl/redis-32-rhel7
- name: postgres
newName: registry.access.redhat.com/rhscl/postgresql-10-rhel7
newTag: 1-35
# FIXME(alecmerdler): Need to handle `redhat-pull-secret` (potentially with a `secretGenerator`?)...
newTag: latest

0 comments on commit 71e1031

Please sign in to comment.