Skip to content

Commit d78810d

Browse files
committed
Fix #32380: update dependencies
1 parent a24270f commit d78810d

15 files changed

Lines changed: 102 additions & 62 deletions

File tree

pom.xml

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
45
<modelVersion>4.0.0</modelVersion>
56

67
<groupId>eu.openanalytics</groupId>
78
<artifactId>shinyproxy-operator</artifactId>
8-
<version>2.0.0</version>
9+
<version>2.1.0-SNAPSHOT</version>
910

1011
<organization>
1112
<name>Open Analytics NV</name>
1213
<url>https://www.shinyproxy.io/</url>
1314
</organization>
1415

1516
<properties>
16-
<maven.compiler.source>11</maven.compiler.source>
17-
<maven.compiler.release>11</maven.compiler.release>
18-
<maven.compiler.target>11</maven.compiler.target>
19-
<version.fabric8.client>6.1.1</version.fabric8.client>
20-
<kotlin.version>1.5.20</kotlin.version>
17+
<maven.compiler.source>17</maven.compiler.source>
18+
<maven.compiler.release>17</maven.compiler.release>
19+
<maven.compiler.target>17</maven.compiler.target>
2120
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
22-
<junit.jupiter.version>5.6.0</junit.jupiter.version>
23-
<log4j.version>2.17.2</log4j.version>
24-
<okhttp.version>4.10.0</okhttp.version>
21+
<!-- Dependency versions -->
22+
<jackson.version>2.16.1</jackson.version>
23+
<jakarta.json-api.version>2.1.3</jakarta.json-api.version>
24+
<junit.jupiter.version>5.10.2</junit.jupiter.version>
25+
<junit.platform.version>1.10.2</junit.platform.version>
26+
<kotlin.coroutines.version>1.7.3</kotlin.coroutines.version>
27+
<kotlin.logging.version>3.0.5</kotlin.logging.version>
28+
<kotlin.version>1.9.22</kotlin.version>
29+
<log4j.version>2.22.1</log4j.version>
30+
<okhttp.version>4.12.0</okhttp.version>
31+
<version.fabric8.client>6.10.0</version.fabric8.client>
2532
</properties>
2633

2734
<distributionManagement>
@@ -41,7 +48,7 @@
4148
<dependency>
4249
<groupId>org.jetbrains.kotlinx</groupId>
4350
<artifactId>kotlinx-coroutines-core</artifactId>
44-
<version>1.5.1</version>
51+
<version>${kotlin.coroutines.version}</version>
4552
</dependency>
4653
<!-- https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-reflect -->
4754
<dependency>
@@ -83,12 +90,12 @@
8390
<dependency>
8491
<groupId>io.github.microutils</groupId>
8592
<artifactId>kotlin-logging-jvm</artifactId>
86-
<version>2.0.10</version>
93+
<version>${kotlin.logging.version}</version>
8794
</dependency>
8895
<dependency>
89-
<groupId>javax.json</groupId>
90-
<artifactId>javax.json-api</artifactId>
91-
<version>1.1</version>
96+
<groupId>jakarta.json</groupId>
97+
<artifactId>jakarta.json-api</artifactId>
98+
<version>${jakarta.json-api.version}</version>
9299
</dependency>
93100
<dependency>
94101
<groupId>org.glassfish</groupId>
@@ -98,12 +105,12 @@
98105
<dependency>
99106
<groupId>com.fasterxml.jackson.datatype</groupId>
100107
<artifactId>jackson-datatype-jsr353</artifactId>
101-
<version>2.13.3</version>
108+
<version>${jackson.version}</version>
102109
</dependency>
103110
<dependency>
104111
<groupId>com.fasterxml.jackson.module</groupId>
105112
<artifactId>jackson-module-kotlin</artifactId>
106-
<version>2.13.3</version>
113+
<version>${jackson.version}</version>
107114
</dependency>
108115

109116
<!-- Dependencies for tests -->
@@ -116,13 +123,13 @@
116123
<dependency>
117124
<groupId>org.junit.platform</groupId>
118125
<artifactId>junit-platform-launcher</artifactId>
119-
<version>1.7.0</version>
126+
<version>${junit.platform.version}</version>
120127
<scope>test</scope>
121128
</dependency>
122129
<dependency>
123130
<groupId>org.junit.platform</groupId>
124131
<artifactId>junit-platform-commons</artifactId>
125-
<version>1.7.2</version>
132+
<version>${junit.platform.version}</version>
126133
<scope>test</scope>
127134
</dependency>
128135
<dependency>
@@ -242,8 +249,6 @@
242249
<version>3.0</version>
243250

