mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Fix kubernetes demo files (#885)
- Update postgres docker image to the latest 11 version. - Remove empty lines inside the `RUN` command to make the Dockerfile compatible with future docker versions. - Set the `PATRONI_KUBERNETES_POD_IP` environment variable, which is required when _use_endpoints_ is enabled. Otherwise, the `KeyError` is raised [here](https://github.com/zalando/patroni/blob/master/patroni/dcs/kubernetes.py#L95). - Set `EDITOR` environment variable to make configuration changes via `patronictl edit-config`.
This commit is contained in:
committed by
Alexander Kukushkin
parent
e684ca66e5
commit
96ea01bee4
@@ -1,4 +1,4 @@
|
|||||||
FROM postgres:10
|
FROM postgres:11
|
||||||
MAINTAINER Alexander Kukushkin <[email protected]>
|
MAINTAINER Alexander Kukushkin <[email protected]>
|
||||||
|
|
||||||
RUN export DEBIAN_FRONTEND=noninteractive \
|
RUN export DEBIAN_FRONTEND=noninteractive \
|
||||||
@@ -7,23 +7,18 @@ RUN export DEBIAN_FRONTEND=noninteractive \
|
|||||||
&& apt-get upgrade -y \
|
&& apt-get upgrade -y \
|
||||||
&& apt-cache depends patroni | sed -n -e 's/.* Depends: \(python3-.\+\)$/\1/p' \
|
&& apt-cache depends patroni | sed -n -e 's/.* Depends: \(python3-.\+\)$/\1/p' \
|
||||||
| grep -Ev '^python3-(sphinx|etcd|consul|kazoo|kubernetes)' \
|
| grep -Ev '^python3-(sphinx|etcd|consul|kazoo|kubernetes)' \
|
||||||
| xargs apt-get install -y curl jq locales git python3-pip python3-wheel \
|
| xargs apt-get install -y vim-tiny curl jq locales git python3-pip python3-wheel \
|
||||||
|
|
||||||
## Make sure we have a en_US.UTF-8 locale available
|
## Make sure we have a en_US.UTF-8 locale available
|
||||||
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
|
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
|
||||||
|
|
||||||
&& pip3 install setuptools \
|
&& pip3 install setuptools \
|
||||||
&& pip3 install 'git+https://github.com/zalando/patroni.git#egg=patroni[kubernetes]' \
|
&& pip3 install 'git+https://github.com/zalando/patroni.git#egg=patroni[kubernetes]' \
|
||||||
|
|
||||||
&& PGHOME=/home/postgres \
|
&& PGHOME=/home/postgres \
|
||||||
&& mkdir -p $PGHOME \
|
&& mkdir -p $PGHOME \
|
||||||
&& chown postgres $PGHOME \
|
&& chown postgres $PGHOME \
|
||||||
&& sed -i "s|/var/lib/postgresql.*|$PGHOME:/bin/bash|" /etc/passwd \
|
&& sed -i "s|/var/lib/postgresql.*|$PGHOME:/bin/bash|" /etc/passwd \
|
||||||
|
|
||||||
# Set permissions for OpenShift
|
# Set permissions for OpenShift
|
||||||
&& chmod 775 $PGHOME \
|
&& chmod 775 $PGHOME \
|
||||||
&& chmod 664 /etc/passwd \
|
&& chmod 664 /etc/passwd \
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
&& apt-get remove -y git python3-pip python3-wheel \
|
&& apt-get remove -y git python3-pip python3-wheel \
|
||||||
&& apt-get autoremove -y \
|
&& apt-get autoremove -y \
|
||||||
@@ -33,7 +28,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \
|
|||||||
ADD entrypoint.sh /
|
ADD entrypoint.sh /
|
||||||
|
|
||||||
EXPOSE 5432 8008
|
EXPOSE 5432 8008
|
||||||
ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
|
ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 EDITOR=/usr/bin/editor
|
||||||
USER postgres
|
USER postgres
|
||||||
WORKDIR /home/postgres
|
WORKDIR /home/postgres
|
||||||
CMD ["/bin/bash", "/entrypoint.sh"]
|
CMD ["/bin/bash", "/entrypoint.sh"]
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ bootstrap:
|
|||||||
- data-checksums
|
- data-checksums
|
||||||
pg_hba:
|
pg_hba:
|
||||||
- host all all 0.0.0.0/0 md5
|
- host all all 0.0.0.0/0 md5
|
||||||
- host replication ${PATRONI_REPLICATION_USERNAME} ${POD_IP}/16 md5
|
- host replication ${PATRONI_REPLICATION_USERNAME} ${PATRONI_KUBERNETES_POD_IP}/16 md5
|
||||||
restapi:
|
restapi:
|
||||||
connect_address: '${POD_IP}:8008'
|
connect_address: '${PATRONI_KUBERNETES_POD_IP}:8008'
|
||||||
postgresql:
|
postgresql:
|
||||||
connect_address: '${POD_IP}:5432'
|
connect_address: '${PATRONI_KUBERNETES_POD_IP}:5432'
|
||||||
authentication:
|
authentication:
|
||||||
superuser:
|
superuser:
|
||||||
password: '${PATRONI_SUPERUSER_PASSWORD}'
|
password: '${PATRONI_SUPERUSER_PASSWORD}'
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ objects:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- env:
|
- env:
|
||||||
- name: POD_IP
|
- name: PATRONI_KUBERNETES_POD_IP
|
||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ objects:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- env:
|
- env:
|
||||||
- name: POD_IP
|
- name: PATRONI_KUBERNETES_POD_IP
|
||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ spec:
|
|||||||
- mountPath: /home/postgres/pgdata
|
- mountPath: /home/postgres/pgdata
|
||||||
name: pgdata
|
name: pgdata
|
||||||
env:
|
env:
|
||||||
- name: POD_IP
|
- name: PATRONI_KUBERNETES_POD_IP
|
||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
fieldPath: status.podIP
|
fieldPath: status.podIP
|
||||||
|
|||||||
Reference in New Issue
Block a user