Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
BUILD_TARGET?=workload-app
NAMESPACE?=workload-web-app
CONTAINER_ENGINE?=docker

# Auto-detect container engine if not specified
CONTAINER_ENGINE?=$(shell command -v podman >/dev/null 2>&1 && echo podman || echo docker)

CONTAINER_PLATFORM?=linux/amd64
TOOLS_IMAGE?=quay.io/integreatly/workload-web-app-tools
WORKLOAD_WEB_APP_IMAGE?= # Alternative image
KUBECONFIG?=${HOME}/.kube/config
ADDITIONAL_CONTAINER_ENGINE_PARAMS?=

# Podman-specific parameters for better compatibility
ifeq ($(CONTAINER_ENGINE),podman)
ADDITIONAL_CONTAINER_ENGINE_PARAMS?=--userns=keep-id
else
ADDITIONAL_CONTAINER_ENGINE_PARAMS?=
endif

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

.PHONY: container-engine
container-engine:
@echo "Container Engine: $(CONTAINER_ENGINE)"
@echo "Platform: $(CONTAINER_PLATFORM)"
@echo "Additional Parameters: $(ADDITIONAL_CONTAINER_ENGINE_PARAMS)"
@$(CONTAINER_ENGINE) --version

.PHONY: validate-engine
validate-engine:
@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; }
@echo "✓ $(CONTAINER_ENGINE) is available"

.PHONY: image/build/tools
image/build/tools:
image/build/tools: validate-engine
${CONTAINER_ENGINE} build --platform=$(CONTAINER_PLATFORM) -t ${TOOLS_IMAGE} -f Dockerfile.tools .

local/deploy: image/build/tools
Expand All @@ -33,7 +54,7 @@ local/deploy: image/build/tools
local/undeploy: image/build/tools
$(call in_container,undeploy)

local/build-deploy:
local/build-deploy: validate-engine
${CONTAINER_ENGINE} build --platform=$(CONTAINER_PLATFORM) -t ${WORKLOAD_WEB_APP_IMAGE} .
${CONTAINER_ENGINE} push ${WORKLOAD_WEB_APP_IMAGE}
$(call in_container,deploy)
Expand Down
69 changes: 64 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
# workload-web-app
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.

## Container Engine Support

This application supports both **Docker** and **Podman**. The Makefile automatically detects which container engine is available:

- If Podman is available, it uses Podman
- If only Docker is available, it uses Docker
- You can override the detection by setting `CONTAINER_ENGINE=docker` or `CONTAINER_ENGINE=podman`

### Check your container engine

You can check which container engines are available and get setup guidance:

```bash
# Quick environment check with helpful tips
./check-container-engine.sh

# Or use the Makefile target for basic info
make container-engine
```

## Deploying the Application on the RHOAM cluster

To deploy the app to a RHOAM cluster, you will need to:
Expand All @@ -15,7 +35,21 @@ To deploy the app to a RHOAM cluster, you will need to:
export RHOAMI=true
```
4. Then run this command to deploy the app:
```make local/deploy```
```bash
make local/deploy
```

### Using a specific container engine

If you want to use a specific container engine, set the `CONTAINER_ENGINE` variable:

```bash
# Using Docker
CONTAINER_ENGINE=docker make local/deploy

# Using Podman
CONTAINER_ENGINE=podman make local/deploy
```

## Delete the app

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

## Troubleshooting

In case of `make: stat: Makefile: Permission denied` error try to use privileged:
### Container Engine Issues

```
ADDITIONAL_CONTAINER_ENGINE_PARAMS="--privileged" CONTAINER_ENGINE=podman make local/deploy
```
1. **Check if your container engine is working:**
```bash
make validate-engine
```

2. **Permission denied errors with Podman:**
```bash
ADDITIONAL_CONTAINER_ENGINE_PARAMS="--privileged" make local/deploy
```

3. **SELinux issues with volume mounts:**
The Makefile automatically adds `:z` labels for SELinux compatibility. If you still have issues:
```bash
ADDITIONAL_CONTAINER_ENGINE_PARAMS="--privileged --security-opt label=disable" make local/deploy
```

4. **Force a specific container engine:**
```bash
# Force Docker even if Podman is available
CONTAINER_ENGINE=docker make local/deploy

# Force Podman even if Docker is available
CONTAINER_ENGINE=podman make local/deploy
```

### 3scale Service Issues

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.

63 changes: 63 additions & 0 deletions check-container-engine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash

# Container Engine Detection and Validation Script
# This script helps users understand which container engine will be used

set -e

echo "🔍 Container Engine Detection Report"
echo "=================================="

# Check for Podman
if command -v podman >/dev/null 2>&1; then
echo "✅ Podman found: $(podman --version)"
PODMAN_AVAILABLE=true
else
echo "❌ Podman not found"
PODMAN_AVAILABLE=false
fi

# Check for Docker
if command -v docker >/dev/null 2>&1; then
echo "✅ Docker found: $(docker --version)"
DOCKER_AVAILABLE=true
else
echo "❌ Docker not found"
DOCKER_AVAILABLE=false
fi

echo ""

# Determine which engine would be used
if [ "$DOCKER_AVAILABLE" = true ] && [ "$PODMAN_AVAILABLE" = true ]; then
echo "🎯 Both container engines are available!"
echo " The Makefile will automatically use: Podman (preferred)"
echo " To use Docker instead: CONTAINER_ENGINE=docker make <target>"
elif [ "$PODMAN_AVAILABLE" = true ]; then
echo "🎯 Only Podman is available - it will be used automatically"
elif [ "$DOCKER_AVAILABLE" = true ]; then
echo "🎯 Only Docker is available - it will be used automatically"
else
echo "❌ No container engine found!"
echo " Please install either Docker or Podman to continue"
exit 1
fi

echo ""
echo "📋 Quick Commands:"
echo " Check current detection: make container-engine"
echo " Validate your engine: make validate-engine"
echo " Deploy with auto-detect: make local/deploy"
echo " Deploy with Docker: CONTAINER_ENGINE=docker make local/deploy"
echo " Deploy with Podman: CONTAINER_ENGINE=podman make local/deploy"

if [ "$PODMAN_AVAILABLE" = true ]; then
echo ""
echo "💡 Podman Tips:"
echo " - If you encounter permission issues, try:"
echo " ADDITIONAL_CONTAINER_ENGINE_PARAMS=\"--privileged\" make local/deploy"
echo " - For SELinux systems, volume mounts include :z labels automatically"
fi

echo ""
echo "✅ Environment check complete!"