validateAndReplaceForEnv validates the env data for global variable references and replaces them with the variable value
(variables map[string]string, env []v1alpha2.EnvVar)
| 137 | |
| 138 | // validateAndReplaceForEnv validates the env data for global variable references and replaces them with the variable value |
| 139 | func validateAndReplaceForEnv(variables map[string]string, env []v1alpha2.EnvVar) error { |
| 140 | |
| 141 | invalidKeys := make(map[string]bool) |
| 142 | |
| 143 | for i := range env { |
| 144 | var err error |
| 145 | |
| 146 | // Validate env name |
| 147 | if env[i].Name, err = validateAndReplaceDataWithVariable(env[i].Name, variables); err != nil { |
| 148 | checkForInvalidError(invalidKeys, err) |
| 149 | } |
| 150 | |
| 151 | // Validate env value |
| 152 | if env[i].Value, err = validateAndReplaceDataWithVariable(env[i].Value, variables); err != nil { |
| 153 | checkForInvalidError(invalidKeys, err) |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | return newInvalidKeysError(invalidKeys) |
| 158 | } |
| 159 | |
| 160 | // validateAndReplaceForKubernetesComponent validates the kubernetes component data for global variable references and replaces them with the variable value |
| 161 | func validateAndReplaceForKubernetesComponent(variables map[string]string, kubernetes *v1alpha2.KubernetesComponent) error { |