Skip to content

Commit

Permalink
refactor: add hostname field
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangfeng.xzc committed Oct 23, 2023
1 parent a73190a commit 496d630
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 496d630

Please sign in to comment.