csviri commented on code in PR #1192:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/1192#discussion_r4707973365
##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/EventRecorder.java:
##########
@@ -226,7 +257,47 @@ public void triggerEventWithLabels(
messageKey,
interval,
dedupePredicate,
- labels);
+ mergeWithCommonLabels(labels));
+ }
+
+ /**
+ * Merge the caller provided labels with the globally configured ones.
Caller provided labels
+ * take precedence as they may carry functional information such as dedupe
state.
+ *
+ * @return the merged labels or null if there is nothing to set.
+ */
+ @Nullable
+ private Map<String, String> mergeWithCommonLabels(@Nullable Map<String,
String> labels) {
+ if (commonLabels.isEmpty()) {
+ return labels;
+ }
+ if (labels == null || labels.isEmpty()) {
+ return commonLabels;
+ }
+ var merged = new HashMap<>(commonLabels);
+ merged.putAll(labels);
+ return merged;
+ }
+
+ /**
+ * Drop label entries that Kubernetes would reject. A single invalid entry
coming from the
+ * operator config would otherwise fail the creation of every event.
+ */
+ @VisibleForTesting
+ static Map<String, String> validateLabels(Map<String, String> labels) {
Review Comment:
renamed it to `dropInvalidLabels`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]