Skip to content

Commit 414a252

Browse files
authored
Merge pull request #562 from mbaldessari/fix-macosx
Fix pki bind mount when using podman machine
2 parents 1f08dfe + 98d4312 commit 414a252

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

scripts/pattern-util.sh

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,20 @@ if [ -n "$KUBECONFIG" ]; then
4949
fi
5050
fi
5151

52-
# Use /etc/pki by default and try a couple of fallbacks if it does not exist
53-
if [ -d /etc/pki ]; then
54-
PKI_HOST_MOUNT="/etc/pki"
55-
elif [ -d /etc/ssl ]; then
56-
PKI_HOST_MOUNT="/etc/ssl"
52+
# Detect if we use podman machine. If we do not then we bind mount local host ssl folders
53+
# if we are using podman machine then we do not bind mount anything (for now!)
54+
REMOTE_PODMAN=$(podman system connection list -q | wc -l)
55+
if [ $REMOTE_PODMAN -eq 0 ]; then # If we are not using podman machine we check the hosts folders
56+
# Use /etc/pki by default and try a couple of fallbacks if it does not exist
57+
if [ -d /etc/pki ]; then
58+
PKI_HOST_MOUNT_ARGS="-v /etc/pki:/etc/pki:ro"
59+
elif [ -d /etc/ssl ]; then
60+
PKI_HOST_MOUNT_ARGS="-v /etc/ssl:/etc/ssl:ro"
61+
else
62+
PKI_HOST_MOUNT_ARGS="-v /usr/share/ca-certificates:/usr/share/ca-certificates:ro"
63+
fi
5764
else
58-
PKI_HOST_MOUNT="/usr/share/ca-certificates"
65+
PKI_HOST_MOUNT_ARGS=""
5966
fi
6067

6168
# Copy Kubeconfig from current environment. The utilities will pick up ~/.kube/config if set so it's not mandatory
@@ -67,13 +74,7 @@ podman run -it --rm --pull=newer \
6774
-e EXTRA_HELM_OPTS \
6875
-e EXTRA_PLAYBOOK_OPTS \
6976
-e KUBECONFIG \
70-
-e K8S_AUTH_HOST \
71-
-e K8S_AUTH_VERIFY_SSL \
72-
-e K8S_AUTH_SSL_CA_CERT \
73-
-e K8S_AUTH_USERNAME \
74-
-e K8S_AUTH_PASSWORD \
75-
-e K8S_AUTH_TOKEN \
76-
-v "${PKI_HOST_MOUNT}":/etc/pki:ro \
77+
${PKI_HOST_MOUNT_ARGS} \
7778
-v "${HOME}":"${HOME}" \
7879
-v "${HOME}":/pattern-home \
7980
${PODMAN_ARGS} \

0 commit comments

Comments
 (0)