When users - for example after incorrect upgrade - ends up with CO deployment with missing or misconfigured environment variable for image configuration they currently get this cryptic exception:
Exception in thread "main" io.strimzi.operator.common.InvalidConfigurationException: io.strimzi.operator.cluster.model.NoImageException: No image for version 2.4.0 at io.strimzi.operator.cluster.ClusterOperatorConfig.parseKafkaVersions(ClusterOperatorConfig.java:204) at io.strimzi.operator.cluster.ClusterOperatorConfig.fromMap(ClusterOperatorConfig.java:94) at io.strimzi.operator.cluster.Main.main(Main.java:59) Caused by: io.strimzi.operator.cluster.model.NoImageException: No image for version 2.4.0 at io.strimzi.operator.cluster.model.KafkaVersion$Lookup.image(KafkaVersion.java:163) at io.strimzi.operator.cluster.model.KafkaVersion$Lookup.validateKafkaMirrorMaker2Images(KafkaVersion.java:321) at io.strimzi.operator.cluster.ClusterOperatorConfig.parseKafkaVersions(ClusterOperatorConfig.java:202)
That doesn't really tell them much about the issue. Thsi PR improves the exception to make it more clear where the issue is:
Exception in thread "main" io.strimzi.operator.common.InvalidConfigurationException: Failed to parse default container image configuration for Kafka Mirror Maker 2 from environment variable STRIMZI_KAFKA_MIRROR_MAKER_2_IMAGES at io.strimzi.operator.cluster.ClusterOperatorConfig.parseKafkaVersions(ClusterOperatorConfig.java:222) at io.strimzi.operator.cluster.ClusterOperatorConfig.fromMap(ClusterOperatorConfig.java:94) at io.strimzi.operator.cluster.Main.main(Main.java:59) Caused by: io.strimzi.operator.cluster.model.NoImageException: No image for version 2.4.0 at io.strimzi.operator.cluster.model.KafkaVersion$Lookup.image(KafkaVersion.java:163) at io.strimzi.operator.cluster.model.KafkaVersion$Lookup.validateKafkaMirrorMaker2Images(KafkaVersion.java:321) at io.strimzi.operator.cluster.ClusterOperatorConfig.parseKafkaVersions(ClusterOperatorConfig.java:220) ... 2 more
This should help users better identify the problems.