morhidi commented on code in PR #271: URL: https://github.com/apache/flink-kubernetes-operator/pull/271#discussion_r901588885
########## flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/ReconciliationUtils.java: ########## @@ -229,24 +227,32 @@ private static boolean upgradeStarted( || currentReconState == ReconciliationState.UPGRADING; } - public static <T> T deserializedSpecWithVersion( + public static <T> Tuple2<T, ObjectNode> deserializeSpecWithMeta( @Nullable String specString, Class<T> specClass) { if (specString == null) { return null; } try { ObjectNode objectNode = (ObjectNode) objectMapper.readTree(specString); + ObjectNode internalMeta = (ObjectNode) objectNode.remove(INTERNAL_METADATA_JSON_KEY); + + // backward compatibility objectNode.remove("apiVersion"); - return objectMapper.treeToValue(objectNode, specClass); + + return Tuple2.of(objectMapper.treeToValue(objectNode, specClass), internalMeta); } catch (JsonProcessingException e) { throw new RuntimeException("Could not deserialize spec, this indicates a bug...", e); } } - public static String writeSpecWithCurrentVersion(Object spec) { + public static String writeSpecWithMeta( Review Comment: How about introducing a wrapper object here instead of modifying the objectnode? -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org