mirror of https://github.com/linkerd/linkerd2.git
Fix `splitStringListToPorts` port range object rendering (#4688)
The splitStringListToPorts helm function is currently incorrectly formating a list of ports as an array of Port objects that look ike {"port" : 555}. The config map protobuf representation however expects that the ignoreOutboundPorts and ignoreInboundPorts fields are are list of PortRange objects ({"portRange" : 555}). This was causing the injector to return an empty string when trying to parse a PortRange object resulting in the ports not getting set correctly when injecting workloads. Note that this is happening only with helm installations as this is when we are actually using a helm template for outputting the config map. To fix that the splitStringListToPorts helm function is changed to format the objects as the json representation of PortRange and is renamed to splitStringListToPortRanges Fix: #4679 Signed-off-by: Zahari Dichev zaharidichev@gmail.com
This commit is contained in:
parent
73010149ce
commit
a2363f4051
|
@ -30,10 +30,10 @@
|
|||
"port": {{.Values.global.proxy.ports.control}}
|
||||
},
|
||||
"ignoreInboundPorts":[
|
||||
{{- include "partials.splitStringListToPorts" .Values.global.proxyInit.ignoreInboundPorts -}}
|
||||
{{- include "partials.splitStringListToPortRanges" .Values.global.proxyInit.ignoreInboundPorts -}}
|
||||
],
|
||||
"ignoreOutboundPorts":[
|
||||
{{- include "partials.splitStringListToPorts" .Values.global.proxyInit.ignoreOutboundPorts -}}
|
||||
{{- include "partials.splitStringListToPortRanges" .Values.global.proxyInit.ignoreOutboundPorts -}}
|
||||
],
|
||||
"inboundPort":{
|
||||
"port": {{.Values.global.proxy.ports.inbound}}
|
||||
|
|
|
@ -46,16 +46,16 @@ For example "11,22,55,44" will become "11","22","55","44"
|
|||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Splits a coma separated list into a list of port objects.
|
||||
For example "11,22,55" will become{"port":11},{"port":22},
|
||||
{"port":55}
|
||||
Splits a coma separated list into a list of PortRange objects.
|
||||
For example "11,22,55" will become{"portRange":11},{"portRange":22},
|
||||
{"portRange":55}
|
||||
*/}}
|
||||
{{- define "partials.splitStringListToPorts" -}}
|
||||
{{- define "partials.splitStringListToPortRanges" -}}
|
||||
{{- if gt (len .) 0 -}}
|
||||
{{- $ports := splitList "," . -}}
|
||||
{{- $last := sub (len $ports) 1 -}}
|
||||
{{- range $i,$port := $ports -}}
|
||||
{"port":{{$port}}}{{ternary "," "" (ne $i $last)}}
|
||||
{"portRange":"{{$port}}"}{{ternary "," "" (ne $i $last)}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
|
|
@ -902,8 +902,8 @@ data:
|
|||
"controlPort":{
|
||||
"port": 4190
|
||||
},
|
||||
"ignoreInboundPorts":[{"port":222}],
|
||||
"ignoreOutboundPorts":[{"port":111}],
|
||||
"ignoreInboundPorts":[{"portRange":"222"}],
|
||||
"ignoreOutboundPorts":[{"portRange":"111"}],
|
||||
"inboundPort":{
|
||||
"port": 4143
|
||||
},
|
||||
|
|
|
@ -902,8 +902,8 @@ data:
|
|||
"controlPort":{
|
||||
"port": 4190
|
||||
},
|
||||
"ignoreInboundPorts":[{"port":222}],
|
||||
"ignoreOutboundPorts":[{"port":111}],
|
||||
"ignoreInboundPorts":[{"portRange":"222"}],
|
||||
"ignoreOutboundPorts":[{"portRange":"111"}],
|
||||
"inboundPort":{
|
||||
"port": 4143
|
||||
},
|
||||
|
|
|
@ -902,8 +902,8 @@ data:
|
|||
"controlPort":{
|
||||
"port": 4190
|
||||
},
|
||||
"ignoreInboundPorts":[{"port":222}],
|
||||
"ignoreOutboundPorts":[{"port":111}],
|
||||
"ignoreInboundPorts":[{"portRange":"222"}],
|
||||
"ignoreOutboundPorts":[{"portRange":"111"}],
|
||||
"inboundPort":{
|
||||
"port": 4143
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue