Skip to content

Commit 7db3861

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 60081c0 commit 7db3861

File tree

10 files changed

+155
-156
lines changed

10 files changed

+155
-156
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: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,7 @@ def test_operator_managed_tls(db_cluster: ScyllaPodCluster, tmp_path: path.Path)
10041004
log.debug(output)
10051005

10061006

1007+
<<<<<<< HEAD
10071008
@pytest.mark.required_operator("v1.8.0")
10081009
@pytest.mark.requires_tls_and_sni
10091010
def test_cloud_bundle_connectivity_python(db_cluster: ScyllaPodCluster):
@@ -1072,6 +1073,77 @@ def test_cloud_bundle_connectivity_cqlsh(db_cluster: ScyllaPodCluster):
10721073
assert '(1 rows)' in res.stdout
10731074

10741075

1076+
||||||| parent of 0b4a70a12 (chore(serverless): remove cloud_config option)
1077+
@pytest.mark.required_operator("v1.8.0")
1078+
@pytest.mark.requires_tls_and_sni
1079+
def test_cloud_bundle_connectivity_python(db_cluster: ScyllaPodCluster):
1080+
1081+
assert db_cluster.connection_bundle_file, "cloud bundle wasn't found"
1082+
1083+
with db_cluster.cql_connection_patient(db_cluster.nodes[0]) as session:
1084+
res = session.execute("SELECT * FROM system.local")
1085+
output = res.all()
1086+
log.debug(output)
1087+
assert len(output) == 1
1088+
1089+
1090+
@pytest.mark.required_operator("v1.8.0")
1091+
@pytest.mark.requires_tls_and_sni
1092+
def test_cloud_bundle_connectivity_cassandra_stress(tester):
1093+
1094+
assert tester.db_cluster.connection_bundle_file, "cloud bundle wasn't found"
1095+
1096+
cmd = (
1097+
"""cassandra-stress write cl=ONE duration=1m -schema 'replication(strategy=NetworkTopologyStrategy,replication_factor=1) """
1098+
"""compaction(strategy=SizeTieredCompactionStrategy)' -mode cql3 native """
1099+
"""-rate threads=10 -pop seq=1..10000000 -log interval=5"""
1100+
)
1101+
1102+
stress_obj = tester.run_stress_thread(cmd, stop_test_on_failure=False)
1103+
output, _ = stress_obj.parse_results()
1104+
1105+
assert "latency mean" in output[0]
1106+
assert float(output[0]["latency mean"]) > 0
1107+
1108+
assert "latency 99th percentile" in output[0]
1109+
assert float(output[0]["latency 99th percentile"]) > 0
1110+
1111+
1112+
@pytest.mark.required_operator("v1.8.0")
1113+
@pytest.mark.requires_tls_and_sni
1114+
def test_cloud_bundle_connectivity_scylla_bench(tester):
1115+
1116+
assert tester.db_cluster.connection_bundle_file, "cloud bundle wasn't found"
1117+
1118+
cmd = (
1119+
"scylla-bench -workload=sequential -mode=write -replication-factor=1 -partition-count=10 "
1120+
"-clustering-row-count=5555 -clustering-row-size=uniform:10..20 -concurrency=10 "
1121+
"-connection-count=10 -consistency-level=one -rows-per-request=10 -timeout=60s -duration=1m"
1122+
)
1123+
1124+
stress_obj = tester.run_stress_thread(cmd, stop_test_on_failure=False)
1125+
summaries, errors = stress_obj.parse_results()
1126+
assert not errors
1127+
assert summaries[0]["Clustering row size"] == "Uniform(min=10, max=20)"
1128+
1129+
# TODO: add verification that the output say it's using the cloud bundle
1130+
# (need to add that to log output in scylla-bench)
1131+
1132+
1133+
@pytest.mark.required_operator("v1.8.0")
1134+
@pytest.mark.requires_tls_and_sni
1135+
def test_cloud_bundle_connectivity_cqlsh(db_cluster: ScyllaPodCluster):
1136+
1137+
assert db_cluster.connection_bundle_file, "cloud bundle wasn't found"
1138+
1139+
res = db_cluster.nodes[0].run_cqlsh("SELECT * FROM system.local")
1140+
1141+
assert not res.stderr
1142+
assert '(1 rows)' in res.stdout
1143+
1144+
1145+
=======
1146+
>>>>>>> 0b4a70a12 (chore(serverless): remove cloud_config option)
10751147
def test_can_recover_from_fatal_pod_termination(db_cluster):
10761148
target_node = db_cluster.nodes[-1]
10771149
experiment = PodFailureExperiment(pod=target_node, duration="60s")

sdcm/cluster.py

