blob: 9abe28aec9f57c7174858e26c74b8dd560f9e8b6 [file] [log] [blame]
// Copyright 2018 The LUCI Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
syntax = "proto3";
option go_package = "go.chromium.org/luci/gce/api/config/v1;config";
package config;
import "google/type/dayofweek.proto";
import "google/protobuf/empty.proto";
import "go.chromium.org/luci/common/proto/options.proto";
option (luci.file_metadata) = {
doc_url: "https://config.luci.app/schemas/services/gce-provider:vms.cfg";
};
// A description of a service account.
message ServiceAccount {
// The email address of this service account.
string email = 1;
// The scopes available for this service account.
repeated string scope = 2;
}
// A network access config type.
// GCE's default and only value is 1:1 NAT.
enum AccessConfigType {
// 1:1 network address translation.
ONE_TO_ONE_NAT = 0;
}
// A description of a network access config.
message AccessConfig {
// The type of config this is.
AccessConfigType type = 1;
}
// A description of a network interface.
message NetworkInterface {
// The access configurations for this interface.
// Required to enable external internet access.
repeated AccessConfig access_config = 1;
// The name of a network to use for this interface.
// https://cloud.google.com/compute/docs/reference/rest/v1/networks/list.
string network = 2;
// The name of a network to use for this interface.
// https://cloud.google.com/compute/docs/reference/rest/v1/subnetworks/list.
// Example: regions/us-west2/subnetworks/cloudbots-network-us-west2.
string subnetwork = 3;
}
// A disk interface.
// GCE's default is "SCSI".
enum DiskInterface {
SCSI = 0;
NVME = 1;
}
// A description of a disk.
// https://cloud.google.com/compute/docs/reference/rest/v1/disks.
message Disk {
// The name of an image to use to create this disk.
// https://cloud.google.com/compute/docs/reference/rest/v1/images/list.
string image = 1;
// The size of this disk in GiB.
int64 size = 2;
// The name of a disk type to use for this disk.
// https://cloud.google.com/compute/docs/reference/rest/v1/diskTypes/list.
string type = 3;
// The disk interface to use for attaching this disk.
DiskInterface interface = 4;
}
// A description of instance metadata.
message Metadata {
oneof metadata {
// A string of the form "key:value" to use as one item of metadata.
string from_text = 1;
// A string of the form "key:filename".
// The contents of the file are used as the value for one item of metadata.
string from_file = 2;
}
}
// Defines the way in which nodes are selected.
enum NodeAffinityOperator {
OPERATOR_UNSPECIFIED = 0;
// Requires Compute Engine to seek for matched nodes.
IN = 1;
// Requires Compute Engine to avoid certain nodes.
NOT_IN = 2;
}
// A description of nodes onto which an instance may be scheduled.
message NodeAffinity {
// Corresponds to the label key of Node resource.
string key = 1;
// Defines the operation of node selection.
NodeAffinityOperator operator = 2;
// Corresponds to the label values of Node resource.
repeated string values = 3;
}
// A description of scheduling options for an instance.
message Scheduling {
// A set of node affinity and anti-affinity configurations.
// https://cloud.google.com/compute/docs/nodes/sole-tenant-nodes#node_affinity_and_anti-affinity
repeated NodeAffinity node_affinity = 1;
}
// GCPChannel is the version of the cloud API to use stable, beta, or alpha.
enum GCPChannel {
GCP_CHANNEL_UNSPECIFIED = 0;
GCP_CHANNEL_STABLE = 1;
GCP_CHANNEL_BETA = 2;
GCP_CHANNEL_ALPHA = 3;
}
// PerformanceMonitoringUnit tracks the types of performance monitoring units to attach to a given instance.
enum PerformanceMonitoringUnit {
PERFORMANCE_MONITORING_UNIT_UNSPECIFIED = 0; // This is not a mistake! The underlying cloud API expects the string "PERFORMANCE_MONITORING_UNIT_UNSPECIFIED".
ARCHITECTURAL = 1;
ENHANCED = 2;
STANDARD = 3;
}
// A description of a VM.
// https://cloud.google.com/compute/docs/reference/rest/v1/instances.
message VM {
// The disks to attach to this VM.
repeated Disk disk = 1;
// The name of a machine type to use for this VM.
// https://cloud.google.com/compute/docs/reference/rest/v1/machineTypes/list.
string machine_type = 2;
// The metadata to attach to this VM.
repeated Metadata metadata = 3;
// The minimum CPU platform to use for this VM.
// https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform.
string min_cpu_platform = 4;
// The network interfaces to configure for this VM.
repeated NetworkInterface network_interface = 5;
// The name of a GCP project to create this VM in.
string project = 6;
// The service accounts to make available to this VM.
repeated ServiceAccount service_account = 7;
// The tags to attach to this VM.
repeated string tag = 8;
// The name of a zone to create this VM in.
// https://cloud.google.com/compute/docs/reference/rest/v1/zones/list.
string zone = 9;
// The scheduling options for this VM.
Scheduling scheduling = 10;
// The labels to attach to this VM.
map<string, string> label = 11;
// Whether to disable integrity monitoring for this VM.
bool disable_integrity_monitoring = 12;
// Whether to enable secure boot for this VM.
bool enable_secure_boot = 13;
// Whether to disable vTPM for this VM.
bool disable_vtpm = 14;
// Whether to enable Confidential Compute for this VM.
bool enable_confidential_compute = 15;
// Force_send_fields is the list of all fields to force send in the GCP API.
repeated string force_send_fields = 16;
// These are the fields associated with force_send_fields that are specifically null.
repeated string null_fields = 17;
// gcp_channel of the GCP api to use, e.g. stable or alpha.
GCPChannel gcp_channel = 18;
// The performance monitoring unit is the type of performance monitoring unit.
PerformanceMonitoringUnit performance_monitoring_unit = 19;
// Ensure VMs are terminated if under maintenance.
bool terminate_on_maintenance = 20;
}
// A length of time.
message TimePeriod {
oneof time {
// The length of time in <int><unit> form.
// Valid units are "s", "m", "h", "d", and "mo", meaning
// "seconds", "minutes", "hours", "days", "months" respectively.
// A "day" is shorthand for 24 hours.
// A "month" is shorthand for 30 days.
string duration = 1;
// The length of time in seconds.
int64 seconds = 2;
}
}
// A time of day.
message TimeOfDay {
// The day of the week the time applies to.
google.type.DayOfWeek day = 1;
// The location the time should be interpreted in.
// https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
string location = 2;
// The time in 24-hour <hour>:<minute>.
string time = 3;
}
// An amount of VMs for particular days of the week.
message Schedule {
reserved 1; // amount
// The length of time the amount is in effect.
// With start, this creates a half-open interval.
// During [start, start+length) the amount will apply.
TimePeriod length = 2;
// The start times when this amount goes into effect.
TimeOfDay start = 3;
// The minimum amount of VMs allowed.
int32 min = 4;
// The maximum amount of VMs allowed.
int32 max = 5;
}
// An amount of VMs.
message Amount {
reserved 1; // default
// The amount of VMs to have at a particular time.
repeated Schedule change = 2;
// The minimum amount of VMs allowed, and the amount of VMs to initialize to.
int32 min = 3;
// The maximum amount of VMs allowed.
int32 max = 4;
}
// A config for one type of VM.
message Config {
// The amount of these VMs.
Amount amount = 1;
// The attributes of these VMs.
VM attributes = 2;
// The lifetime of these VMs.
// At the end of their lifetime, each VM is deleted and replaced. But it
// won't happen immediately becasuse of scheduling reasons. The delay varies
// based on the specified lifetime.
TimePeriod lifetime = 3;
// The prefix to use when naming these VMs.
string prefix = 4;
// The hostname of the Swarming server these VMs should connect to.
string swarming = 6;
// The timeout of these VMs.
// If no Swarming bot has connected by the timeout,
// the VM is deleted and replaced.
TimePeriod timeout = 7;
// Chrome Infra Auth groups considered to own this config.
repeated string owner = 9;
// Set of VMs to be created.
// Each VM represent a DUT.
// Optional. Updated dynamically via RPC.
// TODO(b/318715067): Remove once Device Manager is ready.
map<string, google.protobuf.Empty> duts = 10;
// Fields below should only be set by the server.
// Should only be set by the server. The revision of this config.
string revision = 5;
// Should only be set by the server. The current amount of VMs the server is
// trying to create.
int32 current_amount = 8;
}
// A config for several types of VMs.
message Configs {
// The configs for different types of VMs.
repeated Config vms = 1;
}