Skip to content

Commit

Permalink
Merge pull request validatedpatterns#562 from mbaldessari/fix-macosx
Browse files Browse the repository at this point in the history
Fix pki bind mount when using podman machine
  • Loading branch information
mbaldessari authored Aug 6, 2024
2 parents 1f08dfe + 98d4312 commit 414a252
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions scripts/pattern-util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,20 @@ if [ -n "$KUBECONFIG" ]; then
fi
fi

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

# Copy Kubeconfig from current environment. The utilities will pick up ~/.kube/config if set so it's not mandatory
Expand All @@ -67,13 +74,7 @@ podman run -it --rm --pull=newer \
-e EXTRA_HELM_OPTS \
-e EXTRA_PLAYBOOK_OPTS \
-e KUBECONFIG \
-e K8S_AUTH_HOST \
-e K8S_AUTH_VERIFY_SSL \
-e K8S_AUTH_SSL_CA_CERT \
-e K8S_AUTH_USERNAME \
-e K8S_AUTH_PASSWORD \
-e K8S_AUTH_TOKEN \
-v "${PKI_HOST_MOUNT}":/etc/pki:ro \
${PKI_HOST_MOUNT_ARGS} \
-v "${HOME}":"${HOME}" \
-v "${HOME}":/pattern-home \
${PODMAN_ARGS} \
Expand Down

0 comments on commit 414a252

Please sign in to comment.