Skip to content

Drop ingress #1904

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 12 commits into from
Apr 1, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ void beforeEach() {
util.createNamespace(NAMESPACE_A_UAT);
util.createNamespace(NAMESPACE_B_UAT);

util.wiremock(NAMESPACE_A_UAT, Phase.CREATE);
util.wiremock(NAMESPACE_B_UAT, Phase.CREATE);
util.wiremock(NAMESPACE_A_UAT, Phase.CREATE, false);
util.wiremock(NAMESPACE_B_UAT, Phase.CREATE, false);

}

@AfterEach
void afterEach() {

util.wiremock(NAMESPACE_A_UAT, Phase.DELETE);
util.wiremock(NAMESPACE_B_UAT, Phase.DELETE);
util.wiremock(NAMESPACE_A_UAT, Phase.DELETE, false);
util.wiremock(NAMESPACE_B_UAT, Phase.DELETE, false);

util.deleteNamespace(NAMESPACE_A_UAT);
util.deleteNamespace(NAMESPACE_B_UAT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
*/
class ActuatorRefreshIT {

private static final String WIREMOCK_PATH = "/";

private static final String NAMESPACE = "default";

private static final K3sContainer K3S = Commons.container();
Expand All @@ -72,12 +70,12 @@ static void afterAll() {

@BeforeEach
void setup() {
util.wiremock(NAMESPACE, WIREMOCK_PATH, Phase.CREATE);
util.wiremock(NAMESPACE, Phase.CREATE, true);
}

@AfterEach
void after() {
util.wiremock(NAMESPACE, WIREMOCK_PATH, Phase.DELETE);
util.wiremock(NAMESPACE, Phase.DELETE, true);
}

/*
Expand Down Expand Up @@ -114,10 +112,10 @@ private static void configWatcher(Phase phase) {
deployment.getSpec().getTemplate().getSpec().getContainers().get(0).setEnv(envVars);

if (phase.equals(Phase.CREATE)) {
util.createAndWait(NAMESPACE, null, deployment, service, null, true);
util.createAndWait(NAMESPACE, null, deployment, service, true);
}
else {
util.deleteAndWait(NAMESPACE, deployment, service, null);
util.deleteAndWait(NAMESPACE, deployment, service);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ static void beforeAll() throws Exception {
util = new Util(K3S);
util.createNamespace(LEFT_NAMESPACE);
util.createNamespace(RIGHT_NAMESPACE);
util.wiremock(DEFAULT_NAMESPACE, "/", Phase.CREATE);
util.wiremock(DEFAULT_NAMESPACE, Phase.CREATE, true);
util.setUpClusterWide(DEFAULT_NAMESPACE, Set.of(DEFAULT_NAMESPACE, LEFT_NAMESPACE, RIGHT_NAMESPACE));
configWatcher(Phase.CREATE);
}

@AfterAll
static void afterAll() {
configWatcher(Phase.DELETE);
util.wiremock(DEFAULT_NAMESPACE, "/", Phase.DELETE);
util.wiremock(DEFAULT_NAMESPACE, Phase.DELETE, true);
util.deleteClusterWide(DEFAULT_NAMESPACE, Set.of(DEFAULT_NAMESPACE, LEFT_NAMESPACE, RIGHT_NAMESPACE));
util.deleteNamespace(LEFT_NAMESPACE);
util.deleteNamespace(RIGHT_NAMESPACE);
Expand Down Expand Up @@ -128,10 +128,10 @@ private static void configWatcher(Phase phase) {
.yaml("config-watcher/spring-cloud-kubernetes-configuration-watcher-service.yaml");

if (phase.equals(Phase.CREATE)) {
util.createAndWait(DEFAULT_NAMESPACE, null, deployment, service, null, true);
util.createAndWait(DEFAULT_NAMESPACE, null, deployment, service, true);
}
else {
util.deleteAndWait(DEFAULT_NAMESPACE, deployment, service, null);
util.deleteAndWait(DEFAULT_NAMESPACE, deployment, service);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ final class TestUtil {

private static final String WIREMOCK_HOST = "localhost";

private static final int WIREMOCK_PORT = 80;
private static final int WIREMOCK_PORT = 32321;

static final String SPRING_CLOUD_K8S_CONFIG_WATCHER_APP_NAME = "spring-cloud-kubernetes-configuration-watcher";

Expand All @@ -60,7 +60,7 @@ static void configureWireMock() {
// is ready to take a request via 'Wiremock::stubFor' (because sometimes it fails)
// As such, get the existing mappings and retrySpec() makes sure we retry until
// we get a response back.
WebClient client = builder().baseUrl("http://localhost:80/__admin/mappings").build();
WebClient client = builder().baseUrl("http://localhost:32321/__admin/mappings").build();
client.method(HttpMethod.GET).retrieve().bodyToMono(String.class).retryWhen(retrySpec()).block();

StubMapping stubMapping = WireMock.stubFor(WireMock.post(WireMock.urlEqualTo("/actuator/refresh"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ protected static void discoveryServer(Phase phase) {
V1Service service = (V1Service) util.yaml("manifests/discoveryserver-service.yaml");

if (phase.equals(Phase.CREATE)) {
util.createAndWait(NAMESPACE, null, deployment, service, null, true);
util.createAndWait(NAMESPACE, null, deployment, service, true);
}
else {
util.deleteAndWait(NAMESPACE, deployment, service, null);
util.deleteAndWait(NAMESPACE, deployment, service);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,17 @@ static void beforeAllLocal() throws Exception {
discoveryServer(Phase.CREATE);

Images.loadWiremock(K3S);
util.wiremock(NAMESPACE_LEFT, "/wiremock-" + NAMESPACE_LEFT, Phase.CREATE, false);
util.wiremock(NAMESPACE_RIGHT, "/wiremock-" + NAMESPACE_RIGHT, Phase.CREATE, false);
util.wiremock(NAMESPACE_LEFT, Phase.CREATE, false);
util.wiremock(NAMESPACE_RIGHT, Phase.CREATE, false);
}

@AfterAll
static void afterAllLocal() {
serviceAccount(Phase.DELETE);
discoveryServer(Phase.DELETE);

util.wiremock(NAMESPACE_LEFT, "/wiremock-" + NAMESPACE_LEFT, Phase.DELETE, false);
util.wiremock(NAMESPACE_RIGHT, "/wiremock-" + NAMESPACE_RIGHT, Phase.DELETE, false);
util.wiremock(NAMESPACE_LEFT, Phase.DELETE, false);
util.wiremock(NAMESPACE_RIGHT, Phase.DELETE, false);

util.deleteNamespace(NAMESPACE_LEFT);
util.deleteNamespace(NAMESPACE_RIGHT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ class KubernetesClientBlockingIT extends KubernetesClientDiscoveryBase {
@BeforeEach
void beforeEach() {
Images.loadWiremock(K3S);
util.wiremock(NAMESPACE, "/", Phase.CREATE);
util.wiremock(NAMESPACE, Phase.CREATE, true);
}

@AfterEach
void afterEach() {
util.wiremock(NAMESPACE, "/", Phase.DELETE);
util.wiremock(NAMESPACE, Phase.DELETE, true);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ void beforeEach() {
util.createNamespace(NAMESPACE_B_UAT);

Images.loadWiremock(K3S);
util.wiremock(NAMESPACE_A_UAT, "/", Phase.CREATE);
util.wiremock(NAMESPACE_B_UAT, "/", Phase.CREATE);
util.wiremock(NAMESPACE_A_UAT, Phase.CREATE, false);
util.wiremock(NAMESPACE_B_UAT, Phase.CREATE, false);
}

@AfterEach
void afterEach() {
util.wiremock(NAMESPACE_A_UAT, "/", Phase.DELETE);
util.wiremock(NAMESPACE_B_UAT, "/", Phase.DELETE);
util.wiremock(NAMESPACE_A_UAT, Phase.DELETE, false);
util.wiremock(NAMESPACE_B_UAT, Phase.DELETE, false);

util.deleteNamespace(NAMESPACE_A_UAT);
util.deleteNamespace(NAMESPACE_B_UAT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ void beforeEach() {
util.busybox(NAMESPACE, Phase.CREATE);

externalNameService = (V1Service) util.yaml("external-name-service.yaml");
util.createAndWait(NAMESPACE, null, null, externalNameService, null, true);
util.createAndWait(NAMESPACE, null, null, externalNameService, true);
}

@AfterEach
void afterEach() {
util.busybox(NAMESPACE, Phase.DELETE);
util.deleteAndWait(NAMESPACE, null, externalNameService, null);
util.deleteAndWait(NAMESPACE, null, externalNameService);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ class KubernetesClientReactiveIT extends KubernetesClientDiscoveryBase {
@BeforeEach
void beforeEach() {
Images.loadWiremock(K3S);
util.wiremock(NAMESPACE, "/", Phase.CREATE);
util.wiremock(NAMESPACE, Phase.CREATE, true);
}

@AfterEach
void afterEach() {
util.wiremock(NAMESPACE, "/", Phase.DELETE);
util.wiremock(NAMESPACE, Phase.DELETE, true);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ static void assertPodMetadata(DiscoveryClient discoveryClient) {
assertThat(wiremockInstance.getServiceId()).isEqualTo("service-wiremock");
assertThat(wiremockInstance.getInstanceId()).isNotNull();
assertThat(wiremockInstance.getHost()).isNotNull();
assertThat(wiremockInstance.getMetadata()).isEqualTo(Map.of("k8s_namespace", "default", "type", "ClusterIP",
"port.http", "8080", "app", "service-wiremock"));
assertThat(wiremockInstance.getMetadata()).isEqualTo(
Map.of("k8s_namespace", "default", "type", "NodePort", "port.http", "8080", "app", "service-wiremock"));

}

Expand All @@ -147,8 +147,8 @@ static void assertPodMetadata(ReactiveDiscoveryClient discoveryClient) {
assertThat(wiremockInstance.getServiceId()).isEqualTo("service-wiremock");
assertThat(wiremockInstance.getInstanceId()).isNotNull();
assertThat(wiremockInstance.getHost()).isNotNull();
assertThat(wiremockInstance.getMetadata()).isEqualTo(Map.of("k8s_namespace", "default", "type", "ClusterIP",
"port.http", "8080", "app", "service-wiremock"));
assertThat(wiremockInstance.getMetadata()).isEqualTo(
Map.of("k8s_namespace", "default", "type", "NodePort", "port.http", "8080", "app", "service-wiremock"));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import io.kubernetes.client.openapi.models.V1ConfigMap;
import io.kubernetes.client.openapi.models.V1ConfigMapBuilder;
import io.kubernetes.client.openapi.models.V1Deployment;
import io.kubernetes.client.openapi.models.V1Ingress;
import io.kubernetes.client.openapi.models.V1Service;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
Expand Down Expand Up @@ -153,7 +152,7 @@ void testRefresh() {
util.createAndWait(NAMESPACE, configMap, null);

WebClient.Builder builder = builder();
WebClient serviceClient = builder.baseUrl("http://localhost:80/app").build();
WebClient serviceClient = builder.baseUrl("http://localhost:32321/app").build();

Boolean[] value = new Boolean[1];
await().pollInterval(Duration.ofSeconds(3)).atMost(Duration.ofSeconds(240)).until(() -> {
Expand All @@ -173,13 +172,12 @@ void testRefresh() {
private void app(Phase phase) {
V1Deployment deployment = (V1Deployment) util.yaml("app/app-deployment.yaml");
V1Service service = (V1Service) util.yaml("app/app-service.yaml");
V1Ingress ingress = (V1Ingress) util.yaml("ingress/ingress.yaml");

if (phase.equals(Phase.CREATE)) {
util.createAndWait(NAMESPACE, null, deployment, service, ingress, true);
util.createAndWait(NAMESPACE, null, deployment, service, true);
}
else if (phase.equals(Phase.DELETE)) {
util.deleteAndWait(NAMESPACE, deployment, service, ingress);
util.deleteAndWait(NAMESPACE, deployment, service);
}
}

Expand All @@ -188,10 +186,10 @@ private void configWatcher(Phase phase) {
V1Service service = (V1Service) util.yaml("config-watcher/watcher-kus-kafka-service.yaml");

if (phase.equals(Phase.CREATE)) {
util.createAndWait(NAMESPACE, null, deployment, service, null, true);
util.createAndWait(NAMESPACE, null, deployment, service, true);
}
else if (phase.equals(Phase.DELETE)) {
util.deleteAndWait(NAMESPACE, deployment, service, null);
util.deleteAndWait(NAMESPACE, deployment, service);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ spec:
- name: http
port: 8081
targetPort: 8081
nodePort: 32321
selector:
app: app
type: ClusterIP
type: NodePort

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.util.Objects;

import io.kubernetes.client.openapi.models.V1Deployment;
import io.kubernetes.client.openapi.models.V1Ingress;
import io.kubernetes.client.openapi.models.V1Secret;
import io.kubernetes.client.openapi.models.V1SecretBuilder;
import io.kubernetes.client.openapi.models.V1Service;
Expand Down Expand Up @@ -103,7 +102,7 @@ void testRefresh() {
util.createAndWait(NAMESPACE, null, secret);

WebClient.Builder builder = builder();
WebClient serviceClient = builder.baseUrl("http://localhost:80/app").build();
WebClient serviceClient = builder.baseUrl("http://localhost:32321/app").build();

Boolean[] value = new Boolean[1];
await().pollInterval(Duration.ofSeconds(3)).atMost(Duration.ofSeconds(240)).until(() -> {
Expand All @@ -122,13 +121,12 @@ void testRefresh() {
private void appA(Phase phase) {
V1Deployment deployment = (V1Deployment) util.yaml("app/app-deployment.yaml");
V1Service service = (V1Service) util.yaml("app/app-service.yaml");
V1Ingress ingress = (V1Ingress) util.yaml("ingress/ingress.yaml");

if (phase.equals(Phase.CREATE)) {
util.createAndWait(NAMESPACE, null, deployment, service, ingress, true);
util.createAndWait(NAMESPACE, null, deployment, service, true);
}
else if (phase.equals(Phase.DELETE)) {
util.deleteAndWait(NAMESPACE, deployment, service, ingress);
util.deleteAndWait(NAMESPACE, deployment, service);
}
}

Expand All @@ -137,10 +135,10 @@ private void configWatcher(Phase phase) {
V1Service service = (V1Service) util.yaml("config-watcher/watcher-service.yaml");

if (phase.equals(Phase.CREATE)) {
util.createAndWait(NAMESPACE, null, deployment, service, null, true);
util.createAndWait(NAMESPACE, null, deployment, service, true);
}
else if (phase.equals(Phase.DELETE)) {
util.deleteAndWait(NAMESPACE, deployment, service, null);
util.deleteAndWait(NAMESPACE, deployment, service);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ spec:
- name: http
port: 8080
targetPort: 8080
nodePort: 32321
selector:
app: app
type: ClusterIP
type: NodePort

This file was deleted.

Loading
Loading