Skip to content

Commit

Permalink
deps: update kubernetesclient to v22.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sschuberth committed Jan 10, 2025
1 parent e5f0362 commit 053e743
Show file tree
Hide file tree
Showing 8 changed files with 188 additions and 279 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ kotestExtensionTestContainers = "2.0.2"
ksp = "2.1.0-1.0.29"
ktor = "3.0.3"
ktorSwaggerUi = "4.1.2"
kubernetesClient = "18.0.1"
kubernetesClient = "22.0.0"
log4j = "2.24.3"
logback = "1.5.16"
micrometer = "1.14.2"
Expand Down
32 changes: 4 additions & 28 deletions kubernetes/jobmonitor/src/main/kotlin/JobHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ internal class JobHandler(
*/
fun deleteJob(jobName: String) {
runCatching {
jobApi.deleteNamespacedJob(jobName, config.namespace, null, null, null, null, null, null)
jobApi.deleteNamespacedJob(jobName, config.namespace).execute()
}.onFailure { e ->
logger.error("Could not remove job '$jobName': $e.")
}
Expand All @@ -198,19 +198,7 @@ internal class JobHandler(
private fun findPodsForJob(jobName: String): List<V1Pod> {
val selector = "job-name=$jobName"

return api.listNamespacedPod(
config.namespace,
null,
null,
null,
null,
selector,
null,
null,
null,
null,
false
).items
return api.listNamespacedPod(config.namespace).labelSelector(selector).watch(false).execute().items
}

/**
Expand All @@ -221,7 +209,7 @@ internal class JobHandler(
pod.metadata?.name?.let { podName ->
logger.info("Deleting pod $podName.")
runCatching {
api.deleteNamespacedPod(podName, config.namespace, null, null, null, null, null, null)
api.deleteNamespacedPod(podName, config.namespace).execute()
}.onFailure { e ->
logger.error("Could not remove pod '$podName': $e.")
}
Expand Down Expand Up @@ -258,17 +246,5 @@ internal class JobHandler(
* Return a list with the jobs in the configured namespace. Apply the given [labelSelector] filter.
*/
private fun listJobs(labelSelector: String?): List<V1Job> =
jobApi.listNamespacedJob(
config.namespace,
null,
null,
null,
null,
labelSelector,
null,
null,
null,
null,
false
).items
jobApi.listNamespacedJob(config.namespace).labelSelector(labelSelector).watch(false).execute().items
}
18 changes: 3 additions & 15 deletions kubernetes/jobmonitor/src/main/kotlin/JobWatchHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ internal class JobWatchHelper(
* jobs using the given [jobApi].
*/
private fun fetchResourceVersion(jobApi: BatchV1Api, namespace: String): String? =
jobApi.listNamespacedJob(namespace, null, false, null, null, null, 1, null, null, null, false)
jobApi.listNamespacedJob(namespace).allowWatchBookmarks(false).limit(1).watch(false).execute()
.metadata?.resourceVersion
}

Expand Down Expand Up @@ -125,20 +125,8 @@ internal class JobWatchHelper(

return Watch.createWatch<V1Job?>(
jobApi.apiClient,
jobApi.listNamespacedJobCall(
namespace,
null,
true,
null,
null,
null,
null,
resourceVersion,
null,
null,
true,
null
),
jobApi.listNamespacedJob(namespace).allowWatchBookmarks(true).resourceVersion(resourceVersion).watch(true)
.buildCall(null),
JOB_TYPE.type
).iterator()
}
Expand Down
Loading

0 comments on commit 053e743

Please sign in to comment.