MCPcopy Index your code
hub / github.com/devspace-sh/devspace / matchesImageSelector

Function matchesImageSelector

pkg/devspace/services/podreplace/find.go:131–157  ·  view source on GitHub ↗
(ctx devspacecontext.Context, pod *corev1.PodTemplateSpec, devPod *latest.DevPod)

Source from the content-addressed store, hash-verified

129}
130
131func matchesImageSelector(ctx devspacecontext.Context, pod *corev1.PodTemplateSpec, devPod *latest.DevPod) ([]string, error) {
132 var matchingContainers []string
133 if devPod.ImageSelector != "" {
134 imageSelector, err := runtimevar.NewRuntimeResolver(ctx.WorkingDir(), true).FillRuntimeVariablesAsImageSelector(ctx.Context(), devPod.ImageSelector, ctx.Config(), ctx.Dependencies())
135 if err != nil {
136 return nil, err
137 }
138
139 loader.EachDevContainer(devPod, func(devContainer *latest.DevContainer) bool {
140 for i := range pod.Spec.Containers {
141 if devContainer.Container != "" && pod.Spec.Containers[i].Name != devContainer.Container {
142 continue
143 }
144
145 if imageselector.CompareImageNames(imageSelector.Image, pod.Spec.Containers[i].Image) {
146 matchingContainers = append(matchingContainers, pod.Spec.Containers[i].Name)
147 break
148 }
149 }
150 return true
151 })
152
153 return matchingContainers, nil
154 }
155
156 return matchingContainers, nil
157}

Callers 3

matchesSelectorFunction · 0.85
buildDeploymentFunction · 0.85
getPodTemplateContainerFunction · 0.85

Calls 7

EachDevContainerFunction · 0.92
CompareImageNamesFunction · 0.92
WorkingDirMethod · 0.65
ContextMethod · 0.65
ConfigMethod · 0.65
DependenciesMethod · 0.65

Tested by

no test coverage detected