[COMMIT scylla-cluster-tests master] fix(kubernetes): always create scylla agent config

252 views
Skip to first unread message

Commit Bot

<bot@cloudius-systems.com>
unread,
Aug 9, 2021, 9:22:20 AM8/9/21
to scylladb-dev@googlegroups.com, Valerii Ponomarov
From: Valerii Ponomarov <valerii....@scylladb.com>
Committer: Bentsi <ben...@scylladb.com>
Branch: master

fix(kubernetes): always create scylla agent config

For the moment, we always specify scylla agent config in the
ScyllaCluster CRD. But appropriate 'secret' gets created only when
Scylla manager gets installed. If not, we get following errors in
Scylla operator logs:

"Event occurred" object="scylla/sct-cluster" kind="ScyllaCluster"
apiVersion="scylla.scylladb.com/v1" type="Warning"
reason="InvalidManagerAgentConfig"
message="Can't gent agent token: can't get agent token:
can't get secret scylla/scylla-agent-config:
secret \"scylla-agent-config\" not found"

So, create this secret always properly populating it based on the
Scylla manager presence.

---
diff --git a/sdcm/cluster_k8s/__init__.py b/sdcm/cluster_k8s/__init__.py
--- a/sdcm/cluster_k8s/__init__.py
+++ b/sdcm/cluster_k8s/__init__.py
@@ -105,6 +105,7 @@
SCYLLA_NAMESPACE = "scylla"
MINIO_NAMESPACE = "minio"
SCYLLA_CONFIG_NAME = "scylla-config"
+SCYLLA_AGENT_CONFIG_NAME = "scylla-agent-config"

# Resources that are used by container deployed by scylla-operator on scylla nodes
OPERATOR_CONTAINERS_RESOURCES = {
@@ -707,7 +708,7 @@ def get_scylla_cluster_helm_values(self, cpu_limit, memory_limit, pool_name: str
{
'name': self.params.get('k8s_scylla_rack'),
'scyllaConfig': SCYLLA_CONFIG_NAME,
- 'scyllaAgentConfig': 'scylla-agent-config',
+ 'scyllaAgentConfig': SCYLLA_AGENT_CONFIG_NAME,
'members': 0,
'storage': {
'storageClassName': self.params.get('k8s_scylla_disk_class'),
@@ -736,16 +737,18 @@ def wait_till_cluster_is_operational(self):
self.wait_all_node_pools_to_be_ready()

def create_scylla_manager_agent_config(self):
- # Create kubernetes secret that holds scylla manager agent configuration
- self.update_secret_from_data('scylla-agent-config', SCYLLA_NAMESPACE, {
- 'scylla-manager-agent.yaml': {
- 's3': {
- 'provider': 'Minio',
- 'endpoint': self.s3_provider_endpoint,
- 'access_key_id': 'minio_access_key',
- 'secret_access_key': 'minio_secret_key'
- }
+ data = {}
+ if self.params['use_mgmt']:
+ data["s3"] = {
+ 'provider': 'Minio',
+ 'endpoint': self.s3_provider_endpoint,
+ 'access_key_id': 'minio_access_key',
+ 'secret_access_key': 'minio_secret_key',
}
+
+ # Create kubernetes secret that holds scylla manager agent configuration
+ self.update_secret_from_data(SCYLLA_AGENT_CONFIG_NAME, SCYLLA_NAMESPACE, {
+ 'scylla-manager-agent.yaml': data,
})

@log_run_info
@@ -762,9 +765,7 @@ def deploy_scylla_cluster(self, node_pool: CloudK8sNodePool = None, node_prepare
"SCT_REUSE_CLUSTER is set, but target scylla cluster is unhealthy") from exc
LOGGER.info("Create and initialize a Scylla cluster")
self.kubectl(f"create namespace {SCYLLA_NAMESPACE}")
-
- if self.params['use_mgmt']:
- self.create_scylla_manager_agent_config()
+ self.create_scylla_manager_agent_config()

affinity_modifiers = []

Reply all
Reply to author
Forward
0 new messages