infers the default ip/hostname from the client

Closes #21114
This commit is contained in:
Steve Hawkins 2023-06-20 16:04:41 -04:00 committed by Bruno Oliveira da Silva
parent 14747f45ca
commit 4540ca365c
2 changed files with 11 additions and 3 deletions

View file

@ -94,9 +94,9 @@ To run tests on Mac with `minikube` and the `docker` driver you should run `mini
-Dtest.operator.kubernetes.ip=localhost
```
On Linux or on Mac using `minikube` on a VM, instead you should pass this additional property:
On Linux or on Mac using `minikube` on a VM, instead you should enable ingress:
```bash
-Dtest.operator.kubernetes.ip=$(minikube ip)
minikube addons enable ingress
```
To avoid skipping tests that are depending on custom Keycloak images, you need to build those first:

View file

@ -46,6 +46,8 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.Duration;
import java.util.UUID;
@ -84,12 +86,18 @@ public abstract class BaseOperatorTest {
reconcilers = CDI.current().select(new TypeLiteral<>() {});
operatorDeployment = ConfigProvider.getConfig().getOptionalValue(OPERATOR_DEPLOYMENT_PROP, OperatorDeployment.class).orElse(OperatorDeployment.local);
deploymentTarget = ConfigProvider.getConfig().getOptionalValue(QUARKUS_KUBERNETES_DEPLOYMENT_TARGET, String.class).orElse("kubernetes");
kubernetesIp = ConfigProvider.getConfig().getOptionalValue(OPERATOR_KUBERNETES_IP, String.class).orElse("localhost");
customImage = ConfigProvider.getConfig().getOptionalValue(OPERATOR_CUSTOM_IMAGE, String.class).orElse(null);
setDefaultAwaitilityTimings();
calculateNamespace();
createK8sClient();
kubernetesIp = ConfigProvider.getConfig().getOptionalValue(OPERATOR_KUBERNETES_IP, String.class).orElseGet(() -> {
try {
return new URL(k8sclient.getConfiguration().getMasterUrl()).getHost();
} catch (MalformedURLException e) {
return "localhost";
}
});
createCRDs();
createNamespace();
isOpenShift = isOpenShift(k8sclient);