Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Caching IP allocated by CNI plugin #525

Merged
merged 1 commit into from
Jan 5, 2018
Merged

Conversation

abhi
Copy link
Member

@abhi abhi commented Jan 5, 2018

A Possible fix to address scenario mentioned in #524
Cache the IP allocated for pods not connected to host network and avoid fetch it on every Sandbox status request.

Signed-off-by: abhi abhi@docker.com

@@ -34,6 +34,8 @@ type Sandbox struct {
Container containerd.Container
// CNI network namespace client
NetNS *NetNS
// Pod IP if it is attached to non host network
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// IP is the ...
Comment should start with the variable name.

@@ -57,7 +56,7 @@ func (c *criContainerdService) PodSandboxStatus(ctx context.Context, r *runtime.
processStatus = taskStatus.Status
}

ip, err := c.getIP(sandbox)
ip := c.getIP(sandbox)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err checked not needed.

@Random-Liu Random-Liu added this to the v1.0.0-beta.1 milestone Jan 5, 2018
if err != nil {
return nil, fmt.Errorf("failed to get network status for sandbox %q: %v", id, err)
}
sandbox.IP = ip
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add comment to explain that some VM based solution is relying on this behavior, and link the issue. And we should try to eliminate the assumption on cri shim implementation detail in the future.

Signed-off-by: abhi <abhi@docker.com>
@Random-Liu
Copy link
Member

/lgtm

@Random-Liu
Copy link
Member

Merging @nlacasse.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants