Skip to content

Commit d72c617

Browse files
Merge pull request #61 from austincunningham/working-podman
get wwa working with podman
2 parents f8c351f + 5db2228 commit d72c617

File tree

3 files changed

+152
-9
lines changed

3 files changed

+152
-9
lines changed

Makefile

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
BUILD_TARGET?=workload-app
22
NAMESPACE?=workload-web-app
3-
CONTAINER_ENGINE?=docker
3+
4+
# Auto-detect container engine if not specified
5+
CONTAINER_ENGINE?=$(shell command -v podman >/dev/null 2>&1 && echo podman || echo docker)
6+
47
CONTAINER_PLATFORM?=linux/amd64
58
TOOLS_IMAGE?=quay.io/integreatly/workload-web-app-tools
69
WORKLOAD_WEB_APP_IMAGE?= # Alternative image
710
KUBECONFIG?=${HOME}/.kube/config
8-
ADDITIONAL_CONTAINER_ENGINE_PARAMS?=
11+
12+
# Podman-specific parameters for better compatibility
13+
ifeq ($(CONTAINER_ENGINE),podman)
14+
ADDITIONAL_CONTAINER_ENGINE_PARAMS?=--userns=keep-id
15+
else
16+
ADDITIONAL_CONTAINER_ENGINE_PARAMS?=
17+
endif
918

1019
in_container = ${CONTAINER_ENGINE} run --rm -it ${ADDITIONAL_CONTAINER_ENGINE_PARAMS} \
1120
-e KUBECONFIG=/kube.config \
@@ -23,8 +32,20 @@ in_container = ${CONTAINER_ENGINE} run --rm -it ${ADDITIONAL_CONTAINER_ENGINE_PA
2332
test:
2433
@echo "SUCCESS"
2534

35+
.PHONY: container-engine
36+
container-engine:
37+
@echo "Container Engine: $(CONTAINER_ENGINE)"
38+
@echo "Platform: $(CONTAINER_PLATFORM)"
39+
@echo "Additional Parameters: $(ADDITIONAL_CONTAINER_ENGINE_PARAMS)"
40+
@$(CONTAINER_ENGINE) --version
41+
42+
.PHONY: validate-engine
43+
validate-engine:
44+
@command -v $(CONTAINER_ENGINE) >/dev/null 2>&1 || { echo "$(CONTAINER_ENGINE) not found. Please install $(CONTAINER_ENGINE) or use CONTAINER_ENGINE=<engine> to specify another."; exit 1; }
45+
@echo "$(CONTAINER_ENGINE) is available"
46+
2647
.PHONY: image/build/tools
27-
image/build/tools:
48+
image/build/tools: validate-engine
2849
${CONTAINER_ENGINE} build --platform=$(CONTAINER_PLATFORM) -t ${TOOLS_IMAGE} -f Dockerfile.tools .
2950

3051
local/deploy: image/build/tools
@@ -33,7 +54,7 @@ local/deploy: image/build/tools
3354
local/undeploy: image/build/tools
3455
$(call in_container,undeploy)
3556

36-
local/build-deploy:
57+
local/build-deploy: validate-engine
3758
${CONTAINER_ENGINE} build --platform=$(CONTAINER_PLATFORM) -t ${WORKLOAD_WEB_APP_IMAGE} .
3859
${CONTAINER_ENGINE} push ${WORKLOAD_WEB_APP_IMAGE}
3960
$(call in_container,deploy)

README.md

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
# workload-web-app
22
A test app for simulating the workload on the openshift cluster based on end-user use cases in order to monitor the downtime of component products in integreatly during an upgrade.
33

4+
## Container Engine Support
5+
6+
This application supports both **Docker** and **Podman**. The Makefile automatically detects which container engine is available:
7+
8+
- If Podman is available, it uses Podman
9+
- If only Docker is available, it uses Docker
10+
- You can override the detection by setting `CONTAINER_ENGINE=docker` or `CONTAINER_ENGINE=podman`
11+
12+
### Check your container engine
13+
14+
You can check which container engines are available and get setup guidance:
15+
16+
```bash
17+
# Quick environment check with helpful tips
18+
./check-container-engine.sh
19+
20+
# Or use the Makefile target for basic info
21+
make container-engine
22+
```
23+
424
## Deploying the Application on the RHOAM cluster
525

626
To deploy the app to a RHOAM cluster, you will need to:
@@ -15,7 +35,21 @@ To deploy the app to a RHOAM cluster, you will need to:
1535
export RHOAMI=true
1636
```
1737
4. Then run this command to deploy the app:
18-
```make local/deploy```
38+
```bash
39+
make local/deploy
40+
```
41+
42+
### Using a specific container engine
43+
44+
If you want to use a specific container engine, set the `CONTAINER_ENGINE` variable:
45+
46+
```bash
47+
# Using Docker
48+
CONTAINER_ENGINE=docker make local/deploy
49+
50+
# Using Podman
51+
CONTAINER_ENGINE=podman make local/deploy
52+
```
1953

2054
## Delete the app
2155

@@ -28,9 +62,34 @@ Note: It might take up to 15 minutes for 3scale to fully remove the service (Pro
2862

2963
## Troubleshooting
3064

31-
In case of `make: stat: Makefile: Permission denied` error try to use privileged:
65+
### Container Engine Issues
3266

33-
```
34-
ADDITIONAL_CONTAINER_ENGINE_PARAMS="--privileged" CONTAINER_ENGINE=podman make local/deploy
35-
```
67+
1. **Check if your container engine is working:**
68+
```bash
69+
make validate-engine
70+
```
71+
72+
2. **Permission denied errors with Podman:**
73+
```bash
74+
ADDITIONAL_CONTAINER_ENGINE_PARAMS="--privileged" make local/deploy
75+
```
76+
77+
3. **SELinux issues with volume mounts:**
78+
The Makefile automatically adds `:z` labels for SELinux compatibility. If you still have issues:
79+
```bash
80+
ADDITIONAL_CONTAINER_ENGINE_PARAMS="--privileged --security-opt label=disable" make local/deploy
81+
```
82+
83+
4. **Force a specific container engine:**
84+
```bash
85+
# Force Docker even if Podman is available
86+
CONTAINER_ENGINE=docker make local/deploy
87+
88+
# Force Podman even if Docker is available
89+
CONTAINER_ENGINE=podman make local/deploy
90+
```
91+
92+
### 3scale Service Issues
93+
94+
Note: It might take up to 15 minutes for 3scale to fully remove the service (Product) hence you need to wait this long after undeploy if you want to deploy the workload-web-app again. In case the service is not fully removed yet the deployment fails with `System name has already been taken` error.
3695

check-container-engine.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
3+
# Container Engine Detection and Validation Script
4+
# This script helps users understand which container engine will be used
5+
6+
set -e
7+
8+
echo "🔍 Container Engine Detection Report"
9+
echo "=================================="
10+
11+
# Check for Podman
12+
if command -v podman >/dev/null 2>&1; then
13+
echo "✅ Podman found: $(podman --version)"
14+
PODMAN_AVAILABLE=true
15+
else
16+
echo "❌ Podman not found"
17+
PODMAN_AVAILABLE=false
18+
fi
19+
20+
# Check for Docker
21+
if command -v docker >/dev/null 2>&1; then
22+
echo "✅ Docker found: $(docker --version)"
23+
DOCKER_AVAILABLE=true
24+
else
25+
echo "❌ Docker not found"
26+
DOCKER_AVAILABLE=false
27+
fi
28+
29+
echo ""
30+
31+
# Determine which engine would be used
32+
if [ "$DOCKER_AVAILABLE" = true ] && [ "$PODMAN_AVAILABLE" = true ]; then
33+
echo "🎯 Both container engines are available!"
34+
echo " The Makefile will automatically use: Podman (preferred)"
35+
echo " To use Docker instead: CONTAINER_ENGINE=docker make <target>"
36+
elif [ "$PODMAN_AVAILABLE" = true ]; then
37+
echo "🎯 Only Podman is available - it will be used automatically"
38+
elif [ "$DOCKER_AVAILABLE" = true ]; then
39+
echo "🎯 Only Docker is available - it will be used automatically"
40+
else
41+
echo "❌ No container engine found!"
42+
echo " Please install either Docker or Podman to continue"
43+
exit 1
44+
fi
45+
46+
echo ""
47+
echo "📋 Quick Commands:"
48+
echo " Check current detection: make container-engine"
49+
echo " Validate your engine: make validate-engine"
50+
echo " Deploy with auto-detect: make local/deploy"
51+
echo " Deploy with Docker: CONTAINER_ENGINE=docker make local/deploy"
52+
echo " Deploy with Podman: CONTAINER_ENGINE=podman make local/deploy"
53+
54+
if [ "$PODMAN_AVAILABLE" = true ]; then
55+
echo ""
56+
echo "💡 Podman Tips:"
57+
echo " - If you encounter permission issues, try:"
58+
echo " ADDITIONAL_CONTAINER_ENGINE_PARAMS=\"--privileged\" make local/deploy"
59+
echo " - For SELinux systems, volume mounts include :z labels automatically"
60+
fi
61+
62+
echo ""
63+
echo "✅ Environment check complete!"

0 commit comments

Comments
 (0)