Skip to content

Commit 4ab8b3a

Browse files
authored
Merge pull request #1949 from shiftstack/issue1948
🐛 v1alpha5: Fix panic in conversion when port has no binding profile
2 parents 654d714 + 559cbf2 commit 4ab8b3a

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

api/v1alpha5/conversion.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,13 +335,16 @@ func Convert_v1beta1_PortOpts_To_v1alpha5_PortOpts(in *infrav1.PortOpts, out *Po
335335
}
336336
}
337337

338-
out.Profile = make(map[string]string)
339-
if pointer.BoolDeref(in.Profile.OVSHWOffload, false) {
340-
(out.Profile)["capabilities"] = "[\"switchdev\"]"
341-
}
342-
if pointer.BoolDeref(in.Profile.TrustedVF, false) {
343-
(out.Profile)["trusted"] = trueString
338+
if in.Profile != nil {
339+
out.Profile = make(map[string]string)
340+
if pointer.BoolDeref(in.Profile.OVSHWOffload, false) {
341+
(out.Profile)["capabilities"] = "[\"switchdev\"]"
342+
}
343+
if pointer.BoolDeref(in.Profile.TrustedVF, false) {
344+
(out.Profile)["trusted"] = trueString
345+
}
344346
}
347+
345348
return nil
346349
}
347350

0 commit comments

Comments
 (0)