Lines changed: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,13 @@
5757
from cassandra.cluster import Cluster as ClusterDriver
5858
from cassandra.cluster import NoHostAvailable
5959
from cassandra.policies import RetryPolicy
60+
<<<<<<< HEAD
6061
from cassandra.policies import WhiteListRoundRobinPolicy, HostFilterPolicy, RoundRobinPolicy
62+
||||||| parent of 0b4a70a12 (chore(serverless): remove cloud_config option)
63+
from cassandra.policies import WhiteListRoundRobinPolicy, HostFilterPolicy, RoundRobinPolicy, RackAwareRoundRobinPolicy, LoadBalancingPolicy
64+
=======
65+
from cassandra.policies import WhiteListRoundRobinPolicy, RackAwareRoundRobinPolicy, LoadBalancingPolicy
66+
>>>>>>> 0b4a70a12 (chore(serverless): remove cloud_config option)
6167
from cassandra.query import SimpleStatement
6268
from argus.common.enums import ResourceState
6369
from argus.client.sct.types import LogLink
@@ -2874,10 +2880,6 @@ def print_node_running_nemesis(self, node_ip):
28742880

28752881
return f' ({node.running_nemesis} nemesis target node)' if node.running_nemesis else ' (not target node)'
28762882

2877-
@property
2878-
def is_cqlsh_support_cloud_bundle(self):
2879-
return bool(self.parent_cluster.connection_bundle_file)
2880-
28812883
@property
28822884
def is_replacement_by_host_id_supported(self):
28832885
return ComparableScyllaVersion(self.scylla_version) > '5.2.0~dev'
@@ -2899,12 +2901,6 @@ def _gen_cqlsh_cmd(self, command, keyspace, timeout, connect_timeout):
28992901
command = '"{}"'.format(command.strip().replace('"', '\\"'))
29002902

29012903
cqlsh_cmd = self.add_install_prefix('/usr/bin/cqlsh')
2902-
if self.is_cqlsh_support_cloud_bundle:
2903-
connection_bundle_file = self.parent_cluster.connection_bundle_file
2904-
target_connection_bundle_file = str(Path('/tmp/') / connection_bundle_file.name)
2905-
self.remoter.send_files(str(connection_bundle_file), target_connection_bundle_file)
2906-
2907-
return f'{cqlsh_cmd} {options} -e {command} --cloudconf {target_connection_bundle_file}'
29082904
return f'{cqlsh_cmd} {options} -e {command} {host}'
29092905

29102906
def run_cqlsh(self, cmd, keyspace=None, timeout=120, verbose=True, split=False, connect_timeout=60,
@@ -3594,7 +3590,7 @@ def create_ssl_context(keyfile: str, certfile: str, truststore: str):
35943590
return ssl_context
35953591

35963592
def _create_session(self, node, keyspace, user, password, compression, protocol_version, load_balancing_policy=None, port=None, # noqa: PLR0913
3597-
ssl_context=None, node_ips=None, connect_timeout=None, verbose=True, connection_bundle_file=None):
3593+
ssl_context=None, node_ips=None, connect_timeout=None, verbose=True):
35983594
if not port:
35993595
port = node.CQL_PORT
36003596

@@ -3620,8 +3616,6 @@ def _create_session(self, node, keyspace, user, password, compression, protocol_
36203616
self.log.debug("ssl_context: %s", str(ssl_context))
36213617

36223618
kwargs = dict(contact_points=node_ips, port=port, ssl_context=ssl_context)
3623-
if connection_bundle_file:
3624-
kwargs = dict(scylla_cloud=connection_bundle_file)
36253619
cluster_driver = ClusterDriver(auth_provider=auth_provider,
36263620
compression=compression,
36273621
protocol_version=protocol_version,
@@ -3671,21 +3665,49 @@ def cql_connection(self, node, keyspace=None, user=None,
36713665
- If a connection bundle file is available in the parent cluster, it will be used for the connection.
36723666
- If no connection bundle file is provided, the method will use the WhiteListRoundRobinPolicy with the specified nodes.
36733667
"""
3668+
<<<<<<< HEAD
36743669
if connection_bundle_file := node.parent_cluster.connection_bundle_file:
36753670
wlrr = None
36763671
node_ips = []
36773672
else:
36783673
node_ips = self.get_node_cql_ips(nodes=whitelist_nodes)
36793674
wlrr = WhiteListRoundRobinPolicy(node_ips)
3675+
||||||| parent of 0b4a70a12 (chore(serverless): remove cloud_config option)
3676+
if connection_bundle_file := node.parent_cluster.connection_bundle_file:
3677+
wlrr = None
3678+
node_ips = []
3679+
else:
3680+
wlrr, node_ips = self.get_load_balancing_policy(whitelist_nodes=whitelist_nodes)
3681+
3682+
=======
3683+
3684+
wlrr, node_ips = self.get_load_balancing_policy(whitelist_nodes=whitelist_nodes)
3685+
>>>>>>> 0b4a70a12 (chore(serverless): remove cloud_config option)
36803686
return self._create_session(node=node, keyspace=keyspace, user=user, password=password, compression=compression,
36813687
protocol_version=protocol_version, load_balancing_policy=wlrr, port=port, ssl_context=ssl_context,
3682-
node_ips=node_ips, connect_timeout=connect_timeout, verbose=verbose,
3683-
connection_bundle_file=connection_bundle_file)
3688+
node_ips=node_ips, connect_timeout=connect_timeout, verbose=verbose)
36843689

36853690
def cql_connection_exclusive(self, node, keyspace=None, user=None,
36863691
password=None, compression=True,
36873692
protocol_version=None, port=None,
36883693
ssl_context=None, connect_timeout=100, verbose=True):
3694+
<<<<<<< HEAD
3695+
if connection_bundle_file := node.parent_cluster.connection_bundle_file:
3696+
# TODO: handle the case of multiple datacenters
3697+
bundle_yaml = yaml.safe_load(connection_bundle_file.open('r', encoding='utf-8'))
3698+
node_domain = None
3699+
for _, connection_data in bundle_yaml.get('datacenters', {}).items():
3700+
node_domain = connection_data.get('nodeDomain').strip()
3701+
assert node_domain, f"didn't found nodeDomain in bundle [{connection_bundle_file}]"
3702+
3703+
def host_filter(host):
3704+
return str(host.host_id) == str(node.host_id) or node_domain == host.endpoint._server_name
3705+
wlrr = HostFilterPolicy(child_policy=RoundRobinPolicy(), predicate=host_filter)
3706+
node_ips = []
3707+
else:
3708+
node_ips = [node.cql_address]
3709+
wlrr = WhiteListRoundRobinPolicy(node_ips)
3710+
||||||| parent of 0b4a70a12 (chore(serverless): remove cloud_config option)
36893711
if connection_bundle_file := node.parent_cluster.connection_bundle_file:
36903712
# TODO: handle the case of multiple datacenters
36913713
bundle_yaml = yaml.safe_load(connection_bundle_file.open('r', encoding='utf-8'))
@@ -3699,12 +3721,21 @@ def host_filter(host):
36993721
wlrr = HostFilterPolicy(child_policy=RoundRobinPolicy(), predicate=host_filter)
37003722
node_ips = []
37013723
else:
3724+
# Use WhiteListRoundRobinPolicy with a single node IP.
3725+
# RackAwareRoundRobinPolicy is not applicable for exclusive node connections,
3726+
# as it operates based on rack and datacenter, not individual nodes.
37023727
node_ips = [node.cql_address]
37033728
wlrr = WhiteListRoundRobinPolicy(node_ips)
3729+
=======
3730+
# Use WhiteListRoundRobinPolicy with a single node IP.
3731+
# RackAwareRoundRobinPolicy is not applicable for exclusive node connections,
3732+
# as it operates based on rack and datacenter, not individual nodes.
3733+
node_ips = [node.cql_address]
3734+
wlrr = WhiteListRoundRobinPolicy(node_ips)
3735+
>>>>>>> 0b4a70a12 (chore(serverless): remove cloud_config option)
37043736
return self._create_session(node=node, keyspace=keyspace, user=user, password=password, compression=compression,
37053737
protocol_version=protocol_version, load_balancing_policy=wlrr, port=port, ssl_context=ssl_context,
3706-
node_ips=node_ips, connect_timeout=connect_timeout, verbose=verbose,
3707-
connection_bundle_file=connection_bundle_file)
3738+
node_ips=node_ips, connect_timeout=connect_timeout, verbose=verbose)
37083739

37093740
@retrying(n=8, sleep_time=15, allowed_exceptions=(NoHostAvailable,))
37103741
def cql_connection_patient(self, node, keyspace=None,
@@ -4172,11 +4203,6 @@ def proposed_scylla_yaml(self) -> ScyllaYaml:
41724203
)
41734204
return ScyllaYaml(**cluster_params_builder.dict(exclude_unset=True, exclude_none=True))
41744205

4175-
@property
4176-
def connection_bundle_file(self) -> Path | None:
4177-
bundle_file = self.params.get("k8s_connection_bundle_file")
4178-
return Path(bundle_file) if bundle_file else None
4179-
41804206
@property
41814207
def racks(self) -> Set[int]:
41824208
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
@@ -1033,9 +1033,6 @@ class SCTConfiguration(dict):
10331033
dict(name="k8s_enable_alternator", env="SCT_K8S_ENABLE_ALTERNATOR", type=boolean,
10341034
help="Defines whether we enable the alternator feature using scylla-operator or not."),
10351035

1036-
dict(name="k8s_connection_bundle_file", env="SCT_K8S_CONNECTION_BUNDLE_FILE", type=_file,
1037-
help="Serverless configuration bundle file", k8s_multitenancy_supported=True),
1038-
10391036
# NOTE: following 'k8s_db_node_service_type', 'k8s_db_node_to_node_broadcast_ip_type' and
10401037
# 'k8s_db_node_to_client_broadcast_ip_type' options are supported only starting with
10411038
# 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
@@ -162,27 +162,38 @@ def verify_results(self):
162162
return sb_summary, errors
163163

164164
def create_stress_cmd(self, stress_cmd, loader, cmd_runner):
165+
<<<<<<< HEAD
165166
if self.connection_bundle_file:
166167
stress_cmd = f'{stress_cmd.strip()} -cloud-config-path={self.target_connection_bundle_file}'
167168
else:
168169
# Select first seed node to send the scylla-bench cmds
169170
ips = ",".join([n.cql_address for n in self.node_list])
170171
stress_cmd = f'{stress_cmd.strip()} -nodes {ips}'
171-
172-
if self.params.get("client_encrypt"):
173-
for ssl_file in loader.ssl_conf_dir.iterdir():
174-
if ssl_file.is_file():
175-
cmd_runner.send_files(str(ssl_file),
176-
str(SCYLLA_SSL_CONF_DIR / ssl_file.name),
177-
verbose=True)
178-
stress_cmd = f'{stress_cmd.strip()} -tls -tls-ca-cert-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CA_CERT}'
179-
180-
if self.params.get("peer_verification"):
181-
stress_cmd = f'{stress_cmd.strip()} -tls-host-verification'
182-
if self.params.get("client_encrypt_mtls"):
183-
stress_cmd = (
184-
f'{stress_cmd.strip()} -tls-client-key-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CLIENT_KEY} '
185-
f'-tls-client-cert-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CLIENT_CERT}')
172+
||||||| parent of 0b4a70a12 (chore(serverless): remove cloud_config option)
173+
if self.connection_bundle_file:
174+
stress_cmd = f'{stress_cmd.strip()} -cloud-config-path={self.target_connection_bundle_file}'
175+
else:
176+
# Select first seed node to send the scylla-bench cmds
177+
stress_cmd = self.adjust_cmd_node_option(stress_cmd, loader, cmd_runner)
178+
=======
179+
# Select first seed node to send the scylla-bench cmds
180+
stress_cmd = self.adjust_cmd_node_option(stress_cmd, loader, cmd_runner)
181+
>>>>>>> 0b4a70a12 (chore(serverless): remove cloud_config option)
182+
183+
if self.params.get("client_encrypt"):
184+
for ssl_file in loader.ssl_conf_dir.iterdir():
185+
if ssl_file.is_file():
186+
cmd_runner.send_files(str(ssl_file),
187+
str(SCYLLA_SSL_CONF_DIR / ssl_file.name),
188+
verbose=True)
189+
stress_cmd = f'{stress_cmd.strip()} -tls -tls-ca-cert-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CA_CERT}'
190+
191+
if self.params.get("peer_verification"):
192+
stress_cmd = f'{stress_cmd.strip()} -tls-host-verification'
193+
if self.params.get("client_encrypt_mtls"):
194+
stress_cmd = (
195+
f'{stress_cmd.strip()} -tls-client-key-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CLIENT_KEY} '
196+
f'-tls-client-cert-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CLIENT_CERT}')
186197

187198
return stress_cmd
188199

@@ -201,9 +212,6 @@ def _run_stress(self, loader, loader_idx, cpu_idx):
201212
)
202213
cmd_runner_name = loader.ip_address
203214

204-
if self.connection_bundle_file:
205-
cmd_runner.send_files(str(self.connection_bundle_file), self.target_connection_bundle_file)
206-
207215
if self.sb_mode == ScyllaBenchModes.WRITE and self.sb_workload == ScyllaBenchWorkloads.TIMESERIES:
208216
loader.parent_cluster.sb_write_timeseries_ts = write_timestamp = time.time_ns()
209217
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

@@ -133,14 +132,6 @@ def db_node_to_query(self, loader):
133132
return node_to_query.cql_address
134133
return self.node_list[0].cql_address
135134

136-
@property
137-
def connection_bundle_file(self) -> Path:
138-
return self.node_list[0].parent_cluster.connection_bundle_file
139-
140-
@property
141-
def target_connection_bundle_file(self) -> str:
142-
return str(Path('/tmp/') / self.connection_bundle_file.name)
143-
144135
def configure_event_on_failure(self, stress_event: StressEvent, exc: Exception | Failure):
145136
error_msg = format_stress_cmd_error(exc)
146137
if (hasattr(exc, "result") and exc.result.failed) and exc.result.exited == 137:

0 commit comments

Comments
 (0)