Skip to content

Commit b29f103

Browse files
committed
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 b29f103

File tree

11 files changed

+30
-254
lines changed

11 files changed

+30
-254
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/pytest.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ markers =
44
requires_mgmt: test requires scylla manager to exist, set "use_mgmt: true" to enable it
55
requires_backend: used for the specification of supported backends and making a test be skipped if there is not match
66
requires_scylla_versions: test will be skipped if the installed Scylla version doesn't match values of this marker
7-
requires_tls_and_sni: test will be skipped if the TLS+SNI features are not enabled
87
required_operator: test will be skipped if the installed Scylla-Operator version doesn't match values of this marker
98
readonly: test that does not make any changes to cluster, only reads. Useful for running fast subset of tests
109
restart_is_used: used for skipping tests which suffer from https://github.com/scylladb/scylla/issues/9543

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.get_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.verify_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 & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
from cassandra.cluster import Cluster as ClusterDriver
5858
from cassandra.cluster import NoHostAvailable
5959
from cassandra.policies import RetryPolicy
60-
from cassandra.policies import WhiteListRoundRobinPolicy, HostFilterPolicy, RoundRobinPolicy
60+
from cassandra.policies import WhiteListRoundRobinPolicy
6161
from cassandra.query import SimpleStatement
6262
from argus.common.enums import ResourceState
6363
from argus.client.sct.types import LogLink
@@ -2874,10 +2874,6 @@ def print_node_running_nemesis(self, node_ip):
28742874

28752875
return f' ({node.running_nemesis} nemesis target node)' if node.running_nemesis else ' (not target node)'
28762876

2877-
@property
2878-
def is_cqlsh_support_cloud_bundle(self):
2879-
return bool(self.parent_cluster.connection_bundle_file)
2880-
28812877
@property
28822878
def is_replacement_by_host_id_supported(self):
28832879
return ComparableScyllaVersion(self.scylla_version) > '5.2.0~dev'
@@ -2899,12 +2895,6 @@ def _gen_cqlsh_cmd(self, command, keyspace, timeout, connect_timeout):
28992895
command = '"{}"'.format(command.strip().replace('"', '\\"'))
29002896

29012897
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}'
29082898
return f'{cqlsh_cmd} {options} -e {command} {host}'
29092899

29102900
def run_cqlsh(self, cmd, keyspace=None, timeout=120, verbose=True, split=False, connect_timeout=60,
@@ -3594,7 +3584,7 @@ def create_ssl_context(keyfile: str, certfile: str, truststore: str):
35943584
return ssl_context
35953585

35963586
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):
3587+
ssl_context=None, node_ips=None, connect_timeout=None, verbose=True):
35983588
if not port:
35993589
port = node.CQL_PORT
36003590

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

36223612
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)
36253613
cluster_driver = ClusterDriver(auth_provider=auth_provider,
36263614
compression=compression,
36273615
protocol_version=protocol_version,
@@ -3671,40 +3659,23 @@ def cql_connection(self, node, keyspace=None, user=None,
36713659
- If a connection bundle file is available in the parent cluster, it will be used for the connection.
36723660
- If no connection bundle file is provided, the method will use the WhiteListRoundRobinPolicy with the specified nodes.
36733661
"""
3674-
if connection_bundle_file := node.parent_cluster.connection_bundle_file:
3675-
wlrr = None
3676-
node_ips = []
3677-
else:
3678-
node_ips = self.get_node_cql_ips(nodes=whitelist_nodes)
3679-
wlrr = WhiteListRoundRobinPolicy(node_ips)
3662+
node_ips = self.get_node_cql_ips(nodes=whitelist_nodes)
3663+
wlrr = WhiteListRoundRobinPolicy(node_ips)
3664+
36803665
return self._create_session(node=node, keyspace=keyspace, user=user, password=password, compression=compression,
36813666
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)
3667+
node_ips=node_ips, connect_timeout=connect_timeout, verbose=verbose)
36843668

36853669
def cql_connection_exclusive(self, node, keyspace=None, user=None,
36863670
password=None, compression=True,
36873671
protocol_version=None, port=None,
36883672
ssl_context=None, connect_timeout=100, verbose=True):
3689-
if connection_bundle_file := node.parent_cluster.connection_bundle_file:
3690-
# TODO: handle the case of multiple datacenters
3691-
bundle_yaml = yaml.safe_load(connection_bundle_file.open('r', encoding='utf-8'))
3692-
node_domain = None
3693-
for _, connection_data in bundle_yaml.get('datacenters', {}).items():
3694-
node_domain = connection_data.get('nodeDomain').strip()
3695-
assert node_domain, f"didn't found nodeDomain in bundle [{connection_bundle_file}]"
3696-
3697-
def host_filter(host):
3698-
return str(host.host_id) == str(node.host_id) or node_domain == host.endpoint._server_name
3699-
wlrr = HostFilterPolicy(child_policy=RoundRobinPolicy(), predicate=host_filter)
3700-
node_ips = []
3701-
else:
3702-
node_ips = [node.cql_address]
3703-
wlrr = WhiteListRoundRobinPolicy(node_ips)
3673+
3674+
node_ips = [node.cql_address]
3675+
wlrr = WhiteListRoundRobinPolicy(node_ips)
37043676
return self._create_session(node=node, keyspace=keyspace, user=user, password=password, compression=compression,
37053677
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)
3678+
node_ips=node_ips, connect_timeout=connect_timeout, verbose=verbose)
37083679

37093680
@retrying(n=8, sleep_time=15, allowed_exceptions=(NoHostAvailable,))
37103681
def cql_connection_patient(self, node, keyspace=None,
@@ -4172,11 +4143,6 @@ def proposed_scylla_yaml(self) -> ScyllaYaml:
41724143
)
41734144
return ScyllaYaml(**cluster_params_builder.dict(exclude_unset=True, exclude_none=True))
41744145

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-
41804146
@property
41814147
def racks(self) -> Set[int]:
41824148
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: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -162,27 +162,24 @@ def verify_results(self):
162162
return sb_summary, errors
163163

164164
def create_stress_cmd(self, stress_cmd, loader, cmd_runner):
165-
if self.connection_bundle_file:
166-
stress_cmd = f'{stress_cmd.strip()} -cloud-config-path={self.target_connection_bundle_file}'
167-
else:
168-
# Select first seed node to send the scylla-bench cmds
169-
ips = ",".join([n.cql_address for n in self.node_list])
170-
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}')
165+
# Select first seed node to send the scylla-bench cmds
166+
ips = ",".join([n.cql_address for n in self.node_list])
167+
stress_cmd = f'{stress_cmd.strip()} -nodes {ips}'
168+
169+
if self.params.get("client_encrypt"):
170+
for ssl_file in loader.ssl_conf_dir.iterdir():
171+
if ssl_file.is_file():
172+
cmd_runner.send_files(str(ssl_file),
173+
str(SCYLLA_SSL_CONF_DIR / ssl_file.name),
174+
verbose=True)
175+
stress_cmd = f'{stress_cmd.strip()} -tls -tls-ca-cert-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CA_CERT}'
176+
177+
if self.params.get("peer_verification"):
178+
stress_cmd = f'{stress_cmd.strip()} -tls-host-verification'
179+
if self.params.get("client_encrypt_mtls"):
180+
stress_cmd = (
181+
f'{stress_cmd.strip()} -tls-client-key-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CLIENT_KEY} '
182+
f'-tls-client-cert-file {SCYLLA_SSL_CONF_DIR}/{TLSAssets.CLIENT_CERT}')
186183

187184
return stress_cmd
188185

@@ -201,9 +198,6 @@ def _run_stress(self, loader, loader_idx, cpu_idx):
201198
)
202199
cmd_runner_name = loader.ip_address
203200

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

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
@@ -171,10 +170,7 @@ def adjust_cmd_node_option(self, stress_cmd, loader, cmd_runner):
171170
return stress_cmd
172171

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

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

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

0 commit comments

Comments
 (0)