diff --git a/functional_tests/scylla_operator/conftest.py b/functional_tests/scylla_operator/conftest.py index af66671f1a..a340c4efb3 100644 --- a/functional_tests/scylla_operator/conftest.py +++ b/functional_tests/scylla_operator/conftest.py @@ -224,9 +224,8 @@ def skip_if_not_supported_scylla_version(request: pytest.FixtureRequest, @pytest.fixture(autouse=True) def skip_based_on_operator_version(request: pytest.FixtureRequest, tester: ScyllaOperatorFunctionalClusterTester): - # pylint: disable=protected-access if required_operator := request.node.get_closest_marker('required_operator'): - current_version = tester.k8s_clusters[0]._scylla_operator_chart_version.split("-")[0] + current_version = tester.k8s_clusters[0].scylla_operator_chart_version.split("-")[0] required_version = required_operator.args[0] if version_utils.ComparableScyllaOperatorVersion(current_version) < required_version: pytest.skip(f"require operator version: {required_version}, current version: {current_version}") diff --git a/functional_tests/scylla_operator/libs/helpers.py b/functional_tests/scylla_operator/libs/helpers.py index 2ac2863adc..6f3f397067 100644 --- a/functional_tests/scylla_operator/libs/helpers.py +++ b/functional_tests/scylla_operator/libs/helpers.py @@ -158,7 +158,7 @@ def reinstall_scylla_manager(db_cluster: ScyllaPodCluster, manager_version: str) log.debug(db_cluster.k8s_cluster.helm_install( target_chart_name="scylla-manager", source_chart_name="scylla-operator/scylla-manager", - version=db_cluster.k8s_cluster._scylla_operator_chart_version, # pylint: disable=protected-access + version=db_cluster.k8s_cluster.scylla_operator_chart_version, use_devel=True, values=values, namespace=SCYLLA_MANAGER_NAMESPACE, diff --git a/functional_tests/scylla_operator/test_functional.py b/functional_tests/scylla_operator/test_functional.py index 52a97ed7be..9c40d55941 100644 --- a/functional_tests/scylla_operator/test_functional.py +++ b/functional_tests/scylla_operator/test_functional.py @@ -105,7 +105,7 @@ def test_deploy_quasi_multidc_db_cluster(db_cluster: ScyllaPodCluster): # pylin target_chart_name2, namespace2 = (f"{cluster_name}-2", ) * 2 dc_name, dc_name2 = (f"quasi-dc-{i}" for i in range(1, 3)) k8s_cluster, kubectl = db_cluster.k8s_cluster, db_cluster.k8s_cluster.kubectl - operator_version = k8s_cluster._scylla_operator_chart_version # pylint: disable=protected-access + operator_version = k8s_cluster.scylla_operator_chart_version need_to_collect_logs = True logdir = f"{os.path.join(k8s_cluster.logdir, 'test_deploy_quasi_multidc_db_cluster')}" values = HelmValues({ @@ -537,7 +537,7 @@ def test_check_operator_operability_when_scylla_crd_is_incorrect(db_cluster): db_cluster.k8s_cluster.helm_install( target_chart_name=target_chart_name, source_chart_name="scylla-operator/scylla", - version=db_cluster.k8s_cluster._scylla_operator_chart_version, # pylint: disable=protected-access + version=db_cluster.k8s_cluster.scylla_operator_chart_version, use_devel=True, values=values, namespace=namespace) @@ -766,7 +766,7 @@ def test_deploy_helm_with_default_values(db_cluster: ScyllaPodCluster): log.debug(db_cluster.k8s_cluster.helm_install( target_chart_name=target_chart_name, source_chart_name="scylla-operator/scylla", - version=db_cluster.k8s_cluster._scylla_operator_chart_version, # pylint: disable=protected-access + version=db_cluster.k8s_cluster.scylla_operator_chart_version, use_devel=True, namespace=namespace, )) diff --git a/sdcm/cluster_k8s/__init__.py b/sdcm/cluster_k8s/__init__.py index 9c3a3acfcc..6abc718412 100644 --- a/sdcm/cluster_k8s/__init__.py +++ b/sdcm/cluster_k8s/__init__.py @@ -562,7 +562,7 @@ def get_latest_chart_version(self, local_chart_path: str) -> str: return current_newest_version_str @cached_property - def _scylla_operator_chart_version(self): + def scylla_operator_chart_version(self): self.log.debug(self.helm( f"repo add scylla-operator {self.params.get('k8s_scylla_operator_helm_repo')}")) @@ -586,7 +586,7 @@ def get_operator_image(self, repo: str = '', chart_version: str = '') -> str: # Get 'appVersion' field from the Helm chart which stores image's tag repo = repo or self.params.get('k8s_scylla_operator_helm_repo') chart_name = "scylla-operator" - chart_version = chart_version or self._scylla_operator_chart_version + chart_version = chart_version or self.scylla_operator_chart_version chart_info = self.helm( f"show chart {chart_name} --devel --repo {repo} --version {chart_version}") for line in chart_info.split("\n"): @@ -663,7 +663,7 @@ def deploy_scylla_manager(self, pool_name: str = None) -> None: self.log.debug(self.helm_install( target_chart_name="scylla-manager", source_chart_name="scylla-operator/scylla-manager", - version=self._scylla_operator_chart_version, + version=self.scylla_operator_chart_version, use_devel=True, values=values, namespace=SCYLLA_MANAGER_NAMESPACE, @@ -721,7 +721,7 @@ def deploy_scylla_operator(self, pool_name: str = None) -> None: affinity_rules["affinity"]["nodeAffinity"]) values = HelmValues(**affinity_rules) if ComparableScyllaOperatorVersion( - self._scylla_operator_chart_version.split("-")[0]) > "1.3.0": + self.scylla_operator_chart_version.split("-")[0]) > "1.3.0": # NOTE: following is supported starting with operator-1.4 values.set("logLevel", 4) @@ -746,20 +746,20 @@ def deploy_scylla_operator(self, pool_name: str = None) -> None: self.log.debug(self.helm_install( target_chart_name="scylla-operator", source_chart_name="scylla-operator/scylla-operator", - version=self._scylla_operator_chart_version, + version=self.scylla_operator_chart_version, use_devel=True, namespace=SCYLLA_OPERATOR_NAMESPACE, values=values )) if self.params.get('k8s_enable_tls') and ComparableScyllaOperatorVersion( - self._scylla_operator_chart_version.split("-")[0]) >= "1.8.0": + self.scylla_operator_chart_version.split("-")[0]) >= "1.8.0": patch_cmd = ('patch deployment scylla-operator --type=json -p=\'[{"op": "add",' '"path": "/spec/template/spec/containers/0/args/-", ' '"value": "--feature-gates=AutomaticTLSCertificates=true" }]\' ') self.kubectl(patch_cmd, namespace=SCYLLA_OPERATOR_NAMESPACE) if self.params.get('k8s_enable_tls') and ComparableScyllaOperatorVersion( - self._scylla_operator_chart_version.split("-")[0]) >= "1.9.0": + self.scylla_operator_chart_version.split("-")[0]) >= "1.9.0": # around 10 keys that need to be cached per cluster crypto_key_buffer_size = self.params.get('k8s_tenants_num') * 10 for flag in (f"--crypto-key-buffer-size-min={crypto_key_buffer_size}", @@ -850,7 +850,7 @@ def upgrade_scylla_operator(self, new_helm_repo: str, values=values, )) if self.params.get('k8s_enable_tls') and ComparableScyllaOperatorVersion( - self._scylla_operator_chart_version.split("-")[0]) >= "1.8.0": + self.scylla_operator_chart_version.split("-")[0]) >= "1.8.0": patch_cmd = ('patch deployment scylla-operator --type=json -p=\'[{"op": "add",' '"path": "/spec/template/spec/containers/0/args/-", ' '"value": "--feature-gates=AutomaticTLSCertificates=true" }]\' ') @@ -925,7 +925,7 @@ def get_scylla_cluster_helm_values(self, cpu_limit, memory_limit, pool_name: str dns_domains = [] expose_options = {} - if ComparableScyllaOperatorVersion(self._scylla_operator_chart_version.split("-")[0]) >= "1.11.0": + if ComparableScyllaOperatorVersion(self.scylla_operator_chart_version.split("-")[0]) >= "1.11.0": if k8s_db_node_service_type := self.params.get("k8s_db_node_service_type"): expose_options["nodeService"] = {"type": k8s_db_node_service_type} for broadcast_direction_type in ("node", "client"): @@ -934,7 +934,7 @@ def get_scylla_cluster_helm_values(self, cpu_limit, memory_limit, pool_name: str expose_options["broadcastOptions"] = {} expose_options["broadcastOptions"][f"{broadcast_direction_type}s"] = {"type": ip_type} if self.params.get('k8s_enable_tls') and ComparableScyllaOperatorVersion( - self._scylla_operator_chart_version.split("-")[0]) >= "1.8.0": + self.scylla_operator_chart_version.split("-")[0]) >= "1.8.0": dns_domains = [f"{cluster_name}.sct.scylladb.com"] expose_options = {"cql": {"ingress": { "annotations": { @@ -1134,7 +1134,7 @@ def prepare_k8s_scylla_nodes( self.log.info("Install DaemonSets required by scylla nodes") scylla_machine_image_args = '--all' - if ComparableScyllaOperatorVersion(self._scylla_operator_chart_version) > "1.5.0": + if ComparableScyllaOperatorVersion(self.scylla_operator_chart_version) > "1.5.0": # NOTE: operator versions newer than v1.5.0 have it's own perf tuning, # so, we should not do anything else than disk setup in such a case. scylla_machine_image_args = '--setup-disks' @@ -1301,7 +1301,7 @@ def deploy_scylla_cluster(self, node_pool_name: str, namespace: str = SCYLLA_NAM self.log.debug(self.helm_install( target_chart_name="scylla", source_chart_name="scylla-operator/scylla", - version=self._scylla_operator_chart_version, + version=self.scylla_operator_chart_version, use_devel=True, values=self.get_scylla_cluster_helm_values( cpu_limit=self.scylla_cpu_limit, diff --git a/sdcm/tester.py b/sdcm/tester.py index a61a4f36c1..8574e3326b 100644 --- a/sdcm/tester.py +++ b/sdcm/tester.py @@ -484,7 +484,7 @@ def argus_collect_packages(self): def generate_operator_packages(self) -> list[Package]: operator_packages = [] if self.k8s_clusters: - operator_helm_chart_version = self.k8s_clusters[0]._scylla_operator_chart_version # pylint: disable=protected-access + operator_helm_chart_version = self.k8s_clusters[0].scylla_operator_chart_version operator_packages.append(Package(name="operator-chart", date="", version=operator_helm_chart_version, revision_id="", build_id=""))