Skip to content

Commit a89bef3

Browse files
committed
Use simplified list property and accept any URL for manifests
1 parent 6343bf0 commit a89bef3

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

docs/src/main/asciidoc/kubernetes-dev-services.adoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ quarkus.kubernetes-client.devservices.manifests=kubernetes/namespace.yaml
9090

9191
When applying multiple properties, you can apply them as:
9292
```
93-
quarkus.kubernetes-client.devservices.manifests[0]=kubernetes/first_manifest.yaml
94-
quarkus.kubernetes-client.devservices.manifests[1]=kubernetes/second_manifest.yaml
93+
quarkus.kubernetes-client.devservices.manifests=kubernetes/first_manifest.yaml,kubernetes/second_manifest.yaml
9594
```
9695

9796
It is also possible to apply manifests from a URL. So the following syntax would also be possible:

extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/DevServicesKubernetesProcessor.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import java.io.ByteArrayOutputStream;
1212
import java.io.IOException;
1313
import java.io.InputStream;
14+
import java.net.MalformedURLException;
1415
import java.net.URL;
1516
import java.time.Duration;
1617
import java.util.*;
@@ -253,14 +254,19 @@ private boolean isReadinessApplicable(HasMetadata item) {
253254
}
254255

255256
private InputStream getManifestStream(String manifestPath) throws IOException {
256-
if (manifestPath.startsWith("http://") || manifestPath.startsWith("https://")) {
257-
// Option 1: The manifest is a URL, in which case we download it
258-
return new URL(manifestPath).openStream();
259-
} else {
260-
// Option 2: The manifest is a file in the resources directory
261-
return Thread.currentThread()
257+
try {
258+
URL url = new URL(manifestPath);
259+
// For file:// URLs, optionally check if you want to support those or not
260+
return url.openStream();
261+
} catch (MalformedURLException e) {
262+
// Not a URL, so treat as classpath resource
263+
InputStream stream = Thread.currentThread()
262264
.getContextClassLoader()
263265
.getResourceAsStream(manifestPath);
266+
if (stream == null) {
267+
throw new IOException("Resource not found: " + manifestPath);
268+
}
269+
return stream;
264270
}
265271
}
266272

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
quarkus.kubernetes-client.devservices.manifests[0]=kubernetes/namespace.yaml
2-
quarkus.kubernetes-client.devservices.manifests[1]=https://k8s.io/examples/admin/namespace-dev.yaml
1+
quarkus.kubernetes-client.devservices.manifests=kubernetes/namespace.yaml,https://k8s.io/examples/admin/namespace-dev.yaml

0 commit comments

Comments
 (0)