-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect Network Instance IP subnet conflict #3823
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -244,22 +244,22 @@ func (z *zedrouter) init() (err error) { | |
|
||
z.peUsagePersist, err = persistcache.New(types.PersistCachePatchEnvelopesUsage) | ||
if err != nil { | ||
log.Fatal(err) | ||
return err | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a separate fix (which would make sense in a separate commit)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it is a minor unrelated fix, I will move it to a separate commit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
} | ||
|
||
// restore cached patchEnvelopeUsage counters | ||
for _, key := range z.peUsagePersist.Objects() { | ||
cached, err := z.peUsagePersist.Get(key) | ||
if err != nil { | ||
log.Fatal(err) | ||
return err | ||
} | ||
buf := bytes.NewBuffer(cached) | ||
dec := gob.NewDecoder(buf) | ||
|
||
var peUsage types.PatchEnvelopeUsage | ||
|
||
if err := dec.Decode(&peUsage); err != nil { | ||
log.Fatal(err) | ||
return err | ||
} | ||
|
||
z.patchEnvelopesUsage.Store(key, peUsage) | ||
|
@@ -963,7 +963,7 @@ func (z *zedrouter) processNIReconcileStatus(recStatus nireconciler.NIReconcileS | |
changed = true | ||
} | ||
} else { | ||
if niStatus.HasError() { | ||
if niStatus.HasError() && !niStatus.IPConflict { | ||
niStatus.ClearError() | ||
changed = true | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assumes we never call this function on a switch network instance or on some future NI type where the IP addresses can be assigned after the NI has been created.
Why do we need to report it as a conflict?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function
doNetworkInstanceSubnetSanityCheck
is called only ifconfig.IpType
is notAddressTypeNone
, so it will not be called for switch network instance.Note that IP conflict detection was now moved to a separate function:
checkNetworkInstanceIPConflicts
.