Skip to content

Commit

Permalink
Podman fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmadigan committed Mar 25, 2024
1 parent f507107 commit ee1f233
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 7 deletions.
18 changes: 17 additions & 1 deletion hack/.binEnv
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,26 @@
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BIN_DIR="${SCRIPT_DIR}/../bin/"

containerRuntime() {
local container_runtime=""

if command -v docker &> /dev/null; then
container_runtime="docker"
elif command -v podman &> /dev/null; then
container_runtime="podman"
else
echo "Neither Docker nor Podman is installed. Exiting..."
exit 1
fi
echo "$container_runtime"
}

export CONTAINER_RUNTIME_BIN=$(containerRuntime)

export KIND_BIN="${BIN_DIR}kind"
export KUSTOMIZE_BIN="${BIN_DIR}kustomize"
export HELM_BIN="${BIN_DIR}helm"
export YQ_BIN="${BIN_DIR}yq"
export OPERATOR_SDK_BIN="${BIN_DIR}operator-sdk"
export CLUSTERADM_BIN="${BIN_DIR}clusteradm"
export KFILT="docker run --rm -i ryane/kfilt"
export KFILT="$CONTAINER_RUNTIME_BIN run --rm -i ryane/kfilt"
2 changes: 1 addition & 1 deletion hack/.cleanupUtils
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cleanClusters() {
cleanNetwork() {
# Delete the network
echo "Deleting mgc network"
docker network rm mgc || true
$CONTAINER_RUNTIME_BIN network rm mgc || true
}

cleanupKind() {
Expand Down
3 changes: 2 additions & 1 deletion hack/.kindUtils
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ kindSetupMGCClusters() {
local dataPlaneClusterCount=$5

# Create network for the clusters
docker network create -d bridge --subnet 172.31.0.0/16 ${KIND_CLUSTER_DOCKER_NETWORK} --gateway 172.31.0.1 \
# TODO: podman equivs of these options?
$CONTAINER_RUNTIME_BIN network create -d bridge --subnet 172.31.0.0/16 ${KIND_CLUSTER_DOCKER_NETWORK} --gateway 172.31.0.1 \
-o "com.docker.network.bridge.enable_ip_masquerade"="true" \
-o "com.docker.network.driver.mtu"="1500"

Expand Down
27 changes: 24 additions & 3 deletions hack/.quickstartEnv
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
# shellcheck shell=bash

export TOOLS_IMAGE=quay.io/kuadrant/mgc-tools:latest
export TMP_DIR=/tmp/mgc
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
export TMP_DIR=$SCRIPT_DIR/tmp/mgc

trap 'echo "Error on line $LINENO: $BASH_COMMAND"' ERR


containerRuntime() {
local container_runtime=""

if command -v docker &> /dev/null; then
container_runtime="docker"
elif command -v podman &> /dev/null; then
container_runtime="podman"
else
echo "Neither Docker nor Podman is installed. Exiting..."
exit 1
fi
echo "$container_runtime"
}

export CONTAINER_RUNTIME_BIN=$(containerRuntime)

dockerBinCmd() {
local network=""
if [ ! -z ${KIND_CLUSTER_DOCKER_NETWORK} ]; then
if [ ! -z "${KIND_CLUSTER_DOCKER_NETWORK}" ]; then
network=" --network ${KIND_CLUSTER_DOCKER_NETWORK}"
fi
echo "docker run --rm -u $UID -v ${TMP_DIR}:/tmp/mgc:z${network} -e KUBECONFIG=/tmp/mgc/kubeconfig --entrypoint=$1 $TOOLS_IMAGE"

echo "$CONTAINER_RUNTIME_BIN run --rm -u $UID -v ${TMP_DIR}:${TMP_DIR}${network} -e KUBECONFIG=${TMP_DIR}/kubeconfig --entrypoint=$1 $TOOLS_IMAGE"
}

export KIND_BIN=kind
Expand Down
2 changes: 1 addition & 1 deletion hack/quickstart-metrics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# limitations under the License.
#

export KFILT="docker run --rm -i ryane/kfilt"
export KFILT="$CONTAINER_RUNTIME_BIN run --rm -i ryane/kfilt"

METRICS_FEDERATION=true

Expand Down

0 comments on commit ee1f233

Please sign in to comment.