Review http/https and proxy settings in operator

Co-authored-by: Dominik Guhr <dguhr@redhat.com>
This commit is contained in:
andreaTP 2022-05-16 14:21:49 +01:00 committed by Bruno Oliveira da Silva
parent 37e2298006
commit 2747729fbb
3 changed files with 35 additions and 2 deletions

View file

@ -354,6 +354,14 @@ public class KeycloakDeployment extends OperatorManagedResource implements Statu
new EnvVarBuilder()
.withName("KC_HTTP_ENABLED")
.withValue("true")
.build(),
new EnvVarBuilder()
.withName("KC_HOSTNAME_STRICT_HTTPS")
.withValue("false")
.build(),
new EnvVarBuilder()
.withName("KC_PROXY")
.withValue("edge")
.build());
envVars.addAll(disableTls);
@ -371,6 +379,10 @@ public class KeycloakDeployment extends OperatorManagedResource implements Statu
new EnvVarBuilder()
.withName("KC_HTTPS_CERTIFICATE_KEY_FILE")
.withValue(Constants.CERTIFICATES_FOLDER + "/tls.key")
.build(),
new EnvVarBuilder()
.withName("KC_PROXY")
.withValue("passthrough")
.build());
envVars.addAll(enabledTls);

View file

@ -222,7 +222,7 @@ public class KeycloakDeploymentE2EIT extends ClusterOperatorTest {
var curlOutput = K8sUtils.inClusterCurl(k8sclient, namespace, "-s", "--insecure", "-H", "Host: foo.bar", url);
Log.info("Curl Output: " + curlOutput);
assertTrue(curlOutput.contains("var authServerUrl = 'https://example.com:8443';"));
assertTrue(curlOutput.contains("var authServerUrl = 'https://example.com';"));
});
} catch (Exception e) {
savePodLogs();
@ -247,7 +247,7 @@ public class KeycloakDeploymentE2EIT extends ClusterOperatorTest {
var curlOutput = K8sUtils.inClusterCurl(k8sclient, namespace, "-s", "--insecure", "-H", "Host: foo.bar", url);
Log.info("Curl Output: " + curlOutput);
assertTrue(curlOutput.contains("var authServerUrl = 'https://foo.bar:8443';"));
assertTrue(curlOutput.contains("var authServerUrl = 'https://foo.bar';"));
});
} catch (Exception e) {
savePodLogs();

View file

@ -35,6 +35,16 @@ public class KeycloakIngressE2EIT extends ClusterOperatorTest {
assertEquals("master", output);
});
Awaitility.await()
.ignoreExceptions()
.untilAsserted(() -> {
var statusCode = RestAssured.given()
.get("http://" + kubernetesIp + ":80/admin/master/console")
.statusCode();
assertEquals(200, statusCode);
});
}
@Test
@ -55,6 +65,17 @@ public class KeycloakIngressE2EIT extends ClusterOperatorTest {
assertEquals("master", output);
});
Awaitility.await()
.ignoreExceptions()
.untilAsserted(() -> {
var statusCode = RestAssured.given()
.relaxedHTTPSValidation()
.get("https://" + kubernetesIp + ":443/admin/master/console")
.statusCode();
assertEquals(200, statusCode);
});
}
@Test