Skip to content

Commit

Permalink
[FLINK-31928][build] Upgrade okhttp3 to 4.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cy2008 committed Apr 28, 2023
1 parent 3664609 commit 7f49f7c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 25 deletions.
19 changes: 18 additions & 1 deletion flink-kubernetes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,20 @@ under the License.

<properties>
<kubernetes.client.version>5.12.4</kubernetes.client.version>
<kotlin.version>1.6.20</kotlin.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-bom</artifactId>
<version>${kotlin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>

<!-- core dependencies -->
Expand Down Expand Up @@ -115,7 +127,8 @@ under the License.
<include>com.fasterxml.jackson.dataformat:jackson-dataformat-yaml</include>
<include>com.fasterxml.jackson.datatype:jackson-datatype-jsr310</include>
<include>com.squareup.okhttp3:*</include>
<include>com.squareup.okio:okio</include>
<include>com.squareup.okio:*</include>
<include>org.jetbrains.kotlin:*</include>
<include>org.yaml:*</include>
<include>dk.brics.automaton:*</include>

Expand Down Expand Up @@ -159,6 +172,10 @@ under the License.
<pattern>okio</pattern>
<shadedPattern>org.apache.flink.kubernetes.shaded.okio</shadedPattern>
</relocation>
<relocation>
<pattern>kotlin</pattern>
<shadedPattern>org.apache.flink.kubernetes.shaded.kotlin</shadedPattern>
</relocation>
<relocation>
<pattern>org.yaml</pattern>
<shadedPattern>org.apache.flink.kubernetes.shaded.org.yaml</shadedPattern>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@ public class KubernetesClientTestBase extends KubernetesTestBase {
protected static final int REST_PORT = 9021;
protected static final int NODE_PORT = 31234;

protected void mockExpectedNodesFromServerSide(List<String> addresses) {
protected void mockExpectedNodesFromServerSide(List<String[]> addresses) {
final List<Node> nodes = new ArrayList<>();
Collections.shuffle(addresses);
for (String address : addresses) {
final String[] parts = address.split(":");
for (String[] parts : addresses) {
Preconditions.checkState(
parts.length == 3,
"Address should be in format \"<type>:<ip>:<unschedulable>\".");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,17 +318,23 @@ void testNodePortServiceWithExternalIP() {
private void testNodePortService(KubernetesConfigOptions.NodePortAddressType addressType) {
flinkConfig.set(
KubernetesConfigOptions.REST_SERVICE_EXPOSED_NODE_PORT_ADDRESS_TYPE, addressType);
final List<String> internalAddresses =
final List<String[]> internalAddresses =
Arrays.asList(
"InternalIP:10.0.0.1:true",
"InternalIP:10.0.0.2:false",
"InternalIP:10.0.0.3: ");
final List<String> externalAddresses =
new String[]{"InternalIP", "10.0.0.1", "true"},
new String[]{"InternalIP", "10.0.0.2", "false"},
new String[]{"InternalIP", "10.0.0.3", " "},
new String[]{"InternalIP", "2409:8c20:1833:2000::afd:ab7a", "true"},
new String[]{"InternalIP", "2409:8c20:1833:2000::afd:ab7b", "false"},
new String[]{"InternalIP", "2409:8c20:1833:2000::afd:ab7c", " "});
final List<String[]> externalAddresses =
Arrays.asList(
"ExternalIP:7.7.7.7:true",
"ExternalIP:8.8.8.8:false",
"ExternalIP:9.9.9.9: ");
final List<String> addresses = new ArrayList<>();
new String[]{"ExternalIP", "7.7.7.7", "true"},
new String[]{"ExternalIP", "8.8.8.8", "false"},
new String[]{"ExternalIP", "9.9.9.9", " "},
new String[]{"ExternalIP", "fd83:fb51:44b4:1e1:a5c9:b9dc:7ff:2170", "true"},
new String[]{"ExternalIP", "fd83:fb51:44b4:1e1:a5c9:b9dc:7ff:2171", "false"},
new String[]{"ExternalIP", "fd83:fb51:44b4:1e1:a5c9:b9dc:7ff:2173", " "});
final List<String[]> addresses = new ArrayList<>();
addresses.addAll(internalAddresses);
addresses.addAll(externalAddresses);
mockExpectedServiceFromServerSide(buildExternalServiceWithNodePort());
Expand All @@ -345,22 +351,22 @@ private void testNodePortService(KubernetesConfigOptions.NodePortAddressType add
case InternalIP:
expectedIps =
internalAddresses.stream()
.filter(s -> !"true".equals(s.split(":")[2]))
.map(s -> s.split(":")[1])
.filter(s -> !"true".equals(s[2]))
.map(s -> s[1])
.collect(Collectors.toList());
break;
case ExternalIP:
expectedIps =
externalAddresses.stream()
.filter(s -> !"true".equals(s.split(":")[2]))
.map(s -> s.split(":")[1])
.filter(s -> !"true".equals(s[2]))
.map(s -> s[1])
.collect(Collectors.toList());
break;
default:
throw new IllegalArgumentException(
String.format("Unexpected address type %s.", addressType));
}
assertThat(expectedIps.size()).isEqualTo(2);
assertThat(expectedIps.size()).isEqualTo(4);
assertThat(resultEndpoint.get().getAddress()).isIn(expectedIps);
assertThat(resultEndpoint.get().getPort()).isEqualTo(NODE_PORT);
}
Expand Down
11 changes: 4 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ under the License.
<py4j.version>0.10.9.7</py4j.version>
<beam.version>2.43.0</beam.version>
<protoc.version>3.21.7</protoc.version>
<okhttp.version>3.14.9</okhttp.version>
<okhttp.version>4.11.0</okhttp.version>
<!-- keep net.java.dev.jna:jna version in sync -->
<testcontainers.version>1.17.6</testcontainers.version>
<lz4.version>1.8.0</lz4.version>
Expand Down Expand Up @@ -643,13 +643,10 @@ under the License.

<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${okhttp.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<artifactId>okhttp-bom</artifactId>
<version>${okhttp.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>

<dependency>
Expand Down

0 comments on commit 7f49f7c

Please sign in to comment.