in patch.go [229:249]
func createEnvVariablesPatches(envVariables []corev1.EnvVar, createArray bool, index int) []patchOperation {
containerIndex := strconv.Itoa(index)
envVariablesPath := "/spec/containers/" + containerIndex + "/env"
if createArray {
return []patchOperation{{
Op: "add",
Path: envVariablesPath,
Value: envVariables,
}}
}
patches := make([]patchOperation, len(envVariables))
envVariablesPath += "/-"
for i, variable := range envVariables {
patches[i] = patchOperation{
Op: "add",
Path: envVariablesPath,
Value: variable,
}
}
return patches
}