244251
<executions>
245-
<!--<execution> <id>generate-copyright-headers</id> <phase>process-sources</phase>-->
246-
<!--<goals> <goal>format</goal> </goals> </execution>-->
247252
<execution>
248253
<id>check-copyright-headers</id>
249254
<phase>package</phase>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* ShinyProxy-Operator
3+
*
4+
* Copyright (C) 2021-2023 Open Analytics
5+
*
6+
* ===========================================================================
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the Apache License as published by
10+
* The Apache Software Foundation, either version 2 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* Apache License for more details.
17+
*
18+
* You should have received a copy of the Apache License
19+
* along with this program. If not, see <http://www.apache.org/licenses/>
20+
*/
21+
package eu.openanalytics.shinyproxyoperator
22+
23+
import com.fasterxml.jackson.databind.ObjectMapper
24+
import com.fasterxml.jackson.module.kotlin.registerKotlinModule
25+
import io.fabric8.kubernetes.client.KubernetesClientBuilder
26+
import io.fabric8.kubernetes.client.NamespacedKubernetesClient
27+
import io.fabric8.kubernetes.client.http.HttpClient
28+
import io.fabric8.kubernetes.client.utils.KubernetesSerialization
29+
30+
31+
fun createKubernetesClient(httpClientFactory: HttpClient.Factory? = null): NamespacedKubernetesClient {
32+
val objectMapper = ObjectMapper()
33+
objectMapper.registerKotlinModule()
34+
val kubernetesSerialization = KubernetesSerialization(objectMapper, true);
35+
val builder = KubernetesClientBuilder()
36+
37+
if (httpClientFactory != null) {
38+
builder.withHttpClientFactory(httpClientFactory)
39+
}
40+
41+
return builder.withKubernetesSerialization(kubernetesSerialization)
42+
.build()
43+
.adapt(NamespacedKubernetesClient::class.java)
44+
}

src/main/kotlin/eu/openanalytics/shinyproxyoperator/Operator.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import io.fabric8.kubernetes.api.model.apps.ReplicaSet
4141
import io.fabric8.kubernetes.api.model.apps.ReplicaSetList
4242
import io.fabric8.kubernetes.api.model.networking.v1.Ingress
4343
import io.fabric8.kubernetes.api.model.networking.v1.IngressList
44-
import io.fabric8.kubernetes.client.DefaultKubernetesClient
4544
import io.fabric8.kubernetes.client.KubernetesClientException
4645
import io.fabric8.kubernetes.client.NamespacedKubernetesClient
4746
import io.fabric8.kubernetes.client.dsl.Resource
@@ -77,9 +76,9 @@ class Operator(client: NamespacedKubernetesClient? = null,
7776
val probeFailureThreshold: Int
7877
val probeTimeout: Int
7978
val startupProbeInitialDelay: Int
80-
val processMaxLifetime: Long
8179

82-
val podRetriever: PodRetriever
80+
private val processMaxLifetime: Long
81+
private val podRetriever: PodRetriever
8382
private val shinyProxyClient: ShinyProxyClient
8483
private val recyclableChecker: IRecyclableChecker
8584

@@ -103,7 +102,7 @@ class Operator(client: NamespacedKubernetesClient? = null,
103102
if (client != null) {
104103
this.client = client
105104
} else {
106-
this.client = DefaultKubernetesClient()
105+
this.client = createKubernetesClient()
107106
}
108107

109108
this.mode = readConfigValue(mode, Mode.CLUSTERED, "SPO_MODE") {

src/main/kotlin/eu/openanalytics/shinyproxyoperator/components/ConfigMapFactory.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class ConfigMapFactory(private val kubeClient: KubernetesClient) {
5555
.addToData("application.yml", shinyProxy.specAsYaml)
5656
.build()
5757
//@formatter:on
58-
val createdConfigMap = kubeClient.configMaps().inNamespace(shinyProxy.metadata.namespace).createOrReplace(configMapDefinition)
58+
val createdConfigMap = kubeClient.configMaps().inNamespace(shinyProxy.metadata.namespace).resource(configMapDefinition).serverSideApply()
5959
logger.debug { "${shinyProxy.logPrefix(shinyProxyInstance)} [Component/ConfigMap] Created ${createdConfigMap.metadata.name}" }
6060
}
6161

src/main/kotlin/eu/openanalytics/shinyproxyoperator/components/IngressFactory.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import eu.openanalytics.shinyproxyoperator.crd.ShinyProxyInstance
2525
import io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressPath
2626
import io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressPathBuilder
2727
import io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder
28-
import io.fabric8.kubernetes.api.model.networking.v1.IngressRule
2928
import io.fabric8.kubernetes.api.model.networking.v1.IngressRuleBuilder
3029
import io.fabric8.kubernetes.client.KubernetesClient
3130
import mu.KotlinLogging
@@ -71,7 +70,7 @@ class IngressFactory(private val kubeClient: KubernetesClient) {
7170
//@formatter:on
7271

7372
val patchedIngress = ingressPatcher.patch(ingressDefinition, shinyProxy.parsedIngressPatches)
74-
val createdIngress = kubeClient.network().v1().ingresses().inNamespace(shinyProxy.metadata.namespace).resource(patchedIngress).createOrReplace()
73+
val createdIngress = kubeClient.network().v1().ingresses().inNamespace(shinyProxy.metadata.namespace).resource(patchedIngress).serverSideApply()
7574
logger.debug { "${shinyProxy.logPrefix()} [Component/Ingress] Created ${createdIngress.metadata.name}" }
7675
}
7776

src/main/kotlin/eu/openanalytics/shinyproxyoperator/components/IngressPatcher.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ package eu.openanalytics.shinyproxyoperator.components
2323
import com.fasterxml.jackson.databind.ObjectMapper
2424
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory
2525
import com.fasterxml.jackson.datatype.jsr353.JSR353Module
26-
import io.fabric8.kubernetes.api.model.HTTPGetAction
27-
import io.fabric8.kubernetes.api.model.IntOrString
28-
import io.fabric8.kubernetes.api.model.PodTemplateSpec
2926
import io.fabric8.kubernetes.api.model.networking.v1.Ingress
3027
import mu.KotlinLogging
3128
import javax.json.JsonPatch

src/main/kotlin/eu/openanalytics/shinyproxyoperator/components/ReplicaSetFactory.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ReplicaSetFactory(private val kubeClient: KubernetesClient) {
5858
.build()
5959
//@formatter:on
6060

61-
val createdReplicaSet = kubeClient.apps().replicaSets().inNamespace(shinyProxy.metadata.namespace).createOrReplace(replicaSetDefinition)
61+
val createdReplicaSet = kubeClient.apps().replicaSets().inNamespace(shinyProxy.metadata.namespace).resource(replicaSetDefinition).serverSideApply()
6262
logger.debug { "${shinyProxy.logPrefix(shinyProxyInstance)} [Component/ReplicaSet] Created ${createdReplicaSet.metadata.name}" }
6363
}
6464

src/main/kotlin/eu/openanalytics/shinyproxyoperator/components/ResourceNameFactory.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ package eu.openanalytics.shinyproxyoperator.components
2222

2323
import eu.openanalytics.shinyproxyoperator.crd.ShinyProxy
2424
import eu.openanalytics.shinyproxyoperator.crd.ShinyProxyInstance
25-
import mu.KotlinLogging
2625

2726
object ResourceNameFactory {
2827

29-
const val KUBE_RESOURCE_NAME_MAX_LENGTH = 63
28+
private const val KUBE_RESOURCE_NAME_MAX_LENGTH = 63
3029

3130
fun createNameForConfigMap(shinyProxy: ShinyProxy, shinyProxyInstance: ShinyProxyInstance): String {
3231
return "sp-${shinyProxy.metadata.name}-cm-${shinyProxyInstance.hashOfSpec}".take(KUBE_RESOURCE_NAME_MAX_LENGTH)

src/main/kotlin/eu/openanalytics/shinyproxyoperator/components/ServiceFactory.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class ServiceFactory(private val serviceClient: MixedOperation<Service, ServiceL
6363
.build()
6464
//@formatter:on
6565

66-
val createdService = serviceClient.inNamespace(shinyProxy.metadata.namespace).resource(serviceDefinition).createOrReplace()
66+
val createdService = serviceClient.inNamespace(shinyProxy.metadata.namespace).resource(serviceDefinition).serverSideApply()
6767
logger.debug { "${shinyProxy.logPrefix(latestShinyProxyInstance)} [Component/Service] Created ${createdService.metadata.name}" }
6868
}
6969

src/main/kotlin/eu/openanalytics/shinyproxyoperator/controller/ShinyProxyController.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class ShinyProxyController(private val channel: Channel<ShinyProxyEvent>,
162162
fun tryUpdateStatus() {
163163
val freshShinyProxy = refreshShinyProxy(shinyProxy)
164164
updater(freshShinyProxy)
165-
shinyProxyClient.inNamespace(shinyProxy.metadata.namespace).updateStatus(freshShinyProxy)
165+
shinyProxyClient.inNamespace(shinyProxy.metadata.namespace).resource(freshShinyProxy).updateStatus()
166166
}
167167

168168
for (i in 1..5) {

0 commit comments

Comments
 (0)