-
Notifications
You must be signed in to change notification settings - Fork 244
fix: setdir in CNI client #2027
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
Conversation
so invoking from inside the CNS Pod works on Windows Signed-off-by: Evan Baker <[email protected]>
@@ -30,7 +24,7 @@ func New(exec utilexec.Interface) *client { | |||
|
|||
func (c *client) GetEndpointState() (*api.AzureCNIState, error) { | |||
cmd := c.exec.Command(platform.CNIBinaryPath) | |||
|
|||
cmd.SetDir(CNIExecDir) |
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.
add a comment to say this work in windows only if state exists in c:\k
@@ -30,7 +24,7 @@ func New(exec utilexec.Interface) *client { | |||
|
|||
func (c *client) GetEndpointState() (*api.AzureCNIState, error) { | |||
cmd := c.exec.Command(platform.CNIBinaryPath) | |||
|
|||
cmd.SetDir(CNIExecDir) |
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.
if CNIExecDir is empty, SetDir will skip setting directory?
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.
so invoking from inside the CNS Pod works on Windows Signed-off-by: Evan Baker <[email protected]>
Reason for Change:
Sets the working directory when CNS invokes the CNI (only on Windows) so that the CNS reconcile from CNI finds the real CNI statefile and reinitializes the CNS state correctly.
Issue Fixed:
Due to the lack of CNIRuntimePath set when CNI is running on Windows: when CNS invokes CNI to restore state during initialization on Windows, it looks for the statefile in the local directory (
.\azure-vnet.json
) instead of the absolute path atC:\k\azure-vnet.json
. No statefile exists in the current directory, so the CNI returns empty PodInfo to CNS, leading CNS to think there are no Pods scheduled and that all of its IPs are available.Running a CNS built with this change, we can see that it finds the CNI statefile and correctly restores from it:
restoring CNS to the previous version and restarting shows that the statefile is not used:
Requirements:
Notes: