Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is possible initialize a keyspace from k8ssandraCluster.yml manifest? #1131

Open
lorensan opened this issue Dec 8, 2023 · 0 comments
Open
Labels
question Further information is requested

Comments

@lorensan
Copy link

lorensan commented Dec 8, 2023

I just read in k8ssandra, there is possible add and initContainer to execute a job when the cluster is up.

My main goal is be able to create a deployment yml with the keyspaces needed in my projects.

My current yml keeps like that but not works (the image is wrong, I have tried with busybox imagen form k8ssandra tutorial but I'm not able to inject cqlsh scrip anyway.

apiVersion: k8ssandra.io/v1alpha1
kind: K8ssandraCluster
metadata:
  name: demo
spec:
  cassandra:
    serverVersion: "4.0.1"
    datacenters:
      - metadata:
          name: dc1
        size: 3
        storageConfig:
          cassandraDataVolumeClaimSpec:
            storageClassName: standard
            accessModes:
              - ReadWriteOnce
            resources:
              requests:
                storage: 5Gi
        config:
          jvmOptions:
            heapSize: 512M
        stargate:
          size: 1
          heapSize: 256M
  initContainers:
    - name: init-keyspace
      image: busybox
      command:
        - sh
        - -c
        - |
          sleep 20
          cqlsh -u $(echo -n $(kubectl get secret cassandra-credentials -o=jsonpath='{.data.username}' | base64 -d)) -p $(echo -n $(kubectl get secret cassandra-credentials -o=jsonpath='{.data.password}' | base64 -d)) -e "CREATE KEYSPACE orion WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3};"

Furthermore, I have read exist some annotation to include more configuration, and I ask myself if exist the possibility to include there the keyspace.

Has somebody had the some needed?

Is there some way to solve it?

If someone have the similar request and no idea, my current solution has been create an script sh in charge to do everything step by step (but not secure at all).

┆Issue is synchronized with this Jira Story by Unito
┆Issue Number: K8OP-61

@lorensan lorensan added the question Further information is requested label Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
No open projects
Status: No status
Development

No branches or pull requests

1 participant