Currently SDC supports only cassandra versions <=3.11.4 due to the fact, that:
- the creation of the asdc_user uses a deprecated create command and does not grant permissions to the keyspaces (see : https://docs.datastax.com/en/cql-oss/3.x/cql/cql_reference/cqlCreateUser.html)
echo "create user $SDC_USER with password '$SDC_PASSWORD' nosuperuser;" | cqlsh -u cassandra -p $CS_PASSWORD $CASSANDRA_IP $CASSANDRA_PORT
In cassandra >3.11.4 this leads to the error (in the DB job):
2023-05-16T07:05:12.990Z|||main||SDC-TOOL||INFO|||beFqdn_IS_UNDEFINED||o.o.s.b.d.c.schema.SdcSchemaBuilder||ActivityType=<log>, Desc=<creating Schema for Cassandra.>
2023-05-16T07:05:13.001Z|||main||SDC-TOOL||INFO|||beFqdn_IS_UNDEFINED||o.o.s.b.d.c.schema.SdcSchemaBuilder||ActivityType=<log>, Desc=<creating Keyspaces.>
2023-05-16T07:05:13.002Z|||main||SDC-TOOL||INFO|||beFqdn_IS_UNDEFINED||o.o.s.b.d.c.schema.SdcSchemaBuilder||ActivityType=<log>, Desc=<creating keyspace:sdcartifact.>
2023-05-16T07:05:15.035Z|||main||SDC-TOOL||ERROR|||beFqdn_IS_UNDEFINED||o.o.s.b.d.c.schema.SdcSchemaBuilder||ActivityType=<log>, Desc=<User asdc_user has no CREATE permission on <all keyspaces> or any of its parents>
Solution could be to use the "create role" command instead and grant the permissions to the keyspaces (all or single), e.g.
echo "create role $SDC_USER with password='$SDC_PASSWORD' AND LOGIN = true AND ACCESS TO ALL DATACENTERS;" | cqlsh -u cassandra -p $CS_PASSWORD $CASSANDRA_IP $CASSANDRA_PORT echo "grant all permissions on all keyspaces to $SDC_USER;" | cqlsh -u cassandra -p $CS_PASSWORD $CASSANDRA_IP $CASSANDRA_PORT
Problem to change to cassandra version 4.x:
- cqlsh version 3.4.4 is not compatible to cassandra 4.x, instead the version 3.4.5 needs to be used
- solution is to override the file /home/sdc/.cassandra
see patch https://gerrit.onap.org/r/c/oom/+/134440/12/kubernetes/sdc/components/sdc-cs/templates/job.yaml