fix: switching to clusterip service (#26975)
also adding the previous log when things fail closes: #26790 Signed-off-by: Steve Hawkins <shawkins@redhat.com>
This commit is contained in:
parent
8d3d94f904
commit
ee126f73e5
2 changed files with 12 additions and 1 deletions
|
@ -70,6 +70,7 @@ import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
@ -342,6 +343,17 @@ public class BaseOperatorTest implements QuarkusTestAfterEachCallback {
|
||||||
Log.warnf("%s not ready log: %s", instance.getMetadata().getName(), log);
|
Log.warnf("%s not ready log: %s", instance.getMetadata().getName(), log);
|
||||||
} catch (KubernetesClientException e) {
|
} catch (KubernetesClientException e) {
|
||||||
Log.warnf("No %s log: %s", instance.getMetadata().getName(), e.getMessage());
|
Log.warnf("No %s log: %s", instance.getMetadata().getName(), e.getMessage());
|
||||||
|
if (instance instanceof Pod) {
|
||||||
|
try {
|
||||||
|
String previous = k8sclient.raw(String.format("/api/v1/namespaces/%s/pods/%s/log?previous=true", namespace, instance.getMetadata().getName()));
|
||||||
|
Log.warnf("%s previous log: %s", instance.getMetadata().getName(), previous);
|
||||||
|
} catch (KubernetesClientException pe) {
|
||||||
|
// not available
|
||||||
|
if (pe.getCode() != HttpURLConnection.HTTP_BAD_REQUEST) {
|
||||||
|
Log.infof("Could not obtain previous log for %s: %s", instance.getMetadata().getName(), e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,6 @@ metadata:
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: postgresql-db
|
app: postgresql-db
|
||||||
type: LoadBalancer
|
|
||||||
ports:
|
ports:
|
||||||
- port: 5432
|
- port: 5432
|
||||||
targetPort: 5432
|
targetPort: 5432
|
Loading…
Reference in a new issue