Skip to content

Commit 2c50839

Browse files
authored
improve: glue label naming (#89)
Signed-off-by: Attila Mészáros <[email protected]>
1 parent 9aab03f commit 2c50839

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

docs/reference.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,16 @@ custom resource tracked, so if there is a label selector defined for `Glue` it n
130130
to the `Glue` resource when it is created. Since it is not trivial to parse label selectors, in more
131131
complex forms of label selectors (other the ones mentioned above), the labels to add to the `Glue` resources
132132
by a `GlueOperator` needs to be specified explicitly using
133-
[`glue.operator.glue-operator-managed-glue-labels`](https://github.com/csviri/kubernetes-glue-operator/blob/main/src/main/java/io/csviri/operator/glue/ControllerConfig.java#L10-L10)
133+
[`glue.operator.glue-operator-managed-glue-label`](https://github.com/csviri/kubernetes-glue-operator/blob/main/src/main/java/io/csviri/operator/glue/ControllerConfig.java#L10-L10)
134134
config key (which is a type of map). Therefore, for a label selector that specified two values for a glue:
135135

136136
`quarkus.operator-sdk.controllers.glue.selector=mylabel1=value1,mylabel2=value2`
137137

138138
you need to add the following configuration params:
139139

140-
`glue.operator.glue-operator-managed-glue-labels.mylabel1=value1`
140+
`glue.operator.glue-operator-managed-glue-label.mylabel1=value1`
141141

142-
`glue.operator.glue-operator-managed-glue-labels.mylabel2=value2`
142+
`glue.operator.glue-operator-managed-glue-label.mylabel2=value2`
143143

144144
This will ensure that the labels are added correctly to the `Glue`. See the related
145145
[integration test](https://github.com/csviri/kubernetes-glue-operator/blob/main/src/test/java/io/csviri/operator/glue/GlueOperatorComplexLabelSelectorTest.java#L23-L23).

src/main/java/io/csviri/operator/glue/ControllerConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
@ConfigMapping(prefix = "glue.operator")
88
public interface ControllerConfig {
99

10-
Map<String, String> glueOperatorManagedGlueLabels();
10+
Map<String, String> glueOperatorManagedGlueLabel();
1111

1212
}

src/main/java/io/csviri/operator/glue/reconciler/operator/GlueOperatorReconciler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,15 @@ public static String glueName(String name, String kind) {
190190

191191
private Map<String, String> initDefaultLabelsToAddToGlue() {
192192
Map<String, String> res = new HashMap<>();
193-
if (!controllerConfig.glueOperatorManagedGlueLabels().isEmpty()) {
194-
res.putAll(controllerConfig.glueOperatorManagedGlueLabels());
193+
if (!controllerConfig.glueOperatorManagedGlueLabel().isEmpty()) {
194+
res.putAll(controllerConfig.glueOperatorManagedGlueLabel());
195195
} else {
196196
glueLabelSelector.ifPresent(ls -> {
197197
if (ls.contains(",") || ls.contains("(")) {
198198
throw new GlueException(
199199
"Glue reconciler label selector contains non-simple label selector: " + ls +
200200
". Specify Glue label selector in simple form ('key=value' or 'key') " +
201-
"or configure 'glue.operator.glue-operator-managed-glue-labels'");
201+
"or configure 'glue.operator.glue-operator-managed-glue-label'");
202202
}
203203
String[] labelSelectorParts = ls.split("=");
204204
if (labelSelectorParts.length > 2) {

src/test/java/io/csviri/operator/glue/GlueOperatorComplexLabelSelectorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public Map<String, String> getConfigOverrides() {
6464
// complex label selector with 2 values checked
6565
GLUE_LABEL_KEY1 + "=" + LABEL_VALUE + "," + GLUE_LABEL_KEY2 + "=" + LABEL_VALUE,
6666
// explicit labels added to glue
67-
"glue.operator.glue-operator-managed-glue-labels." + GLUE_LABEL_KEY1, LABEL_VALUE,
68-
"glue.operator.glue-operator-managed-glue-labels." + GLUE_LABEL_KEY2, LABEL_VALUE);
67+
"glue.operator.glue-operator-managed-glue-label." + GLUE_LABEL_KEY1, LABEL_VALUE,
68+
"glue.operator.glue-operator-managed-glue-label." + GLUE_LABEL_KEY2, LABEL_VALUE);
6969
}
7070
}
7171

0 commit comments

Comments
 (0)