GoogleContainerTools / skaffold

Easy and Repeatable Kubernetes Development
https://skaffold.dev/
Apache License 2.0
14.94k stars 1.62k forks source link

skaffold.yaml with only `portForward` errors out with "nothing to deploy" #9496

Open johannespfrang opened 1 month ago

johannespfrang commented 1 month ago

We have a utility skaffold file called skaffold.forward.yaml which developers can use to forward some usually non-exposed ports. The file works with skaffold v1, but does not work with skaffold v2.

Expected behavior

$ skaffold1 run -f ./skaffold.forward.yaml --port-forward=user
Listing files to watch...
WARN[0000] k8s/*.yaml did not match any file             subtask=-1 task=DevLoop
Generating tags...
Checking cache...
Tags used in deployment:
Starting deploy...
WARN[0000] k8s/*.yaml did not match any file             subtask=-1 task=DevLoop
Waiting for deployments to stabilize...
Deployments stabilized in 11.509247ms
Port forwarding Service/ingress-nginx-controller in namespace ingress-nginx, remote port 443 -> http://127.0.0.1:443
Port forwarding Service/ingress-nginx-controller in namespace ingress-nginx, remote port 80 -> http://127.0.0.1:80

Actual behavior

$ skaffold2 run -f ./skaffold.forward.yaml --port-forward=user
No tags generated
Starting test...
WARN[0000] k8s/*.yaml did not match any file             subtask=-1 task=DevLoop
Starting deploy...
nothing to deploy

Information

apiVersion: skaffold/v2beta28
kind: Config
portForward:
  - resourceType: Service
    resourceName: ingress-nginx-controller
    namespace: ingress-nginx
    port: 80
    address: 127.0.0.1
    localPort: 80
  - resourceType: Service
    resourceName: ingress-nginx-controller
    namespace: ingress-nginx
    port: 443
    address: 127.0.0.1
    localPort: 443

(simplified example, we have many other forwards)

Steps to reproduce the behavior

  1. Install ingress-nginx
  2. Run the above yaml with skaffold v1 vs skaffold v2