Commit 1981a89
committed
Fix: Ensure prompt initial DHCP cache sync on agent startup
This commit addresses a potential delay in the agent's DHCP lease cache
synchronization upon startup or leader election. Previously, the cache might
only populate after an explicit update to the watched IPPool CR.
Changes:
- Added an `AddFunc` to the IPPool informer in the agent's event handler
(`pkg/agent/ippool/event.go`). This ensures that IPPools listed during
the informer's initial LIST operation are queued for processing.
- Modified the agent's local IPPool controller (`pkg/agent/ippool/controller.go`)
to handle these "ADD" events identically to "UPDATE" events. This involves
calling the `Update` method to populate the DHCPAllocator's cache and then
signaling on the `initialSyncDone` channel.
These changes ensure that the agent primes its lease cache as soon as the
IPPool information is available from the informer, allowing the DHCP server
to start with accurate lease data more promptly.1 parent f3f6668 commit 1981a89
2 files changed
+32
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
| 92 | + | |
92 | 93 | | |
93 | | - | |
| 94 | + | |
94 | 95 | | |
95 | | - | |
| 96 | + | |
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| 100 | + | |
99 | 101 | | |
100 | | - | |
| 102 | + | |
101 | 103 | | |
102 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
103 | 111 | | |
104 | 112 | | |
105 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
108 | 121 | | |
109 | 122 | | |
110 | 123 | | |
| 124 | + | |
111 | 125 | | |
112 | 126 | | |
113 | 127 | | |
114 | | - | |
115 | | - | |
| 128 | + | |
| 129 | + | |
116 | 130 | | |
| 131 | + | |
117 | 132 | | |
118 | 133 | | |
| 134 | + | |
| 135 | + | |
119 | 136 | | |
120 | 137 | | |
121 | 138 | | |
| |||
0 commit comments