Skip to content

Commit

Permalink
chore: check init container first
Browse files Browse the repository at this point in the history
  • Loading branch information
xzchaoo committed Mar 18, 2024
1 parent 4f9aeb9 commit 1298244
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/cri/impl/default_cri.go
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,11 @@ func (e *defaultCri) buildPod(pod *v1.Pod, oldState *internalState, newState *in
} else {

for _, container := range detailContainers {
// Ignore init containers
if k8sutils.IsInitContainer(pod, container.Labels) {
continue
}

if !container.State.IsRunning() || container.ID != sandboxContainer.ID && container.SandboxId != sandboxContainer.ID {
logger.Metaz("[local] ignore expired container",
zap.String("ns", pod.Namespace),
Expand All @@ -883,11 +888,6 @@ func (e *defaultCri) buildPod(pod *v1.Pod, oldState *internalState, newState *in
continue
}

// Ignore init containers
if k8sutils.IsInitContainer(pod, container.Labels) {
continue
}

cached := oldState.containerMap[container.ID]

if cached != nil && !isContainerChanged(cached.engineContainer, container) {
Expand Down

0 comments on commit 1298244

Please sign in to comment.