1#!/bin/bash
2# Copyright 2018 The gRPC Authors
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16# Creates a performance worker on GCE from an image that's used for kokoro
17# perf workers.
18
19set -ex
20
21cd "$(dirname "$0")"
22
23CLOUD_PROJECT=grpc-testing
24ZONE=us-central1-b  # this zone allows 32core machines
25LATEST_PERF_WORKER_IMAGE=grpc-performance-kokoro-v5  # update if newer image exists
26
27INSTANCE_NAME="${1:-grpc-kokoro-performance-server}"
28MACHINE_TYPE="${2:-e2-standard-32}"
29
30gcloud compute instances create "$INSTANCE_NAME" \
31    --project="$CLOUD_PROJECT" \
32    --zone "$ZONE" \
33    --machine-type "$MACHINE_TYPE" \
34    --image-project "$CLOUD_PROJECT" \
35    --image "$LATEST_PERF_WORKER_IMAGE" \
36    --boot-disk-size 300 \
37    --scopes https://www.googleapis.com/auth/bigquery \
38    --tags=allow-ssh
39