如何解决Istio Gateway解析问题的Helm图表:无法评估类型... {}中的字段...
当我尝试使用带有Istio网关和虚拟服务的头盔图表进行安装时,遇到了解析问题。谁能帮忙找出这是怎么回事?非常感谢!
错误:
$ helm install my-release ./pipeline-nodejs-app/ --dry-run
Error: template: pipeline-nodejs-app/templates/gateway.yaml:16:17: executing "pipeline-nodejs-app/templates/gateway.yaml" at <.number>: can't evaluate field number in type interface {}
templates / gateway.yaml
{{- if .Values.gateway.enabled -}}
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: {{ .Values.gateway.name }}
{{- with .Values.gateway.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
istio: ingressgateway
servers:
{{- range .Values.gateway.port }}
- port:
number: {{ .number }}
name: {{ .portname }}
protocol: {{ .protocol }}
{{- end }}
hosts:
{{- range .Values.gateway.hosts }}
- {{ .host | quote }}
{{- end }}
{{- end }}
values.yaml
...
gateway:
enabled: true
annotations: {}
name: pipeline-nodejs-app-gateway
hosts:
host: '*'
port:
number: 80
name: http
protocol: HTTP
...
我对gateway.yaml的预期输出是:
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: pipeline-javascript-app-gateway
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
解决方法
我认为,您的问题在这里
{{- range .Values.gateway.port }}
- port:
number: {{ .number }}
name: {{ .portname }}
protocol: {{ .protocol }}
{{- end }}
要使用范围,您必须具有以-开头的端口号之类的列表。
port:
- number: 80
name: http
protocol: HTTP
只需将values.yaml更改为
...
gateway:
enabled: true
annotations: {}
name: pipeline-nodejs-app-gateway
hosts:
host: '*'
port:
- number: 80
name: http
protocol: HTTP
...
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。