bbende commented on code in PR #10619:
URL: https://github.com/apache/nifi/pull/10619#discussion_r2641138931
##########
nifi-framework-bundle/nifi-framework-extensions/nifi-framework-kubernetes-bundle/nifi-framework-kubernetes-state-provider/src/main/java/org/apache/nifi/kubernetes/state/provider/KubernetesConfigMapStateProvider.java:
##########
@@ -411,15 +381,28 @@ private Resource<ConfigMap> configMapResource(final
String componentId) {
return
kubernetesClient.configMaps().inNamespace(namespace).withName(name);
}
- private ConfigMapBuilder createConfigMapBuilder(final Map<String, String>
state, final String componentId) {
- final Map<String, String> encodedData = getEncodedMap(state);
+ private ConfigMapBuilder createConfigMapBuilder(final Map<String, String>
state, final String componentId, final Optional<ObjectMeta> existingMetadata) {
final String name = getConfigMapName(componentId);
- return new ConfigMapBuilder()
+
+ final ConfigMapBuilder configMapBuilder;
+ if (existingMetadata.isPresent()) {
+ if (!namespace.equals(existingMetadata.get().getNamespace())) {
+ throw new IllegalArgumentException("Expected existing
ConfigMap namespace [%s], but was [%s]".formatted(namespace,
existingMetadata.get().getNamespace()));
+ }
+ if (!name.equals(existingMetadata.get().getName())) {
+ throw new IllegalArgumentException("Expected existing
ConfigMap name [%s], but was [%s]".formatted(name,
existingMetadata.get().getName()));
+ }
Review Comment:
It is very unlikely
--
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]