in flink-kubernetes-operator-api/src/main/java/org/apache/flink/kubernetes/operator/api/validation/CrdCompatibilityChecker.java [78:111]
protected static void checkObjectCompatibility(
String path, JsonNode oldNode, JsonNode newNode) {
checkTypeCompatibility(path, oldNode, newNode);
if (oldNode.has("type")
&& oldNode.get("type").asText().equals("object")
&& oldNode.has("properties")) {
var oldProps = oldNode.get("properties");
var newProps = newNode.get("properties");
var fieldNamesIt = oldProps.fieldNames();
while (fieldNamesIt.hasNext()) {
var field = fieldNamesIt.next();
var fieldPath = path + "." + field;
if (!newProps.has(field)) {
// This field was removed from Kubernetes ObjectMeta v1 in 1.25 as it was unused
// for a long time. If set for any reason (very unlikely as it does nothing),
// the property will be dropped / ignored by the api server.
if (!fieldPath.endsWith(".metadata.clusterName")
// This claims field was removed in Kubernetes 1.28 as it was mistakenly
// added in the first place. For more context please refer to
// https://github.com/kubernetes/api/commit/8b14183
&& !fieldPath.contains(".volumeClaimTemplate.spec.resources.claims")) {
err(fieldPath + " has been removed");
}
} else {
checkObjectCompatibility(fieldPath, oldProps.get(field), newProps.get(field));
}
}
logger.debug("Successfully validated property names for {}", path);
} else {
logger.debug("Successfully validated type for {}", path);
}
}