Skip to content

Commit

Permalink
Merge pull request containerd#10921 from aojea/nri_network
Browse files Browse the repository at this point in the history
expose Pod assigned IPs to NRI plugins
  • Loading branch information
mxpv authored Nov 7, 2024
2 parents 5bfa36a + bc056a5 commit 1d6fdda
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/cri/nri/nri_api_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,14 @@ func (p *criPodSandbox) GetPid() uint32 {
return p.pid
}

func (p *criPodSandbox) GetIPs() []string {
if p.IP == "" {
return nil
}
ips := append([]string{p.IP}, p.AdditionalIPs...)
return ips
}

//
// NRI integration wrapper for CRI Containers
//
Expand Down
2 changes: 2 additions & 0 deletions internal/nri/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type PodSandbox interface {
GetLinuxPodSandbox() LinuxPodSandbox

GetPid() uint32
GetIPs() []string
}

type LinuxPodSandbox interface {
Expand All @@ -55,6 +56,7 @@ func commonPodSandboxToNRI(pod PodSandbox) *nri.PodSandbox {
Annotations: pod.GetAnnotations(),
RuntimeHandler: pod.GetRuntimeHandler(),
Pid: pod.GetPid(),
Ips: pod.GetIPs(),
}
}

Expand Down

0 comments on commit 1d6fdda

Please sign in to comment.