Skip to content

Commit e3f8e55

Browse files
author
Peng Zhou
committed
fix nil pointer issue
1 parent 20618f3 commit e3f8e55

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pkg/k8sutil/haProxyHelper.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import (
44
"bytes"
55
"context"
66
"fmt"
7-
marklogicv1 "github.com/marklogic/marklogic-operator-kubernetes/api/v1"
8-
"sigs.k8s.io/controller-runtime/pkg/log"
97
"strings"
108
"text/template"
9+
10+
marklogicv1 "github.com/marklogic/marklogic-operator-kubernetes/api/v1"
11+
"sigs.k8s.io/controller-runtime/pkg/log"
1112
)
1213

1314
type HAProxyTemplate struct {
@@ -77,11 +78,10 @@ func generateHAProxyConfig(ctx context.Context, cr *marklogicv1.MarklogicCluster
7778
for _, group := range groups {
7879
if group.HAProxy != nil && !group.HAProxy.Enabled {
7980
continue
80-
} else {
81-
// setting is path-based
82-
if !config.IsPathBased && *group.HAProxy.PathBasedRouting == true {
83-
config.IsPathBased = true
84-
}
81+
}
82+
83+
if !config.IsPathBased && group.HAProxy != nil && group.HAProxy.PathBasedRouting != nil && *group.HAProxy.PathBasedRouting == true {
84+
config.IsPathBased = true
8585
}
8686

8787
groupHAConfig := group.HAProxy

0 commit comments

Comments
 (0)