Skip to content

Commit 08b5b23

Browse files
Add s3proxy-python project files
- Add Python s3proxy implementation - Add Docker and Kubernetes manifests - Add tests and benchmarks - Add GitHub Actions workflows (commented out) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 1b47780 commit 08b5b23

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+11870
-0
lines changed

.dockerignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
.venv/
8+
venv/
9+
ENV/
10+
.eggs/
11+
*.egg-info/
12+
*.egg
13+
14+
# Testing
15+
.pytest_cache/
16+
.coverage
17+
htmlcov/
18+
.tox/
19+
.nox/
20+
21+
# IDE
22+
.idea/
23+
.vscode/
24+
*.swp
25+
*.swo
26+
27+
# Tools
28+
.ruff_cache/
29+
.mypy_cache/
30+
.claude/
31+
32+
# Git
33+
.git/
34+
.gitignore
35+
36+
# Docker
37+
Dockerfile
38+
docker-compose*.yml
39+
.dockerignore
40+
41+
# Tests (not needed in runtime image)
42+
tests/
43+
44+
# Docs
45+
*.md
46+
LICENSE
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# name: Build and Push Docker Image
2+
#
3+
# on:
4+
# push:
5+
# tags: ['v*']
6+
# pull_request:
7+
# branches: [main]
8+
#
9+
# env:
10+
# REGISTRY: ghcr.io
11+
# IMAGE_NAME: ${{ github.repository }}
12+
#
13+
# jobs:
14+
# build-and-push:
15+
# runs-on: ubuntu-latest
16+
# permissions:
17+
# contents: read
18+
# packages: write
19+
#
20+
# steps:
21+
# - name: Checkout repository
22+
# uses: actions/checkout@v6.0.2
23+
#
24+
# - name: Set up Docker Buildx
25+
# uses: docker/setup-buildx-action@v3.12.0
26+
#
27+
# - name: Log in to Container Registry
28+
# if: github.event_name != 'pull_request'
29+
# uses: docker/login-action@v3.6.0
30+
# with:
31+
# registry: ${{ env.REGISTRY }}
32+
# username: ${{ github.actor }}
33+
# password: ${{ secrets.GITHUB_TOKEN }}
34+
#
35+
# - name: Extract metadata (tags, labels)
36+
# id: meta
37+
# uses: docker/metadata-action@v5.10.0
38+
# with:
39+
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+
# tags: |
41+
# type=ref,event=branch
42+
# type=ref,event=pr
43+
# type=semver,pattern={{version}}
44+
# type=semver,pattern={{major}}.{{minor}}
45+
# type=sha,prefix=
46+
#
47+
# - name: Build and push Docker image
48+
# uses: docker/build-push-action@v6.18.0
49+
# with:
50+
# context: .
51+
# push: ${{ github.event_name != 'pull_request' }}
52+
# tags: ${{ steps.meta.outputs.tags }}
53+
# labels: ${{ steps.meta.outputs.labels }}
54+
# cache-from: type=gha
55+
# cache-to: type=gha,mode=max
56+
# platforms: linux/amd64,linux/arm64

.github/workflows/helm-lint.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# name: Helm Lint
2+
#
3+
# on:
4+
# pull_request:
5+
# branches: [main]
6+
# paths:
7+
# - 'manifests/**'
8+
#
9+
# jobs:
10+
# helm-lint:
11+
# runs-on: ubuntu-latest
12+
# steps:
13+
# - name: Checkout
14+
# uses: actions/checkout@v6.0.2
15+
#
16+
# - name: Set up Helm
17+
# uses: azure/setup-helm@v4.3.1
18+
#
19+
# - name: Add Helm dependency repositories
20+
# run: |
21+
# helm repo add dandydev https://dandydeveloper.github.io/charts
22+
# helm repo update
23+
#
24+
# - name: Update Helm dependencies
25+
# run: |
26+
# helm dependency update manifests/
27+
#
28+
# - name: Lint Helm chart
29+
# run: |
30+
# helm lint manifests/
31+
#
32+
# - name: Validate Helm template
33+
# run: |
34+
# helm template s3proxy manifests/ --debug > /dev/null

.github/workflows/helm-publish.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# name: Package and Push Helm Chart
2+
#
3+
# on:
4+
# push:
5+
# tags: ['v*']
6+
# workflow_dispatch:
7+
#
8+
# env:
9+
# REGISTRY: ghcr.io
10+
# CHART_NAME: s3proxy-python
11+
#
12+
# jobs:
13+
# helm-publish:
14+
# runs-on: ubuntu-latest
15+
# permissions:
16+
# contents: read
17+
# packages: write
18+
#
19+
# steps:
20+
# - name: Checkout repository
21+
# uses: actions/checkout@v6.0.2
22+
#
23+
# - name: Set up Helm
24+
# uses: azure/setup-helm@v4.3.1
25+
#
26+
# - name: Log in to Container Registry
27+
# run: |
28+
# echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin
29+
#
30+
# - name: Add Helm dependency repositories
31+
# run: |
32+
# helm repo add dandydev https://dandydeveloper.github.io/charts
33+
# helm repo update
34+
#
35+
# - name: Update Helm dependencies
36+
# run: |
37+
# helm dependency update manifests/
38+
#
39+
# - name: Get chart version
40+
# id: chart
41+
# run: |
42+
# VERSION=$(grep '^version:' manifests/Chart.yaml | awk '{print $2}')
43+
# echo "version=$VERSION" >> $GITHUB_OUTPUT
44+
# # Use tag version if this is a tag push
45+
# if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
46+
# TAG_VERSION="${{ github.ref_name }}"
47+
# TAG_VERSION="${TAG_VERSION#v}"
48+
# echo "version=$TAG_VERSION" >> $GITHUB_OUTPUT
49+
# fi
50+
#
51+
# - name: Update chart version for tags
52+
# if: startsWith(github.ref, 'refs/tags/v')
53+
# run: |
54+
# TAG_VERSION="${{ github.ref_name }}"
55+
# TAG_VERSION="${TAG_VERSION#v}"
56+
# sed -i "s/^version:.*/version: $TAG_VERSION/" manifests/Chart.yaml
57+
# sed -i "s/^appVersion:.*/appVersion: \"$TAG_VERSION\"/" manifests/Chart.yaml
58+
#
59+
# - name: Lint Helm chart
60+
# run: |
61+
# helm lint manifests/
62+
#
63+
# - name: Package Helm chart
64+
# run: |
65+
# helm package manifests/ --destination .
66+
#
67+
# - name: Push Helm chart to OCI registry
68+
# run: |
69+
# helm push ${{ env.CHART_NAME }}-${{ steps.chart.outputs.version }}.tgz oci://${{ env.REGISTRY }}/${{ github.repository_owner }}/charts

