Skip to content

chore: fabric8 version 6.5.1 #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

<junit.version>5.9.2</junit.version>
<fabric8-client.version>6.2.0</fabric8-client.version>
<fabric8-client.version>6.5.1</fabric8-client.version>
<slf4j.version>1.7.32</slf4j.version>
<log4j.version>2.17.1</log4j.version>
<mokito.version>5.2.0</mokito.version>
<mokito.version>5.2.0</mokito.version>
<dekorate.version>3.5.2</dekorate.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<auto-service.version>1.0.1</auto-service.version>
<assertj.version>3.21.0</assertj.version>
Expand All @@ -64,7 +66,6 @@
<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<spring-boot-dependencies.version>2.7.3</spring-boot-dependencies.version>
<dekorate.version>3.1.2</dekorate.version>
</properties>

<modules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,21 @@ public static void applyAndWait(KubernetesClient client, InputStream is) {
applyAndWait(client, is, null);
}

public static void applyAndWait(KubernetesClient client, InputStream is,
UnaryOperator<HasMetadata> transfor) {
var resources = client.load(is).get();
if (transfor != null) {
resources = resources.stream().map(transfor).collect(Collectors.toList());
public static void applyAndWait(KubernetesClient client, List<HasMetadata> resources,
UnaryOperator<HasMetadata> transformer) {
if (transformer != null) {
resources = resources.stream().map(transformer).collect(Collectors.toList());
}
client.resourceList(resources).createOrReplace();
client.resourceList(resources).create();
client.resourceList(resources).waitUntilReady(3, TimeUnit.MINUTES);
}

public static void applyAndWait(KubernetesClient client, InputStream is,
UnaryOperator<HasMetadata> transformer) {
var resources = client.load(is).items();
applyAndWait(client, resources, transformer);
}

public static void addRequiredLabels(Ingress ingress) {
ingress.getMetadata().setLabels(Map.of(VALIDATION_TARGET_LABEL, "val"));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package io.javaoperatorsdk.webhook.sample;

import java.io.IOException;
import java.io.InputStream;
import java.io.*;
import java.net.URL;
import java.util.function.UnaryOperator;

import org.junit.jupiter.api.BeforeAll;

import io.fabric8.kubernetes.api.model.HasMetadata;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClientBuilder;
import io.javaoperatorsdk.webhook.sample.commons.Utils;

import static io.javaoperatorsdk.webhook.sample.commons.Utils.addConversionHookEndpointToCustomResource;
import static io.javaoperatorsdk.webhook.sample.commons.Utils.applyAndWait;
Expand All @@ -32,4 +34,24 @@ static void deployService() throws IOException {
}
}

// quarkus support uses an older version, these should be removed if quarkus will support newer
// version of fabric8
private static void applyAndWait(KubernetesClient client, InputStream is) {
var resources = client.load(is).get();
Utils.applyAndWait(client, resources, null);
}

private static void applyAndWait(KubernetesClient client, String file) {
applyAndWait(client, file, null);
}

private static void applyAndWait(KubernetesClient client, String file,
UnaryOperator<HasMetadata> transformer) {
try (var fis = new FileInputStream(file)) {
var resources = client.load(fis).get();
Utils.applyAndWait(client, resources, transformer);
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
}
30 changes: 12 additions & 18 deletions samples/spring-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,6 @@
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.dekorate</groupId>
<artifactId>kubernetes-spring-starter</artifactId>
</dependency>
<dependency>
<groupId>io.dekorate</groupId>
<artifactId>certmanager-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.dekorate</groupId>
<artifactId>jib-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.javaoperatorsdk</groupId>
<artifactId>kubernetes-webhooks-framework-core</artifactId>
Expand All @@ -84,15 +72,21 @@
<groupId>io.javaoperatorsdk.admissioncontroller.sample</groupId>
<artifactId>sample-commons</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<artifactId>kubernetes-client</artifactId>
<groupId>io.fabric8</groupId>
</exclusion>
</exclusions>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.dekorate</groupId>
<artifactId>kubernetes-spring-starter</artifactId>
</dependency>
<dependency>
<groupId>io.dekorate</groupId>
<artifactId>certmanager-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.dekorate</groupId>
<artifactId>jib-annotations</artifactId>
</dependency>
</dependencies>

<build>
Expand Down