Skip to content

Commit dc4dfad

Browse files
authored
Removed the bind-utils dependency (#628)
* Removed the bind-utils dependency and usage of `dig` since it was never being called * Fix run-postgresql-slave script and regenerate distgen files * Fixed regex in openshift imagestream test
1 parent f6bbc01 commit dc4dfad

File tree

24 files changed

+36
-121
lines changed

24 files changed

+36
-121
lines changed

12/Dockerfile.rhel8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4343
# safe in the future. This should *never* change, the last test is there
4444
# to make sure of that.
4545
RUN yum -y module enable postgresql:12 && \
46-
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper-libs postgresql-server postgresql-contrib" && \
46+
INSTALL_PKGS="rsync tar gettext nss_wrapper-libs postgresql-server postgresql-contrib" && \
4747
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
4848
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
4949
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \

12/root/usr/bin/run-postgresql-slave

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ generate_passwd_file
3131
generate_postgresql_config
3232

3333
wait_for_postgresql_master
34-
export MASTER_FQDN=$(postgresql_master_addr)
34+
export MASTER_FQDN=${POSTGRESQL_MASTER_IP}
3535
initialize_replica
3636

3737
unset_env_vars

12/root/usr/share/container-scripts/postgresql/common.sh

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -91,22 +91,6 @@ function unset_env_vars() {
9191
unset POSTGRESQL_{DATABASE,USER,PASSWORD,ADMIN_PASSWORD}
9292
}
9393

94-
# postgresql_master_addr lookups the 'postgresql-master' DNS and get list of the available
95-
# endpoints. Each endpoint is a PostgreSQL container with the 'master' PostgreSQL running.
96-
function postgresql_master_addr() {
97-
local service_name=${POSTGRESQL_MASTER_SERVICE_NAME:-postgresql-master}
98-
local endpoints=$(dig ${service_name} A +search | grep ";${service_name}" | cut -d ';' -f 2 2>/dev/null)
99-
# FIXME: This is for debugging (docker run)
100-
if [ -v POSTGRESQL_MASTER_IP ]; then
101-
endpoints=${POSTGRESQL_MASTER_IP:-}
102-
fi
103-
if [ -z "$endpoints" ]; then
104-
>&2 echo "Failed to resolve PostgreSQL master IP address"
105-
exit 3
106-
fi
107-
echo -n "$(echo $endpoints | cut -d ' ' -f 1)"
108-
}
109-
11094
# Converts the version in format x.y or x.y.z to a number.
11195
version2number ()
11296
{
@@ -290,12 +274,11 @@ function set_pgdata ()
290274

291275
function wait_for_postgresql_master() {
292276
while true; do
293-
master_fqdn=$(postgresql_master_addr)
294-
echo "Waiting for PostgreSQL master (${master_fqdn}) to accept connections ..."
277+
echo "Waiting for PostgreSQL master (${POSTGRESQL_MASTER_IP}) to accept connections ..."
295278
if [ -v POSTGRESQL_ADMIN_PASSWORD ]; then
296-
PGPASSWORD=${POSTGRESQL_ADMIN_PASSWORD} psql "postgresql://postgres@${master_fqdn}" -c "SELECT 1;" && return 0
279+
PGPASSWORD=${POSTGRESQL_ADMIN_PASSWORD} psql "postgresql://postgres@${POSTGRESQL_MASTER_IP}" -c "SELECT 1;" && return 0
297280
else
298-
PGPASSWORD=${POSTGRESQL_PASSWORD} psql "postgresql://${POSTGRESQL_USER}@${master_fqdn}/${POSTGRESQL_DATABASE}" -c "SELECT 1;" && return 0
281+
PGPASSWORD=${POSTGRESQL_PASSWORD} psql "postgresql://${POSTGRESQL_USER}@${POSTGRESQL_MASTER_IP}/${POSTGRESQL_DATABASE}" -c "SELECT 1;" && return 0
299282
fi
300283
sleep 1
301284
done

13/Dockerfile.c9s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4242
# safe in the future. This should *never* change, the last test is there
4343
# to make sure of that.
4444
RUN { yum -y module enable postgresql:13 || :; } && \
45-
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper-libs postgresql-server postgresql-contrib" && \
45+
INSTALL_PKGS="rsync tar gettext nss_wrapper-libs postgresql-server postgresql-contrib" && \
4646
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
4747
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
4848
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \

13/Dockerfile.rhel8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4343
# safe in the future. This should *never* change, the last test is there
4444
# to make sure of that.
4545
RUN yum -y module enable postgresql:13 && \
46-
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper-libs postgresql-server postgresql-contrib" && \
46+
INSTALL_PKGS="rsync tar gettext nss_wrapper-libs postgresql-server postgresql-contrib" && \
4747
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
4848
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
4949
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \

13/root/usr/bin/run-postgresql-slave

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ generate_passwd_file
3131
generate_postgresql_config
3232

3333
wait_for_postgresql_master
34-
export MASTER_FQDN=$(postgresql_master_addr)
34+
export MASTER_FQDN=${POSTGRESQL_MASTER_IP}
3535
initialize_replica
3636

3737
unset_env_vars

13/root/usr/share/container-scripts/postgresql/common.sh

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -91,22 +91,6 @@ function unset_env_vars() {
9191
unset POSTGRESQL_{DATABASE,USER,PASSWORD,ADMIN_PASSWORD}
9292
}
9393

94-
# postgresql_master_addr lookups the 'postgresql-master' DNS and get list of the available
95-
# endpoints. Each endpoint is a PostgreSQL container with the 'master' PostgreSQL running.
96-
function postgresql_master_addr() {
97-
local service_name=${POSTGRESQL_MASTER_SERVICE_NAME:-postgresql-master}
98-
local endpoints=$(dig ${service_name} A +search | grep ";${service_name}" | cut -d ';' -f 2 2>/dev/null)
99-
# FIXME: This is for debugging (docker run)
100-
if [ -v POSTGRESQL_MASTER_IP ]; then
101-
endpoints=${POSTGRESQL_MASTER_IP:-}
102-
fi
103-
if [ -z "$endpoints" ]; then
104-
>&2 echo "Failed to resolve PostgreSQL master IP address"
105-
exit 3
106-
fi
107-
echo -n "$(echo $endpoints | cut -d ' ' -f 1)"
108-
}
109-
11094
# Converts the version in format x.y or x.y.z to a number.
11195
version2number ()
11296
{
@@ -290,12 +274,11 @@ function set_pgdata ()
290274

291275
function wait_for_postgresql_master() {
292276
while true; do
293-
master_fqdn=$(postgresql_master_addr)
294-
echo "Waiting for PostgreSQL master (${master_fqdn}) to accept connections ..."
277+
echo "Waiting for PostgreSQL master (${POSTGRESQL_MASTER_IP}) to accept connections ..."
295278
if [ -v POSTGRESQL_ADMIN_PASSWORD ]; then
296-
PGPASSWORD=${POSTGRESQL_ADMIN_PASSWORD} psql "postgresql://postgres@${master_fqdn}" -c "SELECT 1;" && return 0
279+
PGPASSWORD=${POSTGRESQL_ADMIN_PASSWORD} psql "postgresql://postgres@${POSTGRESQL_MASTER_IP}" -c "SELECT 1;" && return 0
297280
else
298-
PGPASSWORD=${POSTGRESQL_PASSWORD} psql "postgresql://${POSTGRESQL_USER}@${master_fqdn}/${POSTGRESQL_DATABASE}" -c "SELECT 1;" && return 0
281+
PGPASSWORD=${POSTGRESQL_PASSWORD} psql "postgresql://${POSTGRESQL_USER}@${POSTGRESQL_MASTER_IP}/${POSTGRESQL_DATABASE}" -c "SELECT 1;" && return 0
299282
fi
300283
sleep 1
301284
done

15/Dockerfile.c9s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4242
# safe in the future. This should *never* change, the last test is there
4343
# to make sure of that.
4444
RUN { yum -y module enable postgresql:15 || :; } && \
45-
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper-libs postgresql-server postgresql-contrib" && \
45+
INSTALL_PKGS="rsync tar gettext nss_wrapper-libs postgresql-server postgresql-contrib" && \
4646
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
4747
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
4848
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \

15/Dockerfile.fedora

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4444
# This image must forever use UID 26 for postgres user so our volumes are
4545
# safe in the future. This should *never* change, the last test is there
4646
# to make sure of that.
47-
RUN INSTALL_PKGS="rsync tar gettext bind-utils postgresql15-server postgresql15-contrib nss_wrapper postgresql15-upgrade procps-ng util-linux" && \
47+
RUN INSTALL_PKGS="rsync tar gettext postgresql15-server postgresql15-contrib nss_wrapper postgresql15-upgrade procps-ng util-linux" && \
4848
INSTALL_PKGS+=" findutils xz" && \
4949
INSTALL_PKGS+=" postgresql15-pgaudit" && \
5050
dnf -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \

15/Dockerfile.rhel8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4343
# safe in the future. This should *never* change, the last test is there
4444
# to make sure of that.
4545
RUN yum -y module enable postgresql:15 && \
46-
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper-libs postgresql-server postgresql-contrib" && \
46+
INSTALL_PKGS="rsync tar gettext nss_wrapper-libs postgresql-server postgresql-contrib" && \
4747
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
4848
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
4949
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \

0 commit comments

Comments
 (0)