Skip to content

Commit

Permalink
Avoid nil dereference on IP stack DNS.
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Arnold <[email protected]>
  • Loading branch information
mrnold committed Dec 20, 2024
1 parent d3d049c commit 96f2e84
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/controller/provider/container/vsphere/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -685,10 +685,14 @@ func (v *VmAdapter) Apply(u types.ObjectUpdate) {
for _, ipa := range ipas.GuestStackInfo {
routes := ipa.IpRouteConfig.IpRoute
for _, route := range routes {
var dnsList []string
if ipa.DnsConfig != nil {
dnsList = ipa.DnsConfig.IpAddress
}
if len(route.Gateway.IpAddress) > 0 {
guestIpStackList = append(guestIpStackList, model.GuestIpStack{
Gateway: route.Gateway.IpAddress,
DNS: ipa.DnsConfig.IpAddress,
DNS: dnsList,
})
}
}
Expand Down

0 comments on commit 96f2e84

Please sign in to comment.