Skip to content

Commit 5b2f715

Browse files
committed
BUG/MINOR: Fix nil pointer dereference in Ingress PathType
1 parent 852778c commit 5b2f715

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

controller/store/convert.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ func (n ingressNetworkingV1Beta1Strategy) ConvertIngress() *Ingress {
9999
continue
100100
}
101101
for _, k8sPath := range k8sRule.HTTP.Paths {
102-
prefix := ""
102+
var pathType string
103103
if k8sPath.PathType != nil {
104-
prefix = string(*k8sPath.PathType)
104+
pathType = string(*k8sPath.PathType)
105105
}
106-
paths[prefix+"-"+k8sPath.Path] = &IngressPath{
106+
paths[pathType+"-"+k8sPath.Path] = &IngressPath{
107107
Path: k8sPath.Path,
108-
PathTypeMatch: string(*k8sPath.PathType),
108+
PathTypeMatch: pathType,
109109
SvcNamespace: n.ig.GetNamespace(),
110110
SvcName: k8sPath.Backend.ServiceName,
111111
SvcPortInt: int64(k8sPath.Backend.ServicePort.IntValue()),
@@ -197,13 +197,13 @@ func (e ingressExtensionsStrategy) ConvertIngress() *Ingress {
197197
continue
198198
}
199199
for _, k8sPath := range k8sRule.HTTP.Paths {
200-
prefix := ""
200+
var pathType string
201201
if k8sPath.PathType != nil {
202-
prefix = string(*k8sPath.PathType)
202+
pathType = string(*k8sPath.PathType)
203203
}
204-
paths[prefix+"-"+k8sPath.Path] = &IngressPath{
204+
paths[pathType+"-"+k8sPath.Path] = &IngressPath{
205205
Path: k8sPath.Path,
206-
PathTypeMatch: string(*k8sPath.PathType),
206+
PathTypeMatch: pathType,
207207
SvcNamespace: e.ig.GetNamespace(),
208208
SvcName: k8sPath.Backend.ServiceName,
209209
SvcPortInt: int64(k8sPath.Backend.ServicePort.IntValue()),
@@ -283,13 +283,13 @@ func (n ingressNetworkingV1Strategy) ConvertIngress() *Ingress {
283283
continue
284284
}
285285
for _, k8sPath := range k8sRule.HTTP.Paths {
286-
prefix := ""
286+
var pathType string
287287
if k8sPath.PathType != nil {
288-
prefix = string(*k8sPath.PathType)
288+
pathType = string(*k8sPath.PathType)
289289
}
290-
paths[prefix+"-"+k8sPath.Path] = &IngressPath{
290+
paths[pathType+"-"+k8sPath.Path] = &IngressPath{
291291
Path: k8sPath.Path,
292-
PathTypeMatch: string(*k8sPath.PathType),
292+
PathTypeMatch: pathType,
293293
SvcNamespace: n.ig.GetNamespace(),
294294
SvcName: k8sPath.Backend.Service.Name,
295295
SvcPortInt: int64(k8sPath.Backend.Service.Port.Number),

0 commit comments

Comments
 (0)