diff --git a/.gitignore b/.gitignore index c6c2ce7..3bd37bd 100644 --- a/.gitignore +++ b/.gitignore @@ -13,11 +13,14 @@ cmd/keynode/keynode cmd/manager/manager cmd/routing/routing cmd/monitor/monitor +cmd/worker/worker client/client cmd/cli/cli cmd/benchmark/benchmark cmd/benchmark/benchmarks.txt +config/tasc-config.yml + logs/ *.log pids diff --git a/cluster/create_cluster.py b/cluster/create_cluster.py index 8b2c538..52076de 100755 --- a/cluster/create_cluster.py +++ b/cluster/create_cluster.py @@ -8,7 +8,7 @@ ec2_client = boto3.client('ec2', os.getenv('AWS_REGION', 'us-east-1')) -def create_cluster(txn_count, keynode_count, rtr_count, benchmark_count, config_file, +def create_cluster(txn_count, keynode_count, rtr_count, lb_count, benchmark_count, config_file, branch_name, ssh_key, cluster_name, kops_bucket, aws_key_id, aws_key, anna_config_file): prefix = './' util.run_process(['./create_cluster_object.sh', kops_bucket, ssh_key], 'kops') @@ -37,7 +37,11 @@ def create_cluster(txn_count, keynode_count, rtr_count, benchmark_count, config_ add_nodes(client, apps_client, config_file, 'tasc', txn_count, aws_key_id, aws_key, True, prefix, branch_name) - print('Creating TASC service...') + print('Creating %d Load Balancers...' % (lb_count)) + add_nodes(client, apps_client, config_file, 'lb', lb_count, + aws_key_id, aws_key, True, prefix, branch_name) + + print('Creating TASC Load Balancing service...') service_spec = util.load_yaml('yaml/services/tasc.yml', prefix) client.create_namespaced_service(namespace=util.NAMESPACE, body=service_spec) @@ -95,6 +99,9 @@ def create_cluster(txn_count, keynode_count, rtr_count, benchmark_count, config_ parser.add_argument('-r', '--routers', nargs=1, type=int, metavar='L', help='The number of (Anna) router nodes to start with ' + '(required)', dest='routers', required=True) + parser.add_argument('-l', '--loadbalancer', nargs=1, type=int, metavar='L', + help='The number of load balancer nodes to start with ' + + '(required)', dest='lb', required=True) parser.add_argument('-b', '--benchmark', nargs=1, type=int, metavar='L', help='The number of benchmark nodes to start with ' + '(required)', dest='benchmark', required=True) @@ -123,6 +130,6 @@ def create_cluster(txn_count, keynode_count, rtr_count, benchmark_count, config_ args = parser.parse_args() - create_cluster(args.nodes[0], args.keynodes[0], args.routers[0], + create_cluster(args.nodes[0], args.keynodes[0], args.routers[0], args.lb[0], args.benchmark[0], args.config, args.branch, args.sshkey, cluster_name, kops_bucket, aws_key_id, aws_key, args.annaconfig) diff --git a/cluster/kops/yaml/igs/lb-ig.yml b/cluster/kops/yaml/igs/lb-ig.yml new file mode 100644 index 0000000..4fde043 --- /dev/null +++ b/cluster/kops/yaml/igs/lb-ig.yml @@ -0,0 +1,17 @@ +apiVersion: kops/v1alpha2 +kind: InstanceGroup +metadata: + labels: + kops.k8s.io/cluster: CLUSTER_NAME + name: lb-instances +spec: + image: kope.io/k8s-1.11-debian-stretch-amd64-hvm-ebs-2018-08-17 + machineType: c5.large + maxSize: FILLER + minSize: FILLER + rootVolumeSize: 32 + role: Node + nodeLabels: + role: lb + subnets: + - us-east-1a \ No newline at end of file diff --git a/cluster/yaml/ds/lb-ds.yml b/cluster/yaml/ds/lb-ds.yml new file mode 100644 index 0000000..bc8f16e --- /dev/null +++ b/cluster/yaml/ds/lb-ds.yml @@ -0,0 +1,31 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: lb-nodes + labels: + role: lb +spec: + selector: + matchLabels: + role: lb + template: + metadata: + labels: + role: lb + spec: + nodeSelector: + role: lb + hostNetwork: true + containers: + - name: lb-container + image: sauravchh/tasc + imagePullPolicy: Always + env: + - name: BRANCH + value: master + - name: ROLE + value: lb + - name: AWS_ACCESS_KEY_ID + value: ACCESS_KEY_ID_DUMMY + - name: AWS_SECRET_ACCESS_KEY + value: AWS_SECRET_KEY_DUMMY \ No newline at end of file diff --git a/cmd/lb/lb.go b/cmd/lb/lb.go index f740fdd..dcc2806 100644 --- a/cmd/lb/lb.go +++ b/cmd/lb/lb.go @@ -4,6 +4,7 @@ import ( "context" "fmt" cmn "github.com/saurav-c/tasc/lib/common" + log "github.com/sirupsen/logrus" "math/rand" "os" "time" @@ -64,6 +65,8 @@ func main() { poller := zmq.NewPoller() poller.Add(lbSocket, zmq.POLLIN) + logger := cmn.InitLogger("logs", "lb", log.DebugLevel) + updateStart := time.Now() for true { sockets, _ := poller.Poll(10 * time.Millisecond) @@ -87,6 +90,7 @@ func main() { } addresses = newAddresses + go logAddresses(addresses) updateStart = time.Now() } } @@ -115,3 +119,10 @@ func getNodeAddress(addresses []v1.NodeAddress, tp v1.NodeAddressType) string { return "" } + +func logAddresses(addrs []string) { + log.Info("TASC Node Addresses...") + for _, addr := range addrs { + log.Info("\t-" + addr) + } +}