Skip to content

Commit 685c832

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 44b7861 commit 685c832

File tree

10 files changed

+76
-225
lines changed

10 files changed

+76
-225
lines changed

docs/configuration_options.md

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

19611961

1962-
## **k8s_connection_bundle_file** / SCT_K8S_CONNECTION_BUNDLE_FILE
1963-
1964-
Serverless configuration bundle file
1965-
1966-
**default:** N/A
1967-
1968-
**type:** _file
1969-
1970-
19711962
## **k8s_db_node_service_type** / SCT_K8S_DB_NODE_SERVICE_TYPE
19721963

19731964
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: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@
5656
from cassandra.cluster import Cluster as ClusterDriver
5757
from cassandra.cluster import NoHostAvailable
5858
from cassandra.policies import RetryPolicy
59+
<<<<<<< HEAD
5960
from cassandra.policies import WhiteListRoundRobinPolicy, HostFilterPolicy, RoundRobinPolicy
61+
||||||| parent of 0b4a70a12 (chore(serverless): remove cloud_config option)
62+
from cassandra.policies import WhiteListRoundRobinPolicy, HostFilterPolicy, RoundRobinPolicy, RackAwareRoundRobinPolicy, LoadBalancingPolicy
63+
=======
64+
from cassandra.policies import WhiteListRoundRobinPolicy, RackAwareRoundRobinPolicy, LoadBalancingPolicy
65+
>>>>>>> 0b4a70a12 (chore(serverless): remove cloud_config option)
6066
from cassandra.query import SimpleStatement
6167
from argus.common.enums import ResourceState
6268
from argus.client.sct.types import LogLink
@@ -2882,10 +2888,6 @@ def print_node_running_nemesis(self, node_ip):
28822888

28832889
return f' ({node.running_nemesis} nemesis target node)' if node.running_nemesis else ' (not target node)'
28842890

2885-
@property
2886-
def is_cqlsh_support_cloud_bundle(self):
2887-
return bool(self.parent_cluster.connection_bundle_file)
2888-
28892891
@property
28902892
def is_replacement_by_host_id_supported(self):
28912893
return ComparableScyllaVersion(self.scylla_version) > '5.2.0~dev'
@@ -2907,12 +2909,6 @@ def _gen_cqlsh_cmd(self, command, keyspace, timeout, connect_timeout):
29072909
command = '"{}"'.format(command.strip().replace('"', '\\"'))
29082910

29092911
cqlsh_cmd = self.add_install_prefix('/usr/bin/cqlsh')
2910-
if self.is_cqlsh_support_cloud_bundle:
2911-
connection_bundle_file = self.parent_cluster.connection_bundle_file
2912-
target_connection_bundle_file = str(Path('/tmp/') / connection_bundle_file.name)
2913-
self.remoter.send_files(str(connection_bundle_file), target_connection_bundle_file)
2914-
2915-
return f'{cqlsh_cmd} {options} -e {command} --cloudconf {target_connection_bundle_file}'
29162912
return f'{cqlsh_cmd} {options} -e {command} {host}'
29172913

29182914
def run_cqlsh(self, cmd, keyspace=None, timeout=120, verbose=True, split=False, connect_timeout=60,
@@ -3620,7 +3616,7 @@ def create_ssl_context(keyfile: str, certfile: str, truststore: str):
36203616
return ssl_context
36213617

36223618
def _create_session(self, node, keyspace, user, password, compression, protocol_version, load_balancing_policy=None, port=None, # noqa: PLR0913
3623-
ssl_context=None, node_ips=None, connect_timeout=None, verbose=True, connection_bundle_file=None):
3619+
ssl_context=None, node_ips=None, connect_timeout=None, verbose=True):
36243620
if not port:
36253621
port = node.CQL_PORT
36263622

@@ -3646,8 +3642,6 @@ def _create_session(self, node, keyspace, user, password, compression, protocol_
36463642
self.log.debug("ssl_context: %s", str(ssl_context))
36473643

36483644
kwargs = dict(contact_points=node_ips, port=port, ssl_context=ssl_context)
3649-
if connection_bundle_file:
3650-
kwargs = dict(scylla_cloud=connection_bundle_file)
36513645
cluster_driver = ClusterDriver(auth_provider=auth_provider,
36523646
compression=compression,
36533647
protocol_version=protocol_version,
@@ -3697,21 +3691,49 @@ def cql_connection(self, node, keyspace=None, user=None,
36973691
- If a connection bundle file is available in the parent cluster, it will be used for the connection.
36983692
- If no connection bundle file is provided, the method will use the WhiteListRoundRobinPolicy with the specified nodes.
36993693
"""
3694+
<<<<<<< HEAD
37003695
if connection_bundle_file := node.parent_cluster.connection_bundle_file:
37013696
wlrr = None
37023697
node_ips = []
37033698
else:
37043699
node_ips = self.get_node_cql_ips(nodes=whitelist_nodes)
37053700
wlrr = WhiteListRoundRobinPolicy(node_ips)
3701+
||||||| parent of 0b4a70a12 (chore(serverless): remove cloud_config option)
3702+
if connection_bundle_file := node.parent_cluster.connection_bundle_file:
3703+
wlrr = None
3704+
node_ips = []
3705+
else:
3706+
wlrr, node_ips = self.get_load_balancing_policy(whitelist_nodes=whitelist_nodes)
3707+
3708+
=======
3709+
3710+
wlrr, node_ips = self.get_load_balancing_policy(whitelist_nodes=whitelist_nodes)
3711+
>>>>>>> 0b4a70a12 (chore(serverless): remove cloud_config option)
37063712
return self._create_session(node=node, keyspace=keyspace, user=user, password=password, compression=compression,
37073713
protocol_version=protocol_version, load_balancing_policy=wlrr, port=port, ssl_context=ssl_context,
3708-
node_ips=node_ips, connect_timeout=connect_timeout, verbose=verbose,
3709-
connection_bundle_file=connection_bundle_file)
3714+
node_ips=node_ips, connect_timeout=connect_timeout, verbose=verbose)
37103715

37113716
def cql_connection_exclusive(self, node, keyspace=None, user=None,
37123717
password=None, compression=True,
37133718
protocol_version=None, port=None,
37143719
ssl_context=None, connect_timeout=100, verbose=True):
3720+
<<<<<<< HEAD
3721+
if connection_bundle_file := node.parent_cluster.connection_bundle_file:
3722+
# TODO: handle the case of multiple datacenters
3723+
bundle_yaml = yaml.safe_load(connection_bundle_file.open('r', encoding='utf-8'))
3724+
node_domain = None
3725+
for _, connection_data in bundle_yaml.get('datacenters', {}).items():
3726+
node_domain = connection_data.get('nodeDomain').strip()
3727+
assert node_domain, f"didn't found nodeDomain in bundle [{connection_bundle_file}]"
3728+
3729+
def host_filter(host):
3730+
return str(host.host_id) == str(node.host_id) or node_domain == host.endpoint._server_name
3731+
wlrr = HostFilterPolicy(child_policy=RoundRobinPolicy(), predicate=host_filter)
3732+
node_ips = []
3733+
else:
3734+
node_ips = [node.cql_address]
3735+
wlrr = WhiteListRoundRobinPolicy(node_ips)
3736+
||||||| parent of 0b4a70a12 (chore(serverless): remove cloud_config option)
37153737
if connection_bundle_file := node.parent_cluster.connection_bundle_file:
37163738
# TODO: handle the case of multiple datacenters
37173739
bundle_yaml = yaml.safe_load(connection_bundle_file.open('r', encoding='utf-8'))
@@ -3725,12 +3747,21 @@ def host_filter(host):
37253747
wlrr = HostFilterPolicy(child_policy=RoundRobinPolicy(), predicate=host_filter)
37263748
node_ips = []
37273749
else:
3750+
# Use WhiteListRoundRobinPolicy with a single node IP.
3751+
# RackAwareRoundRobinPolicy is not applicable for exclusive node connections,
3752+
# as it operates based on rack and datacenter, not individual nodes.
37283753
node_ips = [node.cql_address]
37293754
wlrr = WhiteListRoundRobinPolicy(node_ips)
3755+
=======
3756+
# Use WhiteListRoundRobinPolicy with a single node IP.
3757+
# RackAwareRoundRobinPolicy is not applicable for exclusive node connections,
3758+
# as it operates based on rack and datacenter, not individual nodes.
3759+
node_ips = [node.cql_address]
3760+
wlrr = WhiteListRoundRobinPolicy(node_ips)
3761+
>>>>>>> 0b4a70a12 (chore(serverless): remove cloud_config option)
37303762
return self._create_session(node=node, keyspace=keyspace, user=user, password=password, compression=compression,
37313763
protocol_version=protocol_version, load_balancing_policy=wlrr, port=port, ssl_context=ssl_context,
3732-
node_ips=node_ips, connect_timeout=connect_timeout, verbose=verbose,
3733-
connection_bundle_file=connection_bundle_file)
3764+
node_ips=node_ips, connect_timeout=connect_timeout, verbose=verbose)
37343765

37353766
@retrying(n=8, sleep_time=15, allowed_exceptions=(NoHostAvailable,))
37363767
def cql_connection_patient(self, node, keyspace=None,
@@ -4198,11 +4229,6 @@ def proposed_scylla_yaml(self) -> ScyllaYaml:
41984229
)
41994230
return ScyllaYaml(**cluster_params_builder.model_dump(exclude_unset=True, exclude_none=True))
42004231

4201-
@property
4202-
def connection_bundle_file(self) -> Path | None:
4203-
bundle_file = self.params.get("k8s_connection_bundle_file")
4204-
return Path(bundle_file) if bundle_file else None
4205-
42064232
@property
42074233
def racks(self) -> Set[int]:
42084234
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
@@ -2683,51 +2683,6 @@ def seed_nodes_addresses(self):
26832683
def seed_nodes(self):
26842684
return []
26852685

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

sdcm/sct_config.py

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

1037-
dict(name="k8s_connection_bundle_file", env="SCT_K8S_CONNECTION_BUNDLE_FILE", type=_file,
1038-
help="Serverless configuration bundle file", k8s_multitenancy_supported=True),
1039-
10401037
# NOTE: following 'k8s_db_node_service_type', 'k8s_db_node_to_node_broadcast_ip_type' and
10411038
# 'k8s_db_node_to_client_broadcast_ip_type' options are supported only starting with
10421039
# the 'v1.11.0-rc.0' scylla-operator version.

sdcm/scylla_bench_thread.py

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -143,27 +143,38 @@ def __init__(self, stress_cmd, loader_set, timeout, node_list=None, round_robin=
143143
self.hdr_tags = ["co-fixed"]
144144

145145
def create_stress_cmd(self, stress_cmd, loader, cmd_runner):
146+
<<<<<<< HEAD
146147
if self.connection_bundle_file:
147148
stress_cmd = f'{stress_cmd.strip()} -cloud-config-path={self.target_connection_bundle_file}'
148149
else:
149150
# Select first seed node to send the scylla-bench cmds
150151
ips = ",".join([n.cql_address for n in self.node_list])
151152
stress_cmd = f'{stress_cmd.strip()} -nodes {ips}'
152-
153-
if self.params.get("client_encrypt"):
154-
for ssl_file in loader.ssl_conf_dir.iterdir():
155-
if ssl_file.is_file():
156-
cmd_runner.send_files(str(ssl_file),
157-
str(SCYLLA_SSL_CONF_DIR / ssl_file.name),
158-
verbose=True)
159-
stress_cmd = f'{stress_cmd.strip()} -tls -tls-ca-cert-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CA_CERT}'
160-
161-
if self.params.get("peer_verification"):
162-
stress_cmd = f'{stress_cmd.strip()} -tls-host-verification'
163-
if self.params.get("client_encrypt_mtls"):
164-
stress_cmd = (
165-
f'{stress_cmd.strip()} -tls-client-key-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CLIENT_KEY} '
166-
f'-tls-client-cert-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CLIENT_CERT}')
153+
||||||| parent of 0b4a70a12 (chore(serverless): remove cloud_config option)
154+
if self.connection_bundle_file:
155+
stress_cmd = f'{stress_cmd.strip()} -cloud-config-path={self.target_connection_bundle_file}'
156+
else:
157+
# Select first seed node to send the scylla-bench cmds
158+
stress_cmd = self.adjust_cmd_node_option(stress_cmd, loader, cmd_runner)
159+
=======
160+
# Select first seed node to send the scylla-bench cmds
161+
stress_cmd = self.adjust_cmd_node_option(stress_cmd, loader, cmd_runner)
162+
>>>>>>> 0b4a70a12 (chore(serverless): remove cloud_config option)
163+
164+
if self.params.get("client_encrypt"):
165+
for ssl_file in loader.ssl_conf_dir.iterdir():
166+
if ssl_file.is_file():
167+
cmd_runner.send_files(str(ssl_file),
168+
str(SCYLLA_SSL_CONF_DIR / ssl_file.name),
169+
verbose=True)
170+
stress_cmd = f'{stress_cmd.strip()} -tls -tls-ca-cert-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CA_CERT}'
171+
172+
if self.params.get("peer_verification"):
173+
stress_cmd = f'{stress_cmd.strip()} -tls-host-verification'
174+
if self.params.get("client_encrypt_mtls"):
175+
stress_cmd = (
176+
f'{stress_cmd.strip()} -tls-client-key-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CLIENT_KEY} '
177+
f'-tls-client-cert-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CLIENT_CERT}')
167178

168179
return stress_cmd
169180

@@ -182,9 +193,6 @@ def _run_stress(self, loader, loader_idx, cpu_idx):
182193
)
183194
cmd_runner_name = loader.ip_address
184195

185-
if self.connection_bundle_file:
186-
cmd_runner.send_files(str(self.connection_bundle_file), self.target_connection_bundle_file)
187-
188196
if self.sb_mode == ScyllaBenchModes.WRITE and self.sb_workload == ScyllaBenchWorkloads.TIMESERIES:
189197
loader.parent_cluster.sb_write_timeseries_ts = write_timestamp = time.time_ns()
190198
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

@@ -150,14 +149,6 @@ def db_node_to_query(self, loader):
150149
return node_to_query.cql_address
151150
return self.node_list[0].cql_address
152151

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

0 commit comments

Comments
 (0)