.github/workflows/helm-test.yml

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# name: Helm Test
2+
#
3+
# on:
4+
# push:
5+
# branches: [main]
6+
# paths:
7+
# - 'manifests/**'
8+
# - 's3proxy/**'
9+
# - 'Dockerfile'
10+
# - '.github/workflows/helm-test.yml'
11+
# pull_request:
12+
# branches: [main]
13+
# paths:
14+
# - 'manifests/**'
15+
# - 's3proxy/**'
16+
# - 'Dockerfile'
17+
# - '.github/workflows/helm-test.yml'
18+
# workflow_dispatch:
19+
#
20+
# jobs:
21+
# helm-test:
22+
# runs-on: ubuntu-latest
23+
# steps:
24+
# - name: Checkout
25+
# uses: actions/checkout@v6.0.2
26+
#
27+
# - name: Create Kind cluster
28+
# uses: helm/kind-action@v1.13.0
29+
# with:
30+
# cluster_name: s3proxy-test
31+
#
32+
# - name: Install Helm
33+
# uses: azure/setup-helm@v4.3.1
34+
#
35+
# - name: Add Helm repos and update dependencies
36+
# run: |
37+
# helm repo add dandydev https://dandydeveloper.github.io/charts
38+
# helm repo update
39+
# helm dependency update ./manifests
40+
#
41+
# - name: Build and load image
42+
# run: |
43+
# docker build -t s3proxy-python:latest .
44+
# kind load docker-image s3proxy-python:latest --name s3proxy-test
45+
#
46+
# - name: Install Helm chart
47+
# run: |
48+
# helm upgrade --install s3proxy ./manifests \
49+
# -n s3proxy --create-namespace \
50+
# --set image.repository=s3proxy-python \
51+
# --set image.tag=latest \
52+
# --wait --timeout 300s
53+
#
54+
# - name: Wait for pods
55+
# run: |
56+
# kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=s3proxy-python -n s3proxy --timeout=120s
57+
# kubectl wait --for=condition=ready pod -l release=s3proxy -n s3proxy --timeout=180s || true
58+
# kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=s3proxy-python-minio -n s3proxy --timeout=120s
59+
#
60+
# - name: Show deployment status
61+
# run: |
62+
# kubectl get all -n s3proxy
63+
# kubectl get pods -n s3proxy -o wide
64+
#
65+
# - name: Test health endpoint
66+
# run: |
67+
# kubectl run curl-test --image=curlimages/curl --rm -it --restart=Never -n s3proxy -- \
68+
# curl -sf http://s3proxy-python:4433/healthz
69+
# echo "Health check passed!"
70+
#
71+
# - name: Run load test
72+
# run: |
73+
# kubectl run s3-load-test -n s3proxy --rm -it --restart=Never \
74+
# --image=amazon/aws-cli:latest \
75+
# --env="AWS_ACCESS_KEY_ID=minioadmin" \
76+
# --env="AWS_SECRET_ACCESS_KEY=minioadmin" \
77+
# --env="AWS_DEFAULT_REGION=us-east-1" \
78+
# --command -- /bin/sh -c "
79+
# # Create test bucket
80+
# echo 'Creating test bucket...'
81+
# aws --endpoint-url http://s3proxy-python:4433 s3 mb s3://ci-test-bucket 2>/dev/null || true
82+
#
83+
# # Generate test files (smaller for CI)
84+
# echo 'Generating 64MB test files...'
85+
# mkdir -p /tmp/testfiles
86+
# for i in 1 2 3; do
87+
# dd if=/dev/urandom of=/tmp/testfiles/file-\$i.bin bs=1M count=64 2>/dev/null &
88+
# done
89+
# wait
90+
# echo 'Files generated'
91+
# ls -lh /tmp/testfiles/
92+
#
93+
# # Upload concurrently
94+
# echo ''
95+
# echo '=== Starting concurrent uploads ==='
96+
# START=\$(date +%s)
97+
#
98+
# for i in 1 2 3; do
99+
# aws --endpoint-url http://s3proxy-python:4433 s3 cp /tmp/testfiles/file-\$i.bin s3://ci-test-bucket/file-\$i.bin &
100+
# done
101+
# wait
102+
#
103+
# END=\$(date +%s)
104+
# DURATION=\$((END - START))
105+
# echo ''
106+
# echo \"=== Upload complete in \${DURATION}s ===\"
107+
#
108+
# # Verify uploads
109+
# echo ''
110+
# echo '=== Listing uploaded files ==='
111+
# aws --endpoint-url http://s3proxy-python:4433 s3 ls s3://ci-test-bucket/
112+
#
113+
# # Download and verify
114+
# echo ''
115+
# echo '=== Downloading files to verify ==='
116+
# mkdir -p /tmp/downloads
117+
# for i in 1 2 3; do
118+
# aws --endpoint-url http://s3proxy-python:4433 s3 cp s3://ci-test-bucket/file-\$i.bin /tmp/downloads/file-\$i.bin &
119+
# done
120+
# wait
121+
#
122+
# echo ''
123+
# echo '=== Comparing checksums ==='
124+
# md5sum /tmp/testfiles/*.bin > /tmp/orig.md5
125+
# md5sum /tmp/downloads/*.bin > /tmp/down.md5
126+
#
127+
# ORIG_SUMS=\$(cat /tmp/orig.md5 | while read sum name; do echo \$sum; done | sort)
128+
# DOWN_SUMS=\$(cat /tmp/down.md5 | while read sum name; do echo \$sum; done | sort)
129+
#
130+
# cat /tmp/orig.md5
131+
# echo ''
132+
# if [ \"\$ORIG_SUMS\" = \"\$DOWN_SUMS\" ]; then
133+
# echo 'All checksums match - encryption/decryption working!'
134+
# else
135+
# echo 'Checksum mismatch!'
136+
# exit 1
137+
# fi
138+
# "
139+
#
140+
# - name: Show pod logs on failure
141+
# if: failure()
142+
# run: |
143+
# echo "=== S3Proxy Logs ==="
144+
# kubectl logs -l app.kubernetes.io/name=s3proxy-python -n s3proxy --tail=100 || true
145+
# echo ""
146+
# echo "=== Redis HA Logs ==="
147+
# kubectl logs -l release=s3proxy -n s3proxy --tail=50 || true
148+
# echo ""
149+
# echo "=== Events ==="
150+
# kubectl get events -n s3proxy --sort-by=.lastTimestamp | tail -20 || true
151+
#
152+
# - name: Cleanup
153+
# if: always()
154+
# run: |
155+
# kind delete cluster --name s3proxy-test

0 commit comments

Comments
 (0)