Skip to content

Commit ecc4cb1

Browse files
authored
Merge pull request #1293 from k8s-infra-cherrypick-robot/cherry-pick-1284-to-release-0.6
[release-0.6] 🐛 Fix logger arguments
2 parents d25581a + 1be036b commit ecc4cb1

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

pkg/cloud/services/compute/instance_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func (is *InstanceStatus) NetworkStatus() (*InstanceNetworkStatus, error) {
157157

158158
// Only consider IPv4
159159
if address.Version != 4 {
160-
is.logger.V(6).Info("Ignoring IPv%d address %s: only IPv4 is supported", address.Version, address.Address)
160+
is.logger.V(6).Info("Ignoring IP address: only IPv4 is supported", "version", address.Version, "address", address.Address)
161161
continue
162162
}
163163

@@ -168,7 +168,7 @@ func (is *InstanceStatus) NetworkStatus() (*InstanceNetworkStatus, error) {
168168
case "fixed":
169169
addressType = corev1.NodeInternalIP
170170
default:
171-
is.logger.V(6).Info("Ignoring address %s with unknown type '%s'", address.Address, address.Type)
171+
is.logger.V(6).Info("Ignoring address with unknown type", "address", address.Address, "type", address.Type)
172172
continue
173173
}
174174

pkg/cloud/services/compute/instance_types_test.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,37 @@ func TestInstanceNetworkStatus(t *testing.T) {
276276
wantIP: "192.168.0.1",
277277
wantFloatingIP: "10.0.0.1",
278278
},
279+
{
280+
name: "Ignore unknown address type",
281+
addresses: map[string][]networkAddress{
282+
"primary": {
283+
{
284+
Version: 4,
285+
Addr: "192.168.0.2",
286+
Type: "not-valid",
287+
MacAddr: macAddr1,
288+
}, {
289+
Version: 4,
290+
Addr: "192.168.0.3",
291+
Type: "unknown",
292+
MacAddr: macAddr2,
293+
}, {
294+
Version: 4,
295+
Addr: "10.0.0.1",
296+
Type: "floating",
297+
MacAddr: macAddr3,
298+
}, {
299+
Version: 4,
300+
Addr: "192.168.0.1",
301+
Type: "fixed",
302+
MacAddr: macAddr4,
303+
},
304+
},
305+
},
306+
networkName: "primary",
307+
wantIP: "192.168.0.1",
308+
wantFloatingIP: "10.0.0.1",
309+
},
279310
{
280311
name: "Multiple networks",
281312
addresses: map[string][]networkAddress{

0 commit comments

Comments
 (0)