github.com/looshlee/cilium@v1.6.12/examples/kubernetes-cassandra/cass-populate-tables.sh (about)

     1  #/bin/bash
     2  
     3  CASS_SERVER_POD=$(kubectl get pods -l app=cass-server -o jsonpath='{.items[0].metadata.name}')
     4  
     5  # create tables
     6  
     7  kubectl exec $CASS_SERVER_POD sh -- -c "cqlsh -e \"CREATE KEYSPACE deathstar WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'datacenter1' : 2 };\""
     8  kubectl exec $CASS_SERVER_POD sh -- -c "cqlsh -e \"CREATE TABLE deathstar.scrum_notes (creation timeuuid, empire_member_id uuid, content varchar, PRIMARY KEY (empire_member_id));\"" 
     9  
    10  UUID1=`uuidgen`
    11  UPDATE1="Trying to figure out if we should paint it medium grey, light grey, or medium-light grey.  Not blocked."
    12  QUERY1="INSERT INTO deathstar.scrum_notes (empire_member_id, creation, content) values ($UUID1, now(), '${UPDATE1}');"
    13  UUID2=`uuidgen`
    14  UPDATE2="I think the exhaust port could be vulnerable to a direct hit.  Hope no one finds out about it.  Not blocked."
    15  QUERY2="INSERT INTO deathstar.scrum_notes (empire_member_id, creation, content) values ($UUID2, now(), '${UPDATE2}');"
    16  UUID3=`uuidgen`
    17  UPDATE3="Designed protective shield for deathstar.  Could be based on nearby moon.  Feature punted to v2.  Not blocked."
    18  QUERY3="INSERT INTO deathstar.scrum_notes (empire_member_id, creation, content) values ($UUID3, now(), '${UPDATE3}');"
    19  
    20  kubectl exec $CASS_SERVER_POD sh -- -c "cqlsh -e \"$QUERY1\"" 
    21  kubectl exec $CASS_SERVER_POD sh -- -c "cqlsh -e \"$QUERY2\"" 
    22  kubectl exec $CASS_SERVER_POD sh -- -c "cqlsh -e \"$QUERY3\"" 
    23  
    24  
    25  kubectl exec $CASS_SERVER_POD sh -- -c "cqlsh -e \"CREATE KEYSPACE attendance WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'datacenter1' : 2 };\""
    26  kubectl exec $CASS_SERVER_POD sh -- -c "cqlsh -e \"CREATE TABLE attendance.daily_records (creation timeuuid, loc_id uuid, present boolean, empire_member_id uuid, PRIMARY KEY (loc_id));\"" 
    27  
    28  for i in `seq 0 10`; do 
    29  	mUUID=`uuidgen`
    30  	lUUID=`uuidgen`
    31  	kubectl exec $CASS_SERVER_POD sh -- -c "cqlsh -e \"INSERT INTO attendance.daily_records (creation, loc_id, present, empire_member_id) values (now(), $lUUID, true, $mUUID);\""
    32  done 
    33