Skip to content

Commit 189bee2

Browse files
committed
fix: Move the port forwards to higher ports to avoid conflicts with existing services
1 parent 38d7275 commit 189bee2

File tree

11 files changed

+69
-49
lines changed

11 files changed

+69
-49
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ RUN usermod -aG docker vscode
151151
# Ensure vscode user owns Go directories and has proper permissions
152152
RUN mkdir -p /go && chown -R vscode:vscode /go
153153

154-
# Fix Docker socket permissions for non-root access
154+
# Fix Docker socket permissions for non-root access (will be applied at runtime)
155+
# Note: This is set in devcontainer.json postCreateCommand as well
155156
RUN chmod 666 /var/run/docker.sock || true
156157

157158
# Switch back to vscode user for development

.devcontainer/devcontainer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
"--group-add=docker"
2222
],
2323
"forwardPorts": [
24-
3000,
25-
9090
24+
13000,
25+
19090
2626
],
2727
"portsAttributes": {
28-
"3000": {
28+
"13000": {
2929
"label": "Gitea",
3030
"onAutoForward": "notify"
3131
},
32-
"9090": {
32+
"19090": {
3333
"label": "Prometheus",
3434
"onAutoForward": "notify"
3535
}
@@ -61,7 +61,7 @@
6161
]
6262
}
6363
},
64-
"postCreateCommand": "docker network create -d=bridge --subnet=172.19.0.0/24 kind || true",
64+
"postCreateCommand": "sudo chmod 666 /var/run/docker.sock || true && docker network create -d=bridge --subnet=172.19.0.0/24 kind || true",
6565
"remoteUser": "vscode",
6666
"mounts": [
6767
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ setup-port-forwards: ## Start all port-forwards in background
228228
.PHONY: cleanup-port-forwards
229229
cleanup-port-forwards: ## Stop all port-forwards
230230
@echo "🛑 Stopping port-forwards..."
231-
@-pkill -f "kubectl.*port-forward.*3000" 2>/dev/null || true
232-
@-pkill -f "kubectl.*port-forward.*9090" 2>/dev/null || true
231+
@-pkill -f "kubectl.*port-forward.*13000" 2>/dev/null || true
232+
@-pkill -f "kubectl.*port-forward.*19090" 2>/dev/null || true
233233
@echo "✅ Port-forwards stopped"
234234

235235
.PHONY: cleanup-gitea-e2e

config/samples/configbutler.ai_v1alpha1_gitrepoconfig.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
app.kubernetes.io/managed-by: kustomize
77
name: gitrepoconfig-sample
88
spec:
9-
repoUrl: "http://gitea-http.gitea-e2e.svc.cluster.local:3000/testorg/testrepo.git"
9+
repoUrl: "http://gitea-http.gitea-e2e.svc.cluster.local:13000/testorg/testrepo.git"
1010
allowedBranches:
1111
- "main"
1212
secretRef:

test/e2e/E2E_DEBUGGING.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ make setup-port-forwards
1414
```
1515

1616
This exposes:
17-
- **Prometheus**: http://localhost:9090
18-
- **Gitea**: http://localhost:3000 (Username: `testorg`, Password: `gitea`)
17+
- **Prometheus**: http://localhost:19090
18+
- **Gitea**: http://localhost:13000 (Username: `testorg`, Password: `gitea`)
1919

2020
**Stop port-forwards:**
2121
```bash
@@ -60,7 +60,7 @@ go_goroutines{job="gitops-reverser-metrics"}
6060
## Network Architecture
6161

6262
```
63-
Host Machine (port 3000, 9090)
63+
Host Machine (port 13000, 19090)
6464
↕ (exposed via --network=host)
6565
DevContainer
6666
↕ (kubectl port-forward)
@@ -82,12 +82,12 @@ Kind Cluster
8282

8383
2. **Check Prometheus for metrics history:**
8484
```bash
85-
# Visit http://localhost:9090
85+
# Visit http://localhost:19090
8686
```
8787

8888
3. **Check Gitea for repository state:**
8989
```bash
90-
# Visit http://localhost:3000
90+
# Visit http://localhost:13000
9191
# Username: testorg, Password: gitea
9292
```
9393

@@ -97,7 +97,7 @@ Kind Cluster
9797
```
9898

9999
5. **Check Prometheus scrape status:**
100-
Visit http://localhost:9090/targets
100+
Visit http://localhost:19090/targets
101101

102102
## Cleanup
103103

@@ -113,7 +113,7 @@ make cleanup-gitea-e2e
113113
## Available Make Targets
114114

115115
```bash
116-
make setup-port-forwards # Start port-forwards (Gitea:3000, Prometheus:9090)
116+
make setup-port-forwards # Start port-forwards (Gitea:13000, Prometheus:19090)
117117
make cleanup-port-forwards # Stop all port-forwards
118118
make e2e-setup # Setup Gitea + Prometheus + port-forwards
119119
make test-e2e # Run e2e tests (includes port-forwards)

test/e2e/e2e_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
)
3434

3535
// giteaRepoURLTemplate is the URL template for test Gitea repositories.
36-
const giteaRepoURLTemplate = "http://gitea-http.gitea-e2e.svc.cluster.local:3000/testorg/%s.git"
36+
const giteaRepoURLTemplate = "http://gitea-http.gitea-e2e.svc.cluster.local:13000/testorg/%s.git"
3737
const giteaSSHURLTemplate = "ssh://git@gitea-ssh.gitea-e2e.svc.cluster.local:2222/testorg/%s.git"
3838

3939
var testRepoName string
@@ -119,8 +119,8 @@ var _ = Describe("Manager", Ordered, func() {
119119
fmt.Printf("═══════════════════════════════════════════════════════════\n")
120120
fmt.Printf("📊 E2E Infrastructure kept running for debugging purposes:\n")
121121
fmt.Printf("═══════════════════════════════════════════════════════════\n")
122-
fmt.Printf(" Prometheus: http://localhost:9090\n")
123-
fmt.Printf(" Gitea: http://localhost:3000\n")
122+
fmt.Printf(" Prometheus: http://localhost:19090\n")
123+
fmt.Printf(" Gitea: http://localhost:13000\n")
124124
fmt.Printf("\n")
125125
fmt.Printf("═══════════════════════════════════════════════════════════\n")
126126
fmt.Printf("\n")

test/e2e/gitea-values.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ gitea:
2525
# Server configuration
2626
server:
2727
PROTOCOL: http
28-
HTTP_PORT: 3000
28+
HTTP_PORT: 13000
2929
DOMAIN: gitea-http.gitea-e2e.svc.cluster.local
30-
ROOT_URL: "http://gitea-http.gitea-e2e.svc.cluster.local:3000/"
30+
ROOT_URL: "http://gitea-http.gitea-e2e.svc.cluster.local:13000/"
3131
SSH_DOMAIN: gitea-ssh.gitea-e2e.svc.cluster.local
3232
SSH_PORT: 22
3333
START_SSH_SERVER: true
@@ -65,7 +65,7 @@ gitea:
6565
service:
6666
http:
6767
type: ClusterIP
68-
port: 3000
68+
port: 13000
6969
ssh:
7070
type: ClusterIP
7171
port: 22

test/e2e/helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func waitForMetric(query string, condition func(float64) bool, timeout time.Dura
109109

110110
// getPrometheusURL returns the URL for accessing Prometheus UI
111111
func getPrometheusURL() string {
112-
return "http://localhost:9090"
112+
return "http://localhost:19090"
113113
}
114114

115115
// renderTemplate loads and executes a Go template file with the given data

test/e2e/prometheus/deployment.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ spec:
8787
livenessProbe:
8888
httpGet:
8989
path: /-/healthy
90-
port: 9090
90+
port: http
9191
initialDelaySeconds: 10
9292
readinessProbe:
9393
httpGet:
9494
path: /-/ready
95-
port: 9090
95+
port: http
9696
initialDelaySeconds: 5
9797
volumeMounts:
9898
- name: config
@@ -126,5 +126,5 @@ spec:
126126
app: prometheus
127127
ports:
128128
- name: http
129-
port: 9090
130-
targetPort: 9090
129+
port: 19090
130+
targetPort: http

test/e2e/scripts/setup-gitea.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ SECRET_NAME="git-creds"
1414
SSH_SECRET_NAME="git-creds-ssh"
1515
SSH_KEY_PATH="/tmp/e2e-ssh-key"
1616
SSH_PUB_KEY_PATH="/tmp/e2e-ssh-key.pub"
17-
API_URL="http://localhost:3000/api/v1"
17+
API_URL="http://localhost:13000/api/v1"
1818

1919
if [ -z "$REPO_NAME" ]; then
2020
echo "❌ Error: Repository name must be provided as first argument"
@@ -281,12 +281,12 @@ checkout_repository() {
281281
# Create parent directory
282282
mkdir -p "$(dirname "$CHECKOUT_DIR")"
283283

284-
# Configure git for localhost:3000 authentication using credentials
284+
# Configure git for localhost:13000 authentication using credentials
285285
# This creates a global git config that maps the localhost URL to use our credentials
286-
REPO_URL_WITH_AUTH="http://$ADMIN_USER:$TOKEN@localhost:3000/$ORG_NAME/$REPO_NAME.git"
287-
REPO_URL_LOCALHOST="http://localhost:3000/$ORG_NAME/$REPO_NAME.git"
286+
REPO_URL_WITH_AUTH="http://$ADMIN_USER:$TOKEN@localhost:13000/$ORG_NAME/$REPO_NAME.git"
287+
REPO_URL_LOCALHOST="http://localhost:13000/$ORG_NAME/$REPO_NAME.git"
288288

289-
echo "🔐 Configuring git authentication for localhost:3000..."
289+
echo "🔐 Configuring git authentication for localhost:13000..."
290290
# Set up URL rewriting so git will use our credentials automatically
291291
git config --global "url.$REPO_URL_WITH_AUTH.insteadOf" "$REPO_URL_LOCALHOST"
292292

@@ -299,7 +299,7 @@ checkout_repository() {
299299
git config user.name "E2E Test"
300300
git config user.email "e2e-test@gitops-reverser.local"
301301

302-
# Set up the remote URL to use localhost:3000 (authentication is handled by global config)
302+
# Set up the remote URL to use localhost:13000 (authentication is handled by global config)
303303
git remote set-url origin "$REPO_URL_LOCALHOST"
304304

305305
echo "🔧 Git configuration completed in checkout directory"
@@ -327,7 +327,7 @@ setup_credentials
327327
checkout_repository
328328

329329
# Repository information
330-
REPO_URL="http://gitea-http.$GITEA_NAMESPACE.svc.cluster.local:3000/$ORG_NAME/$REPO_NAME.git"
330+
REPO_URL="http://gitea-http.$GITEA_NAMESPACE.svc.cluster.local:13000/$ORG_NAME/$REPO_NAME.git"
331331

332332
echo "
333333
🎉 Gitea setup completed successfully!
@@ -346,13 +346,13 @@ echo "
346346
• Access Token: ${TOKEN:0:8}...
347347
348348
🌐 Access Gitea:
349-
• Visit http://localhost:3000 in your browser
349+
• Visit http://localhost:13000 in your browser
350350
• Login: $ADMIN_USER / $ADMIN_PASS
351-
• Stop port-forward: pkill -f 'kubectl.*port-forward.*3000'
351+
• Stop port-forward: pkill -f 'kubectl.*port-forward.*13000'
352352
353353
📂 Git Repository:
354354
• Local checkout: $CHECKOUT_DIR
355-
• Git operations configured for localhost:3000
355+
• Git operations configured for localhost:13000
356356
• Ready for git pull/fetch operations during tests
357357
358358
✨ Ready for e2e testing! Port-forward will stay active.

0 commit comments

Comments
 (0)