Skip to content

Commit 73f4848

Browse files
author
Clive Dias
committed
Fix build
1 parent bcadb32 commit 73f4848

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
FROM library/rabbitmq:4.0.7-management-alpine
22

33
COPY docker-entrypoint.sh /usr/local/bin/
4-
COPY /openshift/scripts/get_user /bin/
5-
COPY /openshift/scripts/get_password /bin/
6-
COPY /openshift/scripts/change_password /bin/
4+
COPY scripts/get_user /bin/
5+
COPY scripts/get_password /bin/
6+
COPY scripts/change_password /bin/
77

88
ENV USER_UID=1000
99

scripts/change_password

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
set -e
3+
rabbitmqctl change_password "$1" "$2"
4+
set +e
5+
ENCODED_USER=$(printf %s "$1" | base64)
6+
ENCODED_PASSWORD=$(printf %s "$2" | base64)
7+
if [ "${RABBITMQ_ENABLE_IPV6}" == "True" ];
8+
then
9+
KUBERNETES_SERVICE_HOST_MODIFIED="[$KUBERNETES_SERVICE_HOST]"
10+
else
11+
KUBERNETES_SERVICE_HOST_MODIFIED=$KUBERNETES_SERVICE_HOST
12+
fi
13+
curl -k -X PATCH -d @- -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" -H 'Accept: application/json' -H 'Content-Type: application/json-patch+json' https://"$KUBERNETES_SERVICE_HOST_MODIFIED":"$KUBERNETES_SERVICE_PORT_HTTPS"/api/v1/namespaces/"$MY_POD_NAMESPACE"/secrets/rabbitmq-default-secret <<EOF
14+
[
15+
{ "op": "replace", "path": "/data/user", "value": "$ENCODED_USER" },
16+
{ "op": "replace", "path": "/data/password", "value": "$ENCODED_PASSWORD" }
17+
]
18+
EOF

scripts/get_password

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
set -e
3+
if [ "${RABBITMQ_ENABLE_IPV6}" == "True" ];
4+
then
5+
KUBERNETES_SERVICE_HOST_MODIFIED="[$KUBERNETES_SERVICE_HOST]"
6+
else
7+
KUBERNETES_SERVICE_HOST_MODIFIED=$KUBERNETES_SERVICE_HOST
8+
fi
9+
echo "$(curl --silent --show-error -k -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" -H 'Accept: application/json' https://"$KUBERNETES_SERVICE_HOST_MODIFIED":"$KUBERNETES_SERVICE_PORT_HTTPS"/api/v1/namespaces/"$MY_POD_NAMESPACE"/secrets/rabbitmq-default-secret | grep '"password":')" | sed 's/\"password\": \"//g' | sed -r 's/.{2}$//' | sed 's/ //g' | base64 --decode

scripts/get_user

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
set -e
3+
if [ "${RABBITMQ_ENABLE_IPV6}" == "True" ];
4+
then
5+
KUBERNETES_SERVICE_HOST_MODIFIED="[$KUBERNETES_SERVICE_HOST]"
6+
else
7+
KUBERNETES_SERVICE_HOST_MODIFIED=$KUBERNETES_SERVICE_HOST
8+
fi
9+
echo "$(curl --silent --show-error -k -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" -H 'Accept: application/json' https://"$KUBERNETES_SERVICE_HOST_MODIFIED":"$KUBERNETES_SERVICE_PORT_HTTPS"/api/v1/namespaces/"$MY_POD_NAMESPACE"/secrets/rabbitmq-default-secret | grep '"user":')" | sed 's/\"user\": \"//g' | sed -r 's/.{1}$//' | sed 's/ //g' | base64 --decode

0 commit comments

Comments
 (0)