mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-25 16:42:34 +00:00
fix: add proxy env propagation (#30741)
* fix: add proxy env propagation closes: #30165 Signed-off-by: Steve Hawkins <shawkins@redhat.com> * Update operator/src/main/java/org/keycloak/operator/controllers/KeycloakDeploymentDependentResource.java Co-authored-by: Martin Bartoš <mabartos@redhat.com> --------- Signed-off-by: Steve Hawkins <shawkins@redhat.com> Co-authored-by: Martin Bartoš <mabartos@redhat.com>
This commit is contained in:
@@ -53,6 +53,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -74,6 +75,8 @@ import static org.keycloak.operator.crds.v2alpha1.CRDUtils.isTlsConfigured;
|
||||
@KubernetesDependent(labelSelector = Constants.DEFAULT_LABELS_AS_STRING)
|
||||
public class KeycloakDeploymentDependentResource extends CRUDKubernetesDependentResource<StatefulSet, Keycloak> {
|
||||
|
||||
private static final List<String> COPY_ENV = Arrays.asList("HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY");
|
||||
|
||||
private static final String SERVICE_ACCOUNT_DIR = "/var/run/secrets/kubernetes.io/serviceaccount/";
|
||||
private static final String SERVICE_CA_CRT = SERVICE_ACCOUNT_DIR + "service-ca.crt";
|
||||
|
||||
@@ -419,7 +422,14 @@ public class KeycloakDeploymentDependentResource extends CRUDKubernetesDependent
|
||||
}
|
||||
return envBuilder.build();
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
|
||||
for (String env : COPY_ENV) {
|
||||
String value = System.getenv(env);
|
||||
if (value != null) {
|
||||
envVars.add(new EnvVarBuilder().withName(env).withValue(value).build());
|
||||
}
|
||||
}
|
||||
|
||||
envVars.add(
|
||||
new EnvVarBuilder()
|
||||
|
||||
Reference in New Issue
Block a user