Skip to content
Snippets Groups Projects
Commit 66d98c96 authored by Sören Henning's avatar Sören Henning
Browse files

Minor code fixes

parent 23378774
No related branches found
No related tags found
2 merge requests!216Code Cleanup and Refactoring,!213Upgrade Quarkus
Pipeline #5694 failed
This commit is part of merge request !213. Comments created here will be created in the context of that merge request.
...@@ -24,11 +24,9 @@ abstract class AbstractStateHandler<T, L, D>( ...@@ -24,11 +24,9 @@ abstract class AbstractStateHandler<T, L, D>(
@Synchronized @Synchronized
override fun setState(resourceName: String, f: (T) -> T?) { override fun setState(resourceName: String, f: (T) -> T?) {
try { try {
this.crdClient val resource = this.crdClient.withName(resourceName).get()
.list().items val resourcePatched = f(resource)
.filter { it.metadata.name == resourceName } this.crdClient.patchStatus(resourcePatched)
.map { customResource -> f(customResource) }
.forEach { this.crdClient.updateStatus(it) }
} catch (e: KubernetesClientException) { } catch (e: KubernetesClientException) {
logger.warn { "Status cannot be set for resource $resourceName" } logger.warn { "Status cannot be set for resource $resourceName" }
} }
......
...@@ -26,7 +26,7 @@ class ExecutionHandler( ...@@ -26,7 +26,7 @@ class ExecutionHandler(
/** /**
* Add an execution to the end of the queue of the TheodoliteController. * Add an execution to the end of the queue of the TheodoliteController.
* *
* @param ExecutionCRD the execution to add * @param execution the execution to add
*/ */
@Synchronized @Synchronized
override fun onAdd(execution: ExecutionCRD) { override fun onAdd(execution: ExecutionCRD) {
...@@ -48,8 +48,8 @@ class ExecutionHandler( ...@@ -48,8 +48,8 @@ class ExecutionHandler(
* added to the beginning of the queue of the TheodoliteController. * added to the beginning of the queue of the TheodoliteController.
* Otherwise, it is just added to the beginning of the queue. * Otherwise, it is just added to the beginning of the queue.
* *
* @param oldExecutionCRD the old execution * @param oldExecution the old execution
* @param newExecutionCRD the new execution * @param newExecution the new execution
*/ */
@Synchronized @Synchronized
override fun onUpdate(oldExecution: ExecutionCRD, newExecution: ExecutionCRD) { override fun onUpdate(oldExecution: ExecutionCRD, newExecution: ExecutionCRD) {
...@@ -74,7 +74,7 @@ class ExecutionHandler( ...@@ -74,7 +74,7 @@ class ExecutionHandler(
/** /**
* Delete an execution from the queue of the TheodoliteController. * Delete an execution from the queue of the TheodoliteController.
* *
* @param ExecutionCRD the execution to delete * @param execution the execution to delete
*/ */
@Synchronized @Synchronized
override fun onDelete(execution: ExecutionCRD, b: Boolean) { override fun onDelete(execution: ExecutionCRD, b: Boolean) {
......
...@@ -96,10 +96,9 @@ class ResourceByLabelHandler(private val client: NamespacedKubernetesClient) { ...@@ -96,10 +96,9 @@ class ResourceByLabelHandler(private val client: NamespacedKubernetesClient) {
/** /**
* Block until all pods with are deleted * Block until all pods with are deleted
* *
* @param [labelName] the label name * @param matchLabels Map of label keys to label values to be deleted
* @param [labelValue] the value of this label
* */ * */
fun blockUntilPodsDeleted(matchLabels: MutableMap<String, String>) { fun blockUntilPodsDeleted(matchLabels: Map<String, String>) {
while ( while (
!this.client !this.client
.pods() .pods()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment