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

in helm: want to catch errors from getHostByName to define actions #302

Open
ns-kvaradhan opened this issue May 25, 2021 · 3 comments
Open

Comments

@ns-kvaradhan
Copy link

I am following up form a request to the helm guys in helm/helm#9737
Here, I am using

rbi-env [ingress✗]➜ helm version
version.BuildInfo{Version:"v3.5.4", GitCommit:"1b5edb69df3d3a08df77c9902dc17af864ff05d1", GitTreeState:"dirty", GoVersion:"go1.16.3"}

I would like to use the following:

  {{- if getHostByName .Values.hostName }}
  annotations:
    kubernetes.io/ingress.global-static-ip-name: {{ .Values.hostName | quote }}
  {{- end }}

Which works when .Values.hostname is resolvable, but throws up an error, when it fails:

foo [ingress✗]➜ helm template bar --set hostName=asd.ldsjf.com
Error: template: bar/templates/ingress.yaml:1:9: executing "bar/templates/ingress.yaml" at <getHostByName .Values.hostName>: error calling getHostByName: invalid argument to Intn

Use --debug flag to render out invalid YAML

I see this comment in the sprig code:

sprig/network.go

Lines 9 to 10 in 3ac42c7

addrs, _ := net.LookupHost(name)
//TODO: add error handing when release v3 comes out

Any chance I can get a fix for me to try this out?

Thanks,

Kannan

@riccardo32
Copy link

We also have a use case that it should not stop/exit when/if Host is not resolvable.
Achieved by returning nil

addrs, err := net.LookupHost(name) if err != nil { return "", nil }

@ns-kvaradhan
Copy link
Author

There is actually a Rhttps://github.com//issues/302 #279 that has the fixes for this issue.

@riccardo32
Copy link

Created PR for this - #319

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants