mirror of
https://github.com/outbackdingo/kamaji.git
synced 2026-01-27 10:19:29 +00:00
18 lines
447 B
Go
18 lines
447 B
Go
// Copyright 2022 Clastix Labs
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package utilities
|
|
|
|
import corev1 "k8s.io/api/core/v1"
|
|
|
|
// HasNamedContainer finds the Container in the provided slice by its name, returning a boolean if found, and its index.
|
|
func HasNamedContainer(container []corev1.Container, name string) (found bool, index int) {
|
|
for i, volume := range container {
|
|
if volume.Name == name {
|
|
return true, i
|
|
}
|
|
}
|
|
|
|
return false, 0
|
|
}
|