Skip to content

Commit fb75eeb

Browse files
committed
Fix issue where RetryingWkaAddressProvider may fail to resolve any addresses if coherence.wka property not set correctly
1 parent c25f873 commit fb75eeb

File tree

5 files changed

+125
-13
lines changed

5 files changed

+125
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,4 @@ bundle.Dockerfile
5151
/__debug_bin
5252
hack/istio*/
5353
/java/certs/
54+
.flattened-pom.xml

Makefile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ----------------------------------------------------------------------------------------------------------------------
2-
# Copyright (c) 2019, 2021, Oracle and/or its affiliates.
2+
# Copyright (c) 2019, 2022, Oracle and/or its affiliates.
33
# Licensed under the Universal Permissive License v 1.0 as shown at
44
# http://oss.oracle.com/licenses/upl.
55
#
@@ -88,6 +88,7 @@ GPG_PASSPHRASE :=
8888
# The test application images used in integration tests
8989
# ----------------------------------------------------------------------------------------------------------------------
9090
TEST_APPLICATION_IMAGE := $(RELEASE_IMAGE_PREFIX)operator-test:1.0.0
91+
TEST_APPLICATION_IMAGE_WITH_UTILS := $(RELEASE_IMAGE_PREFIX)operator-test-with-utils:1.0.0
9192
TEST_COMPATIBILITY_IMAGE := $(RELEASE_IMAGE_PREFIX)operator-test-compatibility:1.0.0
9293
TEST_APPLICATION_IMAGE_CLIENT := $(RELEASE_IMAGE_PREFIX)operator-test-client:1.0.0
9394
TEST_APPLICATION_IMAGE_HELIDON := $(RELEASE_IMAGE_PREFIX)operator-test-helidon:1.0.0
@@ -413,8 +414,7 @@ build-operator-images: $(BUILD_TARGETS)/build-operator build-utils ## Build all
413414
# Build the Operator Test images
414415
# ----------------------------------------------------------------------------------------------------------------------
415416
.PHONY: build-test-images
416-
build-test-images: build-mvn build-client-image ## Build all of the test images
417-
./mvnw -B -f java/operator-test package jib:dockerBuild -DskipTests -Djib.to.image=$(TEST_APPLICATION_IMAGE) $(MAVEN_BUILD_OPTS)
417+
build-test-images: build-mvn build-client-image build-basic-test-image ## Build all of the test images
418418
./mvnw -B -f java/operator-test-helidon package jib:dockerBuild -DskipTests -Djib.to.image=$(TEST_APPLICATION_IMAGE_HELIDON) $(MAVEN_BUILD_OPTS)
419419
./mvnw -B -f java/operator-test-spring package jib:dockerBuild -DskipTests -Djib.to.image=$(TEST_APPLICATION_IMAGE_SPRING) $(MAVEN_BUILD_OPTS)
420420
./mvnw -B -f java/operator-test-spring package spring-boot:build-image -DskipTests -Dcnbp-image-name=$(TEST_APPLICATION_IMAGE_SPRING_CNBP) $(MAVEN_BUILD_OPTS)
@@ -424,6 +424,14 @@ build-test-images: build-mvn build-client-image ## Build all of the test images
424424
cd java/operator-test-spring/target/spring && jar -xvf operator-test-spring-$(MVN_VERSION).jar && rm -f operator-test-spring-$(MVN_VERSION).jar
425425
docker build -f java/operator-test-spring/target/Dir.Dockerfile -t $(TEST_APPLICATION_IMAGE_SPRING) java/operator-test-spring/target
426426

427+
# ----------------------------------------------------------------------------------------------------------------------
428+
# Build the basic Operator Test image
429+
# ----------------------------------------------------------------------------------------------------------------------
430+
.PHONY: build-basic-test-image
431+
build-basic-test-image: build-mvn ## Build the basic Operator test image
432+
./mvnw -B -f java/operator-test package jib:dockerBuild -DskipTests -Djib.to.image=$(TEST_APPLICATION_IMAGE) $(MAVEN_BUILD_OPTS)
433+
./mvnw -B -f java/operator-test-with-utils package jib:dockerBuild -am -nsu -DskipTests -Djib.to.image=$(TEST_APPLICATION_IMAGE_WITH_UTILS) $(MAVEN_BUILD_OPTS)
434+
427435
.PHONY: build-client-image
428436
build-client-image: ## Build the test client image
429437
./mvnw -B -f java/operator-test-client package jib:dockerBuild -DskipTests -Djib.to.image=$(TEST_APPLICATION_IMAGE_CLIENT) $(MAVEN_BUILD_OPTS)
@@ -471,7 +479,7 @@ $(BUILD_BIN)/runner: $(BUILD_PROPS) $(GOS)
471479
# ----------------------------------------------------------------------------------------------------------------------
472480
.PHONY: build-mvn
473481
build-mvn: ## Build the Java artefacts
474-
./mvnw -B -f java package -DskipTests $(MAVEN_BUILD_OPTS)
482+
./mvnw -B -f java clean install -DskipTests $(MAVEN_BUILD_OPTS)
475483

476484
# ----------------------------------------------------------------------------------------------------------------------
477485
# Build Java client

java/coherence-operator/src/main/java/com/oracle/coherence/k8s/RetryingWkaAddressProvider.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
/*
2-
* Copyright (c) 2019, 2021, Oracle and/or its affiliates.
2+
* Copyright (c) 2019, 2022, Oracle and/or its affiliates.
33
* Licensed under the Universal Permissive License v 1.0 as shown at
44
* http://oss.oracle.com/licenses/upl.
55
*/
66

77
package com.oracle.coherence.k8s;
88

99
import java.io.IOException;
10+
1011
import java.net.UnknownHostException;
12+
1113
import java.util.Arrays;
1214
import java.util.Collections;
1315
import java.util.List;
16+
1417
import java.util.stream.Collectors;
1518

19+
import com.tangosol.coherence.config.Config;
20+
1621
import com.tangosol.net.AddressProvider;
1722
import com.tangosol.net.ConfigurableAddressProvider;
23+
1824
import com.tangosol.util.Base;
1925

2026
/**
@@ -72,7 +78,6 @@ public class RetryingWkaAddressProvider
7278
*/
7379
public RetryingWkaAddressProvider(Iterable<AddressHolder> addressHolders, boolean fSafe, long frequency, long timeout) {
7480
super(addressHolders, fSafe);
75-
7681
wkaDNSReresolveFrequency = frequency;
7782
wkaDNSResolutionTimeout = timeout;
7883
}
@@ -91,7 +96,7 @@ public RetryingWkaAddressProvider(Iterable<AddressHolder> addressHolders, boolea
9196
* @throws UnknownHostException if the WKA address is invalid
9297
*/
9398
public static AddressProvider create() throws UnknownHostException {
94-
return create(System.getProperty(PROP_WKA_OVERRIDE));
99+
return create(Config.getProperty(PROP_WKA_OVERRIDE));
95100
}
96101

97102
/**
@@ -201,8 +206,8 @@ public AddressProvider eventuallyResolve()
201206
}
202207

203208
throw new UnknownHostException(RetryingWkaAddressProvider.class.getName()
204-
+ " failed to resolve configured WKA address(es) "
205-
+ System.getProperty(PROP_WKA_OVERRIDE)
209+
+ " failed to resolve any configured WKA address(es) "
210+
+ Config.getProperty(PROP_WKA_OVERRIDE)
206211
+ " within " + wkaDNSResolutionTimeout + " milliseconds.");
207212
}
208213
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Copyright (c) 2019, 2022, Oracle and/or its affiliates.
5+
Licensed under the Universal Permissive License v 1.0 as shown at
6+
http://oss.oracle.com/licenses/upl.
7+
8+
-->
9+
10+
<project xmlns="http://maven.apache.org/POM/4.0.0"
11+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
12+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
13+
<modelVersion>4.0.0</modelVersion>
14+
15+
<parent>
16+
<groupId>com.oracle.coherence.kubernetes</groupId>
17+
<artifactId>operator-parent</artifactId>
18+
<version>${revision}</version>
19+
<relativePath>../pom.xml</relativePath>
20+
</parent>
21+
22+
<artifactId>operator-test-with-utils</artifactId>
23+
24+
<description>Oracle Coherence Kubernetes Operator Test (with utils)</description>
25+
<name>operator-test-with-utils</name>
26+
27+
<dependencies>
28+
<dependency>
29+
<groupId>com.oracle.coherence.kubernetes</groupId>
30+
<artifactId>coherence-operator</artifactId>
31+
<version>${project.version}</version>
32+
</dependency>
33+
<dependency>
34+
<groupId>com.oracle.coherence.kubernetes</groupId>
35+
<artifactId>operator-test</artifactId>
36+
<version>${project.version}</version>
37+
</dependency>
38+
</dependencies>
39+
40+
<build>
41+
<plugins>
42+
<plugin>
43+
<groupId>com.google.cloud.tools</groupId>
44+
<artifactId>jib-maven-plugin</artifactId>
45+
<version>${version.plugin.jib}</version>
46+
<configuration>
47+
<from>
48+
<image>docker://${coherence.test.base.image}</image>
49+
</from>
50+
<container>
51+
<format>OCI</format>
52+
<mainClass>com.tangosol.net.Coherence</mainClass>
53+
</container>
54+
<containerizingMode>packaged</containerizingMode>
55+
</configuration>
56+
</plugin>
57+
</plugins>
58+
</build>
59+
</project>

java/pom.xml

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!--
44
5-
Copyright (c) 2019, 2021, Oracle and/or its affiliates.
5+
Copyright (c) 2019, 2022, Oracle and/or its affiliates.
66
Licensed under the Universal Permissive License v 1.0 as shown at
77
http://oss.oracle.com/licenses/upl.
88
@@ -26,6 +26,7 @@
2626
<module>coherence-operator-client</module>
2727
<module>operator-compatibility</module>
2828
<module>operator-test</module>
29+
<module>operator-test-with-utils</module>
2930
<module>operator-test-helidon</module>
3031
<module>operator-test-spring</module>
3132
<module>operator-test-client</module>
@@ -40,7 +41,7 @@
4041
<maven.compiler.target>8</maven.compiler.target>
4142

4243
<!-- The Coherence jar version (compile time dependency) -->
43-
<coherence.version>21.12</coherence.version>
44+
<coherence.version>21.12.1-SNAPSHOT</coherence.version>
4445
<!-- The version of Coherence to use in the test images -->
4546
<coherence.test.groupId>com.oracle.coherence.ce</coherence.test.groupId>
4647
<coherence.test.version>${coherence.version}</coherence.test.version>
@@ -91,7 +92,8 @@
9192
<version.plugin.maven.deploy>2.8.2</version.plugin.maven.deploy>
9293
<version.plugin.maven.exec>3.0.0</version.plugin.maven.exec>
9394
<version.plugin.maven.failsafe>3.0.0-M5</version.plugin.maven.failsafe>
94-
<version.plugin.maven.gpg>1.6</version.plugin.maven.gpg>
95+
<version.plugin.maven.flatten>1.2.2</version.plugin.maven.flatten>
96+
<version.plugin.maven.gpg>3.0.1</version.plugin.maven.gpg>
9597
<version.plugin.maven.jar>3.2.0</version.plugin.maven.jar>
9698
<version.plugin.maven.license>2.0.0</version.plugin.maven.license>
9799
<version.plugin.maven.resource>3.1.0</version.plugin.maven.resource>
@@ -487,11 +489,43 @@
487489
<plugin>
488490
<groupId>org.apache.maven.plugins</groupId>
489491
<artifactId>maven-gpg-plugin</artifactId>
490-
<version>${maven.gpg.plugin.version}</version>
492+
<version>${version.plugin.maven.gpg}</version>
491493
<configuration>
492494
<skip>true</skip>
493495
</configuration>
494496
</plugin>
497+
498+
<plugin>
499+
<groupId>org.codehaus.mojo</groupId>
500+
<artifactId>flatten-maven-plugin</artifactId>
501+
<version>${version.plugin.maven.flatten}</version>
502+
<executions>
503+
<execution>
504+
<id>flatten.clean</id>
505+
<phase>clean</phase>
506+
<goals>
507+
<goal>clean</goal>
508+
</goals>
509+
</execution>
510+
<execution>
511+
<id>flatten</id>
512+
<phase>package</phase>
513+
<goals>
514+
<goal>flatten</goal>
515+
</goals>
516+
<configuration>
517+
<pomElements>
518+
<name/>
519+
<description/>
520+
<url/>
521+
<inceptionYear/>
522+
<organization/>
523+
</pomElements>
524+
<updatePomFile>true</updatePomFile>
525+
</configuration>
526+
</execution>
527+
</executions>
528+
</plugin>
495529
</plugins>
496530
</pluginManagement>
497531

@@ -523,6 +557,11 @@
523557
<artifactId>maven-surefire-plugin</artifactId>
524558
</plugin>
525559

560+
<plugin>
561+
<groupId>org.codehaus.mojo</groupId>
562+
<artifactId>flatten-maven-plugin</artifactId>
563+
</plugin>
564+
526565
<plugin>
527566
<groupId>io.helidon.build-tools</groupId>
528567
<artifactId>sitegen-maven-plugin</artifactId>

0 commit comments

Comments
 (0)