Orange-OpenSource / casskop

This Kubernetes operator automates the Cassandra operations such as deploying a new rack aware cluster, adding/removing nodes, configuring the C* and JVM parameters, upgrading JVM and C* versions, and many more...
https://orange-opensource.github.io/casskop/
Apache License 2.0
183 stars 54 forks source link

Casskop incorrectly determine version of image in case if image repository contains custom port #374

Closed ibumarskov closed 2 years ago

ibumarskov commented 2 years ago

Bug Report

If we don't explicitly specify the serverVersion in CR, operator should parse this value from image name. Some deployments can contains proxy for image repository and in this case image name can looks like: cassandraImage: '127.0.0.1:44301/tungsten/cassandra:3.11.6'

In this case operator can't detect version due to incorrect logic and leave _PRODUCTVERSION env variable empty: https://github.com/Orange-OpenSource/casskop/blob/2d00f1ab1950226b13309e5b633a1bf2ebcd86b6/pkg/controller/cassandracluster/generator.go#L634 it's lead to error in config-builder init container.

Environment

Possible Solution Change appropriate code in following way: if serverVersion == "" { if len(image) >= 2 { version := strings.Split(image[len(image)-1], "-") serverVersion = version[0] if len(version) != 1 { serverVersion += ".0" } } }

fdehay commented 2 years ago

hello @ibumarskov, Thanks for reporting your issue and providing a fix for it :) As I said in an earlier issue, Casskop is in a complex state with little support from Orange at this stage. Let's talk in the PR thread :)