Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
k8s-ingress
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
uplex-varnish
k8s-ingress
Commits
4f8b60b4
Commit
4f8b60b4
authored
Jul 07, 2020
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix a potential nil dereference.
parent
d0f2f5c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
haproxy.go
pkg/haproxy/haproxy.go
+12
-11
No files found.
pkg/haproxy/haproxy.go
View file @
4f8b60b4
...
...
@@ -709,6 +709,16 @@ func (hc *Controller) getOffldStatus(inst *haproxyInst) error {
return
nil
}
func
mkSvc
(
addrs
[]
OffldAddr
)
*
offldrSvc
{
svc
:=
&
offldrSvc
{
instances
:
make
([]
*
haproxyInst
,
len
(
addrs
))}
for
i
,
addr
:=
range
addrs
{
instance
:=
offldAddr2haproxyInst
(
addr
,
nil
)
svc
.
instances
[
i
]
=
instance
// instsGauge.Inc()
}
return
svc
}
// AddOrUpdateOffloader sets the configuration for the offloader
// designated by key, using the given addresses for remote admin, and
// the Secret designated by secrName as the password for Basic Auth in
...
...
@@ -722,16 +732,7 @@ func (hc *Controller) AddOrUpdateOffloader(
var
passwdPtr
*
string
svc
,
exists
:=
hc
.
svcs
[
key
]
if
!
exists
{
var
instances
[]
*
haproxyInst
svc
=
&
offldrSvc
{}
for
_
,
addr
:=
range
addrs
{
instance
:=
offldAddr2haproxyInst
(
addr
,
nil
)
hc
.
log
.
Debugf
(
"offloader svc %s: creating instance %+v"
,
key
,
*
instance
)
instances
=
append
(
instances
,
instance
)
// instsGauge.Inc()
}
svc
.
instances
=
instances
svc
=
mkSvc
(
addrs
)
hc
.
svcs
[
key
]
=
svc
// svcsGauge.Inc()
hc
.
log
.
Debugf
(
"offloader svc %s: created config"
,
key
)
...
...
@@ -777,7 +778,7 @@ func (hc *Controller) Update(
)
update
.
Status
{
svc
,
exists
:=
hc
.
svcs
[
svcKey
]
if
!
exists
{
svc
=
&
offldrSvc
{
instances
:
make
([]
*
haproxyInst
,
len
(
addrs
))}
svc
=
mkSvc
(
addrs
)
hc
.
svcs
[
svcKey
]
=
svc
// svcsGauge.Inc()
hc
.
log
.
Infof
(
"Added offloader service definition %s"
,
svcKey
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment