Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port forwarding is not working with namespaces with Templated Fields #5802

Closed
itaischw opened this issue May 7, 2021 · 1 comment
Closed

Port forwarding is not working with namespaces with Templated Fields #5802

itaischw opened this issue May 7, 2021 · 1 comment

Comments

@itaischw
Copy link
Contributor

@itaischw itaischw commented May 7, 2021

Hi,
I'm working with Skaffold and helm deploy.
The issue I see is that when you specify under deploy.helm.releases.namespace with a templated field,
and you want to do a user port forwarding, i.e. map port 22 to 5022, you can't use a templated field to set the
portForward.namespace since it's not supporting templated field.
If you don't set the namespace under the portForward.namespace you will get a warning:
"Skipping the port forwarding resource ... because namespace is not specified"

Expected behavior

The expected behaviour here is to either make the port forwarding use the custom namespace under the resource it is forwarding.
OR support templated fields for the portForward.namespace as well.

Actual behaviour

Getting a warning "Skipping the port forwarding resource ... because namespace is not specified"
or if you set it with the templated field you will get an error for not finding the resource in the namespace without the templated field extraction
i.e. my-namespace-{{ .USER }}

Information

  • Skaffold version: v1.19.0
  • Operating system: MacOS
  • Installed via: skaffold.dev | Cloud Code
  • Contents of skaffold.yaml:
apiVersion: skaffold/v2beta8
kind: Config
build: 
  artifacts:
    - image: my-image    
deploy:  
  helm:
    releases:
      - name: my-deployment
        chartPath: helm
        version: v2        
        valuesFiles:
          - helm/values/values.yaml
        artifactOverrides:
          image: my-image
        namespace: "my-namespace-{{ .USER }}"
        createNamespace: true
        upgradeOnChange: true

portForward:
  - resourceType: StatefulSet
    resourceName: tps-monitoring
    namespace: "my-namespace-{{ .USER }}"
    port: 22
    localPort: 5022

Steps to reproduce the behavior

  1. Deploy any helm you want to a namespace with a templated field.
  2. Try to port forward any port and set the namespace under the portForward with the same namespace as your deployment with a templated field.
@aaron-prindle aaron-prindle changed the title Port forwarding is nto working with namespaces with Templated Fields Port forwarding is not working with namespaces with Templated Fields May 7, 2021
@itaischw
Copy link
Contributor Author

@itaischw itaischw commented May 10, 2021

@aaron-prindle I created a PR to support the above, feel free to review too.

MarlonGamez pushed a commit that referenced this issue May 12, 2021
…#5808)

* Add support for Port forwarding with namespaces with Templated Fields #5802 
Co-authored-by: itais <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants