Skip to content

Commit f2f9d31

Browse files
committed
simpler
1 parent d06a36f commit f2f9d31

File tree

2 files changed

+10
-19
lines changed
  • spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons

2 files changed

+10
-19
lines changed

spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/fabric8_client/Util.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,9 @@ public final class Util {
6363

6464
private static final Log LOG = LogFactory.getLog(Util.class);
6565

66-
/** Image we get {@code istioctl} from in order to install Istio. */
67-
public static final String ISTIO_ISTIOCTL = "istio/istioctl";
68-
69-
private final K3sContainer container;
70-
7166
private final KubernetesClient client;
7267

7368
public Util(K3sContainer container) {
74-
this.container = container;
7569
this.client = new KubernetesClientBuilder().withConfig(Config.fromKubeconfig(container.getKubeConfigYaml()))
7670
.build();
7771
}
@@ -83,7 +77,7 @@ public Util(K3sContainer container) {
8377
* tight as possible, providing reasonable defaults.
8478
*
8579
*/
86-
public void createAndWait(String namespace, String name, @Nullable Deployment deployment, @Nullable Service service,
80+
public void createAndWait(String namespace, @Nullable Deployment deployment, @Nullable Service service,
8781
@Nullable Ingress ingress, boolean changeVersion) {
8882
try {
8983

@@ -134,7 +128,7 @@ public void busybox(String namespace, Phase phase) {
134128
Service service = client.services().load(serviceStream).item();
135129

136130
if (phase.equals(Phase.CREATE)) {
137-
createAndWait(namespace, "busybox", deployment, service, null, false);
131+
createAndWait(namespace, deployment, service, null, false);
138132
}
139133
else if (phase.equals(Phase.DELETE)) {
140134
deleteAndWait(namespace, deployment, service, null);
@@ -304,7 +298,7 @@ public void setUpIstioctl(String namespace, Phase phase) {
304298
istioctlDeployment.getSpec().getTemplate().getSpec().getContainers().get(0).setImage(imageWithVersion);
305299

306300
if (phase.equals(Phase.CREATE)) {
307-
createAndWait(namespace, null, istioctlDeployment, null, null, false);
301+
createAndWait(namespace, istioctlDeployment, null, null, false);
308302
}
309303
else {
310304
deleteAndWait(namespace, istioctlDeployment, null, null);
@@ -355,7 +349,7 @@ public void wiremock(String namespace, String path, Phase phase, boolean withIng
355349

356350
deployment.getMetadata().setNamespace(namespace);
357351
service.getMetadata().setNamespace(namespace);
358-
createAndWait(namespace, "wiremock", deployment, service, ingress, false);
352+
createAndWait(namespace, deployment, service, ingress, false);
359353
}
360354
else {
361355

spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/native_client/Util.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ public final class Util {
8282

8383
private final RbacAuthorizationV1Api rbacApi;
8484

85-
private final K3sContainer container;
86-
8785
public Util(K3sContainer container) {
8886

8987
ApiClient client;
@@ -97,7 +95,6 @@ public Util(K3sContainer container) {
9795
client.setDebugging(false);
9896
Configuration.setDefaultApiClient(client);
9997

100-
this.container = container;
10198
this.coreV1Api = new CoreV1Api();
10299
this.appsV1Api = new AppsV1Api();
103100
this.networkingV1Api = new NetworkingV1Api();
@@ -111,8 +108,8 @@ public Util(K3sContainer container) {
111108
* tight as possible, providing reasonable defaults.
112109
*
113110
*/
114-
public void createAndWait(String namespace, String name, V1Deployment deployment, V1Service service,
115-
@Nullable V1Ingress ingress, boolean changeVersion) {
111+
public void createAndWait(String namespace, V1Deployment deployment, V1Service service, @Nullable V1Ingress ingress,
112+
boolean changeVersion) {
116113
try {
117114

118115
coreV1Api.createNamespacedService(namespace, service, null, null, null, null);
@@ -245,7 +242,7 @@ public void busybox(String namespace, Phase phase) {
245242

246243
V1Service service = (V1Service) yaml("busybox/service.yaml");
247244
if (phase.equals(Phase.CREATE)) {
248-
createAndWait(namespace, "busybox", deployment, service, null, false);
245+
createAndWait(namespace, deployment, service, null, false);
249246
}
250247
else if (phase.equals(Phase.DELETE)) {
251248
deleteAndWait(namespace, deployment, service, null);
@@ -264,7 +261,7 @@ public void kafka(String namespace, Phase phase) {
264261

265262
if (phase.equals(Phase.CREATE)) {
266263
createAndWait(namespace, configMap, null);
267-
createAndWait(namespace, "kafka", deployment, service, null, false);
264+
createAndWait(namespace, deployment, service, null, false);
268265
}
269266
else if (phase.equals(Phase.DELETE)) {
270267
deleteAndWait(namespace, configMap, null);
@@ -282,7 +279,7 @@ public void rabbitMq(String namespace, Phase phase) {
282279
V1Service service = (V1Service) yaml("rabbitmq/rabbitmq-service.yaml");
283280

284281
if (phase.equals(Phase.CREATE)) {
285-
createAndWait(namespace, "rabbitmq", deployment, service, null, false);
282+
createAndWait(namespace, deployment, service, null, false);
286283
}
287284
else if (phase.equals(Phase.DELETE)) {
288285
deleteAndWait(namespace, deployment, service, null);
@@ -472,7 +469,7 @@ public void wiremock(String namespace, String path, Phase phase, boolean withIng
472469

473470
deployment.getMetadata().setNamespace(namespace);
474471
service.getMetadata().setNamespace(namespace);
475-
createAndWait(namespace, "wiremock", deployment, service, ingress, false);
472+
createAndWait(namespace, deployment, service, ingress, false);
476473
}
477474
else {
478475
if (withIngress) {

0 commit comments

Comments
 (0)