MCPcopy
hub / github.com/kserve/kserve / GetEnvVarValue

Function GetEnvVarValue

pkg/utils/utils.go:269–276  ·  view source on GitHub ↗
(envVars []corev1.EnvVar, key string)

Source from the content-addressed store, hash-verified

267}
268
269func GetEnvVarValue(envVars []corev1.EnvVar, key string) (string, bool) {
270 for _, envVar := range envVars {
271 if envVar.Name == key {
272 return envVar.Value, true // if key exist, return value, true
273 }
274 }
275 return "", false // if key does not exist, return "", false
276}
277
278func GetContainerWithName(podSpec *corev1.PodSpec, name string) *corev1.Container {
279 for idx, container := range podSpec.Containers {

Callers 7

AddEnvVarToPodSpecFunction · 0.92
createRawDeploymentFunction · 0.92
validateMultiNodeSpecFunction · 0.92
TestGetEnvVarValueFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestGetEnvVarValueFunction · 0.68