GoogleContainerTools / GoogleContainerTools/skaffold

Cloud Run Port Forwarding Fails with Templating

Open
#9,554 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

### Bug Report

#### Description

The `skaffold.yaml` configuration below is intended to set up port forwarding for a specific Cloud Run service using dynamic `USER`-based naming. The configuration appears to resolve the service name correctly, but the port forwarding still fails with a "service not found" error.

#### Configuration

```yaml
apiVersion: skaffold/v4beta11
kind: Config

manifests:
helm:
releases:
- name: test
chartPath: "./skaffold/test"
setValueTemplates:
"service.name": "{{ .USER }}-test"

build:
local:
push: true

artifacts:
- image: us-central1-docker.pkg.dev/.../test
context: context
docker:
dockerfile: Dockerfile

deploy:
cloudrun:
projectid: ID
region: REGION

portForward:
- resourceType: service
resourceName: "{{ .USER }}-test"
localPort: 9001
```
#### Environment

- **Skaffold Version:** v2.13.1
- **Installation Method:** Installed via Cloud Code
- **Operating System:** macOS 15.0.1

#### Error Logs

```plaintext
Forwarding service projects/project-id/locations/us-central1/services/user-test to local port 8080
Forwarding service projects/project-id/locations/us-central1/services/user-processing to local port 8081
could not map pods to service default/user-test/0: getting service default/user-test: services "user-test" not found

```

#### Expected Behavior
The portForward directive should map the dynamically generated {{ .USER }}-test service name to the specified local port without errors.

#### Actual Behavior
Despite correctly resolving the {{ .USER }} placeholder in the logs, the port forwarding fails with a "service not found" error.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.