Skip to content

Commit 9da4315

Browse files
authored
fix: MDC add namespace only if present (#1224)
1 parent b981759 commit 9da4315

File tree

1 file changed

+3
-1
lines changed
  • operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing

1 file changed

+3
-1
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/MDCUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ public static void addResourceInfo(HasMetadata resource) {
2929
MDC.put(API_VERSION, resource.getApiVersion());
3030
MDC.put(KIND, resource.getKind());
3131
MDC.put(NAME, resource.getMetadata().getName());
32-
MDC.put(NAMESPACE, resource.getMetadata().getNamespace());
32+
if (resource.getMetadata().getNamespace() != null) {
33+
MDC.put(NAMESPACE, resource.getMetadata().getNamespace());
34+
}
3335
MDC.put(RESOURCE_VERSION, resource.getMetadata().getResourceVersion());
3436
if (resource.getMetadata().getGeneration() != null) {
3537
MDC.put(GENERATION, resource.getMetadata().getGeneration().toString());

0 commit comments

Comments
 (0)