Skip to content

Commit

Permalink
refactor: add hostname field (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
xzchaoo authored Oct 23, 2023
1 parent a73190a commit 75fb2bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/cri/impl/default_cri.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,8 @@ func (e *defaultCri) firePodChange() {
func (e *defaultCri) buildPod(pod *v1.Pod, oldState *internalState, newState *internalState, newStateLock *sync.Mutex, containersByPod map[string][]*cri.EngineDetailContainer) (*cri.Pod, int, bool, error) {

criPod := &cri.Pod{
Pod: pod,
Pod: pod,
Hostname: k8smetaextractor.DefaultPodMetaService.ExtractHostname(pod),
}

// Get all containers belonging to this pod, including exited containers
Expand Down
3 changes: 2 additions & 1 deletion pkg/cri/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ type (
Biz []*Container `json:"biz"`
Sidecar []*Container `json:"sidecar"`
// Sandbox container
Sandbox *Container `json:"sandbox"`
Sandbox *Container `json:"sandbox"`
Hostname string `json:"hostname"`
}
Container struct {
// container 可能会依赖底层实现, 因此这里不让它依赖具体的实现类
Expand Down

0 comments on commit 75fb2bc

Please sign in to comment.