From 34b1a9e37184c27160a3e87b83dd1e85c3d709c3 Mon Sep 17 00:00:00 2001
From: "stu126940@mail.uni-kiel.de" <stu126940@mail.uni-kiel.de>
Date: Tue, 15 Feb 2022 13:47:17 +0100
Subject: [PATCH] Add documentation for the *label patcher

---
 docs/api-reference/patchers.md                | 21 +++++++++++++++++++
 .../theodolite/patcher/MatchLabelPatcher.kt   |  6 ++++++
 .../patcher/TemplateLabelPatcher.kt           |  6 ++++++
 3 files changed, 33 insertions(+)

diff --git a/docs/api-reference/patchers.md b/docs/api-reference/patchers.md
index 77f937e38..b53d76d4b 100644
--- a/docs/api-reference/patchers.md
+++ b/docs/api-reference/patchers.md
@@ -53,6 +53,27 @@ Patchers can be seen as functions which take a value as input and modify a Kuber
   * **resource**: "uc1-kstreams-deployment.yaml"
   * **example value**: "random-scheduler"
 
+* **LabelPatcher**: Changes the label of a Kubernetes Deployment or StatefulSet. The patches field is: `metadata.labels`
+  * **type**: "LabelPatcher"
+  * **resource**: "uc1-kstreams-deployment.yaml"
+  * **properties**:
+    * variableName: "app"
+  * **example value**: "theodolite-sut"
+
+* **MatchLabelPatcher**: Changes the match labels of a Kubernetes Deployment or StatefulSet. The patches field is: `spec.selector.matchLabels`
+  * **type**: "MatchLabelPatcher"
+  * **resource**: "uc1-kstreams-deployment.yaml"
+  * **properties**:
+    * variableName: "app"
+  * **example value**: "theodolite-sut"
+
+* **TemplateLabelPatcher**: Changes the template labels of a Kubernetes Deployment or StatefulSet. The patches field is: `spec.template.metadata.labels`
+  * **type**: "MatchLabelPatcher"
+  * **resource**: "uc1-kstreams-deployment.yaml"
+  * **properties**:
+    * variableName: "app"
+  * **example value**: "theodolite-sut"
+
 * **ImagePatcher**: Changes the image of a Kubernetes resource. **Currently not fully implemented.**
   * **type**: "ImagePatcher"
   * **resource**: "uc1-kstreams-deployment.yaml"
diff --git a/theodolite/src/main/kotlin/theodolite/patcher/MatchLabelPatcher.kt b/theodolite/src/main/kotlin/theodolite/patcher/MatchLabelPatcher.kt
index 1ef6b915a..30ff73b5d 100644
--- a/theodolite/src/main/kotlin/theodolite/patcher/MatchLabelPatcher.kt
+++ b/theodolite/src/main/kotlin/theodolite/patcher/MatchLabelPatcher.kt
@@ -4,6 +4,12 @@ import io.fabric8.kubernetes.api.model.KubernetesResource
 import io.fabric8.kubernetes.api.model.apps.Deployment
 import io.fabric8.kubernetes.api.model.apps.StatefulSet
 
+/**
+ * This patcher is able to set the `spec.selector.matchLabels` for a `Deployment` or `StatefulSet` Kubernetes resource.
+ *
+ * @property k8sResource The Kubernetes manifests to patch
+ * @property variableName The matchLabel which should be set
+ */
 class MatchLabelPatcher(private val k8sResource: KubernetesResource, val variableName: String) :
     AbstractPatcher(k8sResource) {
 
diff --git a/theodolite/src/main/kotlin/theodolite/patcher/TemplateLabelPatcher.kt b/theodolite/src/main/kotlin/theodolite/patcher/TemplateLabelPatcher.kt
index aa1fc8f17..a524e5c40 100644
--- a/theodolite/src/main/kotlin/theodolite/patcher/TemplateLabelPatcher.kt
+++ b/theodolite/src/main/kotlin/theodolite/patcher/TemplateLabelPatcher.kt
@@ -4,6 +4,12 @@ import io.fabric8.kubernetes.api.model.KubernetesResource
 import io.fabric8.kubernetes.api.model.apps.Deployment
 import io.fabric8.kubernetes.api.model.apps.StatefulSet
 
+/**
+ * This patcher is able to set the field `spec.template.metadata.labels` for a `Deployment` or `StatefulSet` Kubernetes resource.
+ *
+ * @property k8sResource The Kubernetes manifests to patch
+ * @property variableName The label which should be set
+ */
 class TemplateLabelPatcher(private val k8sResource: KubernetesResource, val variableName: String) :
     AbstractPatcher(k8sResource) {
 
-- 
GitLab