Skip to content

Commit 8c1ccfb

Browse files
fruchactions-user
authored andcommitted
chore(serverless): remove cloud_config option
since scylla-driver is going to remove this configuration option we are removing it from SCT code Ref: scylladb/python-driver#590 (cherry picked from commit 0b4a70a)
1 parent 6e1d2d4 commit 8c1ccfb

File tree

10 files changed

+29
-254
lines changed

10 files changed

+29
-254
lines changed

docs/configuration_options.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,15 +2022,6 @@ Defines whether we enable the alternator feature using scylla-operator or not.
20222022
**type:** boolean
20232023

20242024

2025-
## **k8s_connection_bundle_file** / SCT_K8S_CONNECTION_BUNDLE_FILE
2026-
2027-
Serverless configuration bundle file
2028-
2029-
**default:** N/A
2030-
2031-
**type:** _file
2032-
2033-
20342025
## **k8s_db_node_service_type** / SCT_K8S_DB_NODE_SERVICE_TYPE
20352026

20362027
Defines the type of the K8S 'Service' objects type used for ScyllaDB pods. Empty value means 'do not set and allow scylla-operator to choose'.

functional_tests/scylla_operator/test_functional.py

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,74 +1004,6 @@ def test_operator_managed_tls(db_cluster: ScyllaPodCluster, tmp_path: path.Path)
10041004
log.debug(output)
10051005

10061006

1007-
@pytest.mark.required_operator("v1.8.0")
1008-
@pytest.mark.requires_tls_and_sni
1009-
def test_cloud_bundle_connectivity_python(db_cluster: ScyllaPodCluster):
1010-
1011-
assert db_cluster.connection_bundle_file, "cloud bundle wasn't found"
1012-
1013-
with db_cluster.cql_connection_patient(db_cluster.nodes[0]) as session:
1014-
res = session.execute("SELECT * FROM system.local")
1015-
output = res.all()
1016-
log.debug(output)
1017-
assert len(output) == 1
1018-
1019-
1020-
@pytest.mark.required_operator("v1.8.0")
1021-
@pytest.mark.requires_tls_and_sni
1022-
def test_cloud_bundle_connectivity_cassandra_stress(tester):
1023-
1024-
assert tester.db_cluster.connection_bundle_file, "cloud bundle wasn't found"
1025-
1026-
cmd = (
1027-
"""cassandra-stress write cl=ONE duration=1m -schema 'replication(strategy=NetworkTopologyStrategy,replication_factor=1) """
1028-
"""compaction(strategy=SizeTieredCompactionStrategy)' -mode cql3 native """
1029-
"""-rate threads=10 -pop seq=1..10000000 -log interval=5"""
1030-
)
1031-
1032-
stress_obj = tester.run_stress_thread(cmd, stop_test_on_failure=False)
1033-
output, _ = stress_obj.parse_results()
1034-
1035-
assert "latency mean" in output[0]
1036-
assert float(output[0]["latency mean"]) > 0
1037-
1038-
assert "latency 99th percentile" in output[0]
1039-
assert float(output[0]["latency 99th percentile"]) > 0
1040-
1041-
1042-
@pytest.mark.required_operator("v1.8.0")
1043-
@pytest.mark.requires_tls_and_sni
1044-
def test_cloud_bundle_connectivity_scylla_bench(tester):
1045-
1046-
assert tester.db_cluster.connection_bundle_file, "cloud bundle wasn't found"
1047-
1048-
cmd = (
1049-
"scylla-bench -workload=sequential -mode=write -replication-factor=1 -partition-count=10 "
1050-
"-clustering-row-count=5555 -clustering-row-size=uniform:10..20 -concurrency=10 "
1051-
"-connection-count=10 -consistency-level=one -rows-per-request=10 -timeout=60s -duration=1m"
1052-
)
1053-
1054-
stress_obj = tester.run_stress_thread(cmd, stop_test_on_failure=False)
1055-
summaries, errors = stress_obj.parse_results()
1056-
assert not errors
1057-
assert summaries[0]["Clustering row size"] == "Uniform(min=10, max=20)"
1058-
1059-
# TODO: add verification that the output say it's using the cloud bundle
1060-
# (need to add that to log output in scylla-bench)
1061-
1062-
1063-
@pytest.mark.required_operator("v1.8.0")
1064-
@pytest.mark.requires_tls_and_sni
1065-
def test_cloud_bundle_connectivity_cqlsh(db_cluster: ScyllaPodCluster):
1066-
1067-
assert db_cluster.connection_bundle_file, "cloud bundle wasn't found"
1068-
1069-
res = db_cluster.nodes[0].run_cqlsh("SELECT * FROM system.local")
1070-
1071-
assert not res.stderr
1072-
assert '(1 rows)' in res.stdout
1073-
1074-
10751007
def test_can_recover_from_fatal_pod_termination(db_cluster):
10761008
target_node = db_cluster.nodes[-1]
10771009
experiment = PodFailureExperiment(pod=target_node, duration="60s")

sdcm/cluster.py

Lines changed: 10 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
from cassandra.cluster import Cluster as ClusterDriver
5757
from cassandra.cluster import NoHostAvailable
5858
from cassandra.policies import RetryPolicy
59-
from cassandra.policies import WhiteListRoundRobinPolicy, HostFilterPolicy, RoundRobinPolicy, RackAwareRoundRobinPolicy, LoadBalancingPolicy
59+
from cassandra.policies import WhiteListRoundRobinPolicy, RackAwareRoundRobinPolicy, LoadBalancingPolicy
6060
from cassandra.query import SimpleStatement
6161
from argus.common.enums import ResourceState
6262
from argus.client.sct.types import LogLink
@@ -2937,10 +2937,6 @@ def print_node_running_nemesis(self, node_ip):
29372937

29382938
return f' ({node.running_nemesis} nemesis target node)' if node.running_nemesis else ' (not target node)'
29392939

2940-
@property
2941-
def is_cqlsh_support_cloud_bundle(self):
2942-
return bool(self.parent_cluster.connection_bundle_file)
2943-
29442940
@property
29452941
def is_replacement_by_host_id_supported(self):
29462942
return ComparableScyllaVersion(self.scylla_version) > '5.2.0~dev'
@@ -2962,12 +2958,6 @@ def _gen_cqlsh_cmd(self, command, keyspace, timeout, connect_timeout):
29622958
command = '"{}"'.format(command.strip().replace('"', '\\"'))
29632959

29642960
cqlsh_cmd = self.add_install_prefix('/usr/bin/cqlsh')
2965-
if self.is_cqlsh_support_cloud_bundle:
2966-
connection_bundle_file = self.parent_cluster.connection_bundle_file
2967-
target_connection_bundle_file = str(Path('/tmp/') / connection_bundle_file.name)
2968-
self.remoter.send_files(str(connection_bundle_file), target_connection_bundle_file)
2969-
2970-
return f'{cqlsh_cmd} {options} -e {command} --cloudconf {target_connection_bundle_file}'
29712961
return f'{cqlsh_cmd} {options} -e {command} {host}'
29722962

29732963
def run_cqlsh(self, cmd, keyspace=None, timeout=120, verbose=True, split=False, connect_timeout=60,
@@ -3677,7 +3667,7 @@ def create_ssl_context(keyfile: str, certfile: str, truststore: str):
36773667
return ssl_context
36783668

36793669
def _create_session(self, node, keyspace, user, password, compression, protocol_version, load_balancing_policy=None, port=None, # noqa: PLR0913
3680-
ssl_context=None, node_ips=None, connect_timeout=None, verbose=True, connection_bundle_file=None):
3670+
ssl_context=None, node_ips=None, connect_timeout=None, verbose=True):
36813671
if not port:
36823672
port = node.CQL_PORT
36833673

@@ -3703,8 +3693,6 @@ def _create_session(self, node, keyspace, user, password, compression, protocol_
37033693
self.log.debug("ssl_context: %s", str(ssl_context))
37043694

37053695
kwargs = dict(contact_points=node_ips, port=port, ssl_context=ssl_context)
3706-
if connection_bundle_file:
3707-
kwargs = dict(scylla_cloud=connection_bundle_file)
37083696
cluster_driver = ClusterDriver(auth_provider=auth_provider,
37093697
compression=compression,
37103698
protocol_version=protocol_version,
@@ -3798,43 +3786,24 @@ def cql_connection(self, node, keyspace=None, user=None,
37983786
- If a connection bundle file is available in the parent cluster, it will be used for the connection.
37993787
- If no connection bundle file is provided, the method will use the WhiteListRoundRobinPolicy with the specified nodes.
38003788
"""
3801-
if connection_bundle_file := node.parent_cluster.connection_bundle_file:
3802-
wlrr = None
3803-
node_ips = []
3804-
else:
3805-
wlrr, node_ips = self.get_load_balancing_policy(whitelist_nodes=whitelist_nodes)
38063789

3790+
wlrr, node_ips = self.get_load_balancing_policy(whitelist_nodes=whitelist_nodes)
38073791
return self._create_session(node=node, keyspace=keyspace, user=user, password=password, compression=compression,
38083792
protocol_version=protocol_version, load_balancing_policy=wlrr, port=port, ssl_context=ssl_context,
3809-
node_ips=node_ips, connect_timeout=connect_timeout, verbose=verbose,
3810-
connection_bundle_file=connection_bundle_file)
3793+
node_ips=node_ips, connect_timeout=connect_timeout, verbose=verbose)
38113794

38123795
def cql_connection_exclusive(self, node, keyspace=None, user=None,
38133796
password=None, compression=True,
38143797
protocol_version=None, port=None,
38153798
ssl_context=None, connect_timeout=100, verbose=True):
3816-
if connection_bundle_file := node.parent_cluster.connection_bundle_file:
3817-
# TODO: handle the case of multiple datacenters
3818-
bundle_yaml = yaml.safe_load(connection_bundle_file.open('r', encoding='utf-8'))
3819-
node_domain = None
3820-
for _, connection_data in bundle_yaml.get('datacenters', {}).items():
3821-
node_domain = connection_data.get('nodeDomain').strip()
3822-
assert node_domain, f"didn't found nodeDomain in bundle [{connection_bundle_file}]"
3823-
3824-
def host_filter(host):
3825-
return str(host.host_id) == str(node.host_id) or node_domain == host.endpoint._server_name
3826-
wlrr = HostFilterPolicy(child_policy=RoundRobinPolicy(), predicate=host_filter)
3827-
node_ips = []
3828-
else:
3829-
# Use WhiteListRoundRobinPolicy with a single node IP.
3830-
# RackAwareRoundRobinPolicy is not applicable for exclusive node connections,
3831-
# as it operates based on rack and datacenter, not individual nodes.
3832-
node_ips = [node.cql_address]
3833-
wlrr = WhiteListRoundRobinPolicy(node_ips)
3799+
# Use WhiteListRoundRobinPolicy with a single node IP.
3800+
# RackAwareRoundRobinPolicy is not applicable for exclusive node connections,
3801+
# as it operates based on rack and datacenter, not individual nodes.
3802+
node_ips = [node.cql_address]
3803+
wlrr = WhiteListRoundRobinPolicy(node_ips)
38343804
return self._create_session(node=node, keyspace=keyspace, user=user, password=password, compression=compression,
38353805
protocol_version=protocol_version, load_balancing_policy=wlrr, port=port, ssl_context=ssl_context,
3836-
node_ips=node_ips, connect_timeout=connect_timeout, verbose=verbose,
3837-
connection_bundle_file=connection_bundle_file)
3806+
node_ips=node_ips, connect_timeout=connect_timeout, verbose=verbose)
38383807

38393808
@retrying(n=8, sleep_time=15, allowed_exceptions=(NoHostAvailable,))
38403809
def cql_connection_patient(self, node, keyspace=None,
@@ -4316,11 +4285,6 @@ def proposed_scylla_yaml(self) -> ScyllaYaml:
43164285
)
43174286
return ScyllaYaml(**cluster_params_builder.model_dump(exclude_unset=True, exclude_none=True))
43184287

4319-
@property
4320-
def connection_bundle_file(self) -> Path | None:
4321-
bundle_file = self.params.get("k8s_connection_bundle_file")
4322-
return Path(bundle_file) if bundle_file else None
4323-
43244288
@property
43254289
def racks(self) -> Set[int]:
43264290
return {node.rack for node in self.nodes}

sdcm/cluster_k8s/__init__.py

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2682,51 +2682,6 @@ def seed_nodes_addresses(self):
26822682
def seed_nodes(self):
26832683
return []
26842684

2685-
@cached_property
2686-
def connection_bundle_file(self) -> Path | None:
2687-
if bundle_file := super().connection_bundle_file:
2688-
return bundle_file
2689-
2690-
# TODO: support multiDC case
2691-
k8s_cluster = self.k8s_clusters[0]
2692-
bundle_cmd_output = k8s_cluster.kubectl(
2693-
f"get secret/{self.scylla_cluster_name}-local-cql-connection-configs-admin"
2694-
f" --template='{{{{ index .data \"{self.scylla_cluster_name}.sct.scylladb.com\" }}}}'",
2695-
namespace=self.namespace, ignore_status=True)
2696-
2697-
if bundle_cmd_output.failed:
2698-
return None
2699-
2700-
fd, file_name = tempfile.mkstemp(suffix='.yaml')
2701-
os.close(fd)
2702-
bundle_file = Path(file_name)
2703-
bundle_file.write_bytes(base64.decodebytes(bytes(bundle_cmd_output.stdout.strip(), encoding='utf-8')))
2704-
2705-
lb_external_hostname = k8s_cluster.kubectl(
2706-
"get service/haproxy-kubernetes-ingress "
2707-
"-o jsonpath='{.status.loadBalancer.ingress[0].hostname}'",
2708-
namespace=INGRESS_CONTROLLER_NAMESPACE)
2709-
2710-
sni_address = None
2711-
if not (lb_external_hostname.ok and lb_external_hostname.stdout):
2712-
lb_cluster_ip = k8s_cluster.kubectl(
2713-
"get service/haproxy-kubernetes-ingress --template='{{ index .spec.clusterIP }}'",
2714-
namespace=INGRESS_CONTROLLER_NAMESPACE)
2715-
if lb_cluster_ip.ok:
2716-
sni_address = lb_cluster_ip.stdout
2717-
else:
2718-
sni_address = lb_external_hostname.stdout
2719-
2720-
if sni_address:
2721-
# TODO: handle the case of multiple datacenters
2722-
# need to get the cluster ip from each k8s cluster
2723-
bundle_yaml = yaml.safe_load(bundle_file.open('r', encoding='utf-8'))
2724-
for _, connection_data in bundle_yaml.get('datacenters', {}).items():
2725-
connection_data['server'] = f'{sni_address.strip()}:9142'
2726-
yaml.dump(bundle_yaml, bundle_file.open('w', encoding='utf-8'))
2727-
2728-
return bundle_file
2729-
27302685
def node_setup(self, node: BaseScyllaPodContainer, verbose: bool = False, timeout: int = 3600):
27312686
if self.test_config.BACKTRACE_DECODING:
27322687
node.install_scylla_debuginfo()

sdcm/sct_config.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,9 +1070,6 @@ class SCTConfiguration(dict):
10701070
dict(name="k8s_enable_alternator", env="SCT_K8S_ENABLE_ALTERNATOR", type=boolean,
10711071
help="Defines whether we enable the alternator feature using scylla-operator or not."),
10721072

1073-
dict(name="k8s_connection_bundle_file", env="SCT_K8S_CONNECTION_BUNDLE_FILE", type=_file,
1074-
help="Serverless configuration bundle file", k8s_multitenancy_supported=True),
1075-
10761073
# NOTE: following 'k8s_db_node_service_type', 'k8s_db_node_to_node_broadcast_ip_type' and
10771074
# 'k8s_db_node_to_client_broadcast_ip_type' options are supported only starting with
10781075
# the 'v1.11.0-rc.0' scylla-operator version.

sdcm/scylla_bench_thread.py

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -198,26 +198,23 @@ def adjust_cmd_node_option(self, stress_cmd, loader, cmd_runner):
198198
return stress_cmd
199199

200200
def create_stress_cmd(self, stress_cmd, loader, cmd_runner):
201-
if self.connection_bundle_file:
202-
stress_cmd = f'{stress_cmd.strip()} -cloud-config-path={self.target_connection_bundle_file}'
203-
else:
204-
# Select first seed node to send the scylla-bench cmds
205-
stress_cmd = self.adjust_cmd_node_option(stress_cmd, loader, cmd_runner)
206-
207-
if self.params.get("client_encrypt"):
208-
for ssl_file in loader.ssl_conf_dir.iterdir():
209-
if ssl_file.is_file():
210-
cmd_runner.send_files(str(ssl_file),
211-
str(SCYLLA_SSL_CONF_DIR / ssl_file.name),
212-
verbose=True)
213-
stress_cmd = f'{stress_cmd.strip()} -tls -tls-ca-cert-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CA_CERT}'
214-
215-
if self.params.get("peer_verification"):
216-
stress_cmd = f'{stress_cmd.strip()} -tls-host-verification'
217-
if self.params.get("client_encrypt_mtls"):
218-
stress_cmd = (
219-
f'{stress_cmd.strip()} -tls-client-key-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CLIENT_KEY} '
220-
f'-tls-client-cert-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CLIENT_CERT}')
201+
# Select first seed node to send the scylla-bench cmds
202+
stress_cmd = self.adjust_cmd_node_option(stress_cmd, loader, cmd_runner)
203+
204+
if self.params.get("client_encrypt"):
205+
for ssl_file in loader.ssl_conf_dir.iterdir():
206+
if ssl_file.is_file():
207+
cmd_runner.send_files(str(ssl_file),
208+
str(SCYLLA_SSL_CONF_DIR / ssl_file.name),
209+
verbose=True)
210+
stress_cmd = f'{stress_cmd.strip()} -tls -tls-ca-cert-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CA_CERT}'
211+
212+
if self.params.get("peer_verification"):
213+
stress_cmd = f'{stress_cmd.strip()} -tls-host-verification'
214+
if self.params.get("client_encrypt_mtls"):
215+
stress_cmd = (
216+
f'{stress_cmd.strip()} -tls-client-key-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CLIENT_KEY} '
217+
f'-tls-client-cert-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CLIENT_CERT}')
221218

222219
return stress_cmd
223220

@@ -236,9 +233,6 @@ def _run_stress(self, loader, loader_idx, cpu_idx):
236233
)
237234
cmd_runner_name = loader.ip_address
238235

239-
if self.connection_bundle_file:
240-
cmd_runner.send_files(str(self.connection_bundle_file), self.target_connection_bundle_file)
241-
242236
if self.sb_mode == ScyllaBenchModes.WRITE and self.sb_workload == ScyllaBenchWorkloads.TIMESERIES:
243237
loader.parent_cluster.sb_write_timeseries_ts = write_timestamp = time.time_ns()
244238
LOGGER.debug("Set start-time: %s", write_timestamp)

sdcm/stress/base.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import logging
1515
import random
1616
import concurrent.futures
17-
from pathlib import Path
1817
from functools import cached_property
1918
import uuid
2019
from datetime import datetime
@@ -152,14 +151,6 @@ def db_node_to_query(self, loader):
152151
return node_to_query.cql_address
153152
return self.node_list[0].cql_address
154153

155-
@property
156-
def connection_bundle_file(self) -> Path:
157-
return self.node_list[0].parent_cluster.connection_bundle_file
158-
159-
@property
160-
def target_connection_bundle_file(self) -> str:
161-
return str(Path('/tmp/') / self.connection_bundle_file.name)
162-
163154
def configure_event_on_failure(self, stress_event: StressEvent, exc: Exception | Failure):
164155
error_msg = format_stress_cmd_error(exc)
165156
if (hasattr(exc, "result") and exc.result.failed) and exc.result.exited == 137:

sdcm/stress_thread.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import contextlib
1919
from typing import Any
2020
from itertools import chain
21-
from pathlib import Path
2221

2322
from sdcm.db_stats import get_stress_cmd_params
2423
from sdcm.loader import CassandraStressExporter, CassandraStressHDRExporter
@@ -170,10 +169,7 @@ def adjust_cmd_node_option(self, stress_cmd, loader, cmd_runner):
170169
return stress_cmd
171170

172171
def adjust_cmd_connection_options(self, stress_cmd: str, loader, cmd_runner) -> str:
173-
if (connection_bundle_file := self.node_list[0].parent_cluster.connection_bundle_file) and '-node' not in stress_cmd:
174-
stress_cmd += f" -cloudconf file={Path('/tmp') / connection_bundle_file.name}"
175-
else:
176-
stress_cmd = self.adjust_cmd_node_option(stress_cmd, loader, cmd_runner)
172+
stress_cmd = self.adjust_cmd_node_option(stress_cmd, loader, cmd_runner)
177173
return stress_cmd
178174

179175
def create_stress_cmd(self, cmd_runner, keyspace_idx, loader):
@@ -325,10 +321,6 @@ def _run_cs_stress(self, loader, loader_idx, cpu_idx, keyspace_idx): # noqa: PL
325321
str(SCYLLA_SSL_CONF_DIR / ssl_file.name),
326322
verbose=True)
327323

328-
if connection_bundle_file := self.connection_bundle_file:
329-
cmd_runner.send_files(str(connection_bundle_file),
330-
self.target_connection_bundle_file, delete_dst=True, verbose=True)
331-
332324
if self.params.get("use_hdrhistogram"):
333325
stress_cmd = self._add_hdr_log_option(stress_cmd, remote_hdr_file_name)
334326
hdrh_logger_context = HDRHistogramFileLogger(

0 commit comments

Comments
 (0)