cluster_service.proto 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. // Copyright (c) 2015, Google Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.container.v1;
  16. import "google/api/annotations.proto";
  17. option java_multiple_files = true;
  18. option java_outer_classname = "ClusterServiceProto";
  19. option java_package = "com.google.container.v1";
  20. // Google Container Engine Cluster Manager v1
  21. service ClusterManager {
  22. // Lists all clusters owned by a project in either the specified zone or all zones.
  23. rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) {
  24. option (google.api.http) = { get: "/v1/projects/{project_id}/zones/{zone}/clusters" };
  25. }
  26. // Gets the details of a specific cluster.
  27. rpc GetCluster(GetClusterRequest) returns (Cluster) {
  28. option (google.api.http) = { get: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" };
  29. }
  30. // Creates a cluster, consisting of the specified number and type of Google
  31. // Compute Engine instances.
  32. //
  33. // By default, the cluster is created in the project's
  34. // [default network](/compute/docs/networks-and-firewalls#networks).
  35. //
  36. // One firewall is added for the cluster. After cluster creation,
  37. // the cluster creates routes for each node to allow the containers
  38. // on that node to communicate with all other instances in the
  39. // cluster.
  40. //
  41. // Finally, an entry is added to the project's global metadata indicating
  42. // which CIDR range is being used by the cluster.
  43. rpc CreateCluster(CreateClusterRequest) returns (Operation) {
  44. option (google.api.http) = { post: "/v1/projects/{project_id}/zones/{zone}/clusters" body: "*" };
  45. }
  46. // Updates the settings of a specific cluster.
  47. rpc UpdateCluster(UpdateClusterRequest) returns (Operation) {
  48. option (google.api.http) = { put: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" body: "*" };
  49. }
  50. // Deletes the cluster, including the Kubernetes endpoint and all worker
  51. // nodes.
  52. //
  53. // Firewalls and routes that were configured during cluster creation
  54. // are also deleted.
  55. //
  56. // Other Google Compute Engine resources that might be in use by the cluster
  57. // (e.g. load balancer resources) will not be deleted if they weren't present
  58. // at the initial create time.
  59. rpc DeleteCluster(DeleteClusterRequest) returns (Operation) {
  60. option (google.api.http) = { delete: "/v1/projects/{project_id}/zones/{zone}/clusters/{cluster_id}" };
  61. }
  62. // Lists all operations in a project in a specific zone or all zones.
  63. rpc ListOperations(ListOperationsRequest) returns (ListOperationsResponse) {
  64. option (google.api.http) = { get: "/v1/projects/{project_id}/zones/{zone}/operations" };
  65. }
  66. // Gets the specified operation.
  67. rpc GetOperation(GetOperationRequest) returns (Operation) {
  68. option (google.api.http) = { get: "/v1/projects/{project_id}/zones/{zone}/operations/{operation_id}" };
  69. }
  70. // Returns configuration info about the Container Engine service.
  71. rpc GetServerConfig(GetServerConfigRequest) returns (ServerConfig) {
  72. option (google.api.http) = { get: "/v1/projects/{project_id}/zones/{zone}/serverconfig" };
  73. }
  74. }
  75. // Parameters that describe the nodes in a cluster.
  76. message NodeConfig {
  77. // The name of a Google Compute Engine [machine type](/compute/docs/machine-types) (e.g.
  78. // `n1-standard-1`).
  79. //
  80. // If unspecified, the default machine type is
  81. // `n1-standard-1`.
  82. string machine_type = 1;
  83. // Size of the disk attached to each node, specified in GB.
  84. // The smallest allowed disk size is 10GB.
  85. //
  86. // If unspecified, the default disk size is 100GB.
  87. int32 disk_size_gb = 2;
  88. // The set of Google API scopes to be made available on all of the
  89. // node VMs under the "default" service account.
  90. //
  91. // The following scopes are recommended, but not required, and by default are
  92. // not included:
  93. //
  94. // * `https://www.googleapis.com/auth/compute` is required for mounting
  95. // persistent storage on your nodes.
  96. // * `https://www.googleapis.com/auth/devstorage.read_only` is required for
  97. // communicating with **gcr.io**
  98. // (the [Google Container Registry](/container-registry/)).
  99. //
  100. // If unspecified, no scopes are added, unless Cloud Logging or Cloud
  101. // Monitoring are enabled, in which case their required scopes will be added.
  102. repeated string oauth_scopes = 3;
  103. // The metadata key/value pairs assigned to instances in the cluster.
  104. //
  105. // Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes
  106. // in length. These are reflected as part of a URL in the metadata server.
  107. // Additionally, to avoid ambiguity, keys must not conflict with any other
  108. // metadata keys for the project or be one of the four reserved keys:
  109. // "instance-template", "kube-env", "startup-script", and "user-data"
  110. //
  111. // Values are free-form strings, and only have meaning as interpreted by
  112. // the image running in the instance. The only restriction placed on them is
  113. // that each value's size must be less than or equal to 32 KB.
  114. //
  115. // The total size of all keys and values must be less than 512 KB.
  116. map<string, string> metadata = 4;
  117. }
  118. // The authentication information for accessing the master endpoint.
  119. // Authentication can be done using HTTP basic auth or using client
  120. // certificates.
  121. message MasterAuth {
  122. // The username to use for HTTP basic authentication to the master endpoint.
  123. string username = 1;
  124. // The password to use for HTTP basic authentication to the master endpoint.
  125. // Because the master endpoint is open to the Internet, you should create a
  126. // strong password.
  127. string password = 2;
  128. // [Output only] Base64-encoded public certificate that is the root of
  129. // trust for the cluster.
  130. string cluster_ca_certificate = 100;
  131. // [Output only] Base64-encoded public certificate used by clients to
  132. // authenticate to the cluster endpoint.
  133. string client_certificate = 101;
  134. // [Output only] Base64-encoded private key used by clients to authenticate
  135. // to the cluster endpoint.
  136. string client_key = 102;
  137. }
  138. // Configuration for the addons that can be automatically spun up in the
  139. // cluster, enabling additional functionality.
  140. message AddonsConfig {
  141. // Configuration for the HTTP (L7) load balancing controller addon, which
  142. // makes it easy to set up HTTP load balancers for services in a cluster.
  143. HttpLoadBalancing http_load_balancing = 1;
  144. // Configuration for the horizontal pod autoscaling feature, which
  145. // increases or decreases the number of replica pods a replication controller
  146. // has based on the resource usage of the existing pods.
  147. HorizontalPodAutoscaling horizontal_pod_autoscaling = 2;
  148. }
  149. // Configuration options for the HTTP (L7) load balancing controller addon,
  150. // which makes it easy to set up HTTP load balancers for services in a cluster.
  151. message HttpLoadBalancing {
  152. // Whether the HTTP Load Balancing controller is enabled in the cluster.
  153. // When enabled, it runs a small pod in the cluster that manages the load
  154. // balancers.
  155. bool disabled = 1;
  156. }
  157. // Configuration options for the horizontal pod autoscaling feature, which
  158. // increases or decreases the number of replica pods a replication controller
  159. // has based on the resource usage of the existing pods.
  160. message HorizontalPodAutoscaling {
  161. // Whether the Horizontal Pod Autoscaling feature is enabled in the cluster.
  162. // When enabled, it ensures that a Heapster pod is running in the cluster,
  163. // which is also used by the Cloud Monitoring service.
  164. bool disabled = 1;
  165. }
  166. // A Google Container Engine cluster.
  167. message Cluster {
  168. // The current status of the cluster.
  169. enum Status {
  170. // Not set.
  171. STATUS_UNSPECIFIED = 0;
  172. // The PROVISIONING state indicates the cluster is being created.
  173. PROVISIONING = 1;
  174. // The RUNNING state indicates the cluster has been created and is fully usable.
  175. RUNNING = 2;
  176. // The RECONCILING state indicates that some work is actively being done on
  177. // the cluster, such as upgrading the master or node software. Details can
  178. // be found in the `statusMessage` field.
  179. RECONCILING = 3;
  180. // The STOPPING state indicates the cluster is being deleted.
  181. STOPPING = 4;
  182. // The ERROR state indicates the cluster may be unusable. Details
  183. // can be found in the `statusMessage` field.
  184. ERROR = 5;
  185. }
  186. // The name of this cluster. The name must be unique within this project
  187. // and zone, and can be up to 40 characters with the following restrictions:
  188. //
  189. // * Lowercase letters, numbers, and hyphens only.
  190. // * Must start with a letter.
  191. // * Must end with a number or a letter.
  192. string name = 1;
  193. // An optional description of this cluster.
  194. string description = 2;
  195. // The number of nodes to create in this cluster. You must ensure that your
  196. // Compute Engine <a href="/compute/docs/resource-quotas">resource quota</a>
  197. // is sufficient for this number of instances. You must also have available
  198. // firewall and routes quota.
  199. // For requests, this field should only be used in lieu of a
  200. // "node_pool" object, since this configuration (along with the
  201. // "node_config") will be used to create a "NodePool" object with an
  202. // auto-generated name. Do not use this and a node_pool at the same time.
  203. int32 initial_node_count = 3;
  204. // Parameters used in creating the cluster's nodes.
  205. // See `nodeConfig` for the description of its properties.
  206. // For requests, this field should only be used in lieu of a
  207. // "node_pool" object, since this configuration (along with the
  208. // "initial_node_count") will be used to create a "NodePool" object with an
  209. // auto-generated name. Do not use this and a node_pool at the same time.
  210. // For responses, this field will be populated with the node configuration of
  211. // the first node pool.
  212. //
  213. // If unspecified, the defaults are used.
  214. NodeConfig node_config = 4;
  215. // The authentication information for accessing the master endpoint.
  216. MasterAuth master_auth = 5;
  217. // The logging service the cluster should use to write logs.
  218. // Currently available options:
  219. //
  220. // * `logging.googleapis.com` - the Google Cloud Logging service.
  221. // * `none` - no logs will be exported from the cluster.
  222. // * if left as an empty string,`logging.googleapis.com` will be used.
  223. string logging_service = 6;
  224. // The monitoring service the cluster should use to write metrics.
  225. // Currently available options:
  226. //
  227. // * `monitoring.googleapis.com` - the Google Cloud Monitoring service.
  228. // * `none` - no metrics will be exported from the cluster.
  229. // * if left as an empty string, `monitoring.googleapis.com` will be used.
  230. string monitoring_service = 7;
  231. // The name of the Google Compute Engine
  232. // [network](/compute/docs/networks-and-firewalls#networks) to which the
  233. // cluster is connected. If left unspecified, the `default` network
  234. // will be used.
  235. string network = 8;
  236. // The IP address range of the container pods in this cluster, in
  237. // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing)
  238. // notation (e.g. `10.96.0.0/14`). Leave blank to have
  239. // one automatically chosen or specify a `/14` block in `10.0.0.0/8`.
  240. string cluster_ipv4_cidr = 9;
  241. // Configurations for the various addons available to run in the cluster.
  242. AddonsConfig addons_config = 10;
  243. // The name of the Google Compute Engine
  244. // [subnetwork](/compute/docs/subnetworks) to which the
  245. // cluster is connected. Specification of subnetworks is an alpha feature,
  246. // and require that the Google Compute Engine alpha API be enabled.
  247. string subnetwork = 11;
  248. // [Output only] Server-defined URL for the resource.
  249. string self_link = 100;
  250. // [Output only] The name of the Google Compute Engine
  251. // [zone](/compute/docs/zones#available) in which the cluster
  252. // resides.
  253. string zone = 101;
  254. // [Output only] The IP address of this cluster's master endpoint.
  255. // The endpoint can be accessed from the internet at
  256. // `https://username:password@endpoint/`.
  257. //
  258. // See the `masterAuth` property of this resource for username and
  259. // password information.
  260. string endpoint = 102;
  261. // [Output only] The software version of the master endpoint and kubelets used
  262. // in the cluster when it was first created. The version can be upgraded over
  263. // time.
  264. //
  265. string initial_cluster_version = 103;
  266. // [Output only] The current software version of the master endpoint.
  267. string current_master_version = 104;
  268. // [Output only] The current version of the node software components.
  269. // If they are currently at multiple versions because they're in the process
  270. // of being upgraded, this reflects the minimum version of all nodes.
  271. string current_node_version = 105;
  272. // [Output only] The time the cluster was created, in
  273. // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
  274. string create_time = 106;
  275. // [Output only] The current status of this cluster.
  276. Status status = 107;
  277. // [Output only] Additional information about the current status of this
  278. // cluster, if available.
  279. string status_message = 108;
  280. // [Output only] The size of the address space on each node for hosting
  281. // containers. This is provisioned from within the `container_ipv4_cidr` range.
  282. int32 node_ipv4_cidr_size = 109;
  283. // [Output only] The IP address range of the Kubernetes services in
  284. // this cluster, in
  285. // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing)
  286. // notation (e.g. `1.2.3.4/29`). Service addresses are
  287. // typically put in the last `/16` from the container CIDR.
  288. string services_ipv4_cidr = 110;
  289. // [Output only] The resource URLs of [instance
  290. // groups](/compute/docs/instance-groups/) associated with this
  291. // cluster.
  292. repeated string instance_group_urls = 111;
  293. // [Output only] The number of nodes currently in the cluster.
  294. int32 current_node_count = 112;
  295. }
  296. // ClusterUpdate describes an update to the cluster. Exactly one update can
  297. // be applied to a cluster with each request, so at most one field can be
  298. // provided.
  299. message ClusterUpdate {
  300. // The Kubernetes version to change the nodes to (typically an
  301. // upgrade). Use `-` to upgrade to the latest version supported by
  302. // the server.
  303. string desired_node_version = 4;
  304. // The monitoring service the cluster should use to write metrics.
  305. // Currently available options:
  306. //
  307. // * "monitoring.googleapis.com" - the Google Cloud Monitoring service
  308. // * "none" - no metrics will be exported from the cluster
  309. string desired_monitoring_service = 5;
  310. // Configurations for the various addons available to run in the cluster.
  311. AddonsConfig desired_addons_config = 6;
  312. // The Kubernetes version to change the master to. The only valid value is the
  313. // latest supported version. Use "-" to have the server automatically select
  314. // the latest version.
  315. string desired_master_version = 100;
  316. }
  317. // This operation resource represents operations that may have happened or are
  318. // happening on the cluster. All fields are output only.
  319. message Operation {
  320. // Current status of the operation.
  321. enum Status {
  322. // Not set.
  323. STATUS_UNSPECIFIED = 0;
  324. // The operation has been created.
  325. PENDING = 1;
  326. // The operation is currently running.
  327. RUNNING = 2;
  328. // The operation is done, either cancelled or completed.
  329. DONE = 3;
  330. }
  331. // Operation type.
  332. enum Type {
  333. // Not set.
  334. TYPE_UNSPECIFIED = 0;
  335. // Cluster create.
  336. CREATE_CLUSTER = 1;
  337. // Cluster delete.
  338. DELETE_CLUSTER = 2;
  339. // A master upgrade.
  340. UPGRADE_MASTER = 3;
  341. // A node upgrade.
  342. UPGRADE_NODES = 4;
  343. // Cluster repair.
  344. REPAIR_CLUSTER = 5;
  345. // Cluster update.
  346. UPDATE_CLUSTER = 6;
  347. // Node pool create.
  348. CREATE_NODE_POOL = 7;
  349. // Node pool delete.
  350. DELETE_NODE_POOL = 8;
  351. }
  352. // The server-assigned ID for the operation.
  353. string name = 1;
  354. // The name of the Google Compute Engine
  355. // [zone](/compute/docs/zones#available) in which the operation
  356. // is taking place.
  357. string zone = 2;
  358. // The operation type.
  359. Type operation_type = 3;
  360. // The current status of the operation.
  361. Status status = 4;
  362. // Detailed operation progress, if available.
  363. string detail = 8;
  364. // If an error has occurred, a textual description of the error.
  365. string status_message = 5;
  366. // Server-defined URL for the resource.
  367. string self_link = 6;
  368. // Server-defined URL for the target of the operation.
  369. string target_link = 7;
  370. }
  371. // CreateClusterRequest creates a cluster.
  372. message CreateClusterRequest {
  373. // The Google Developers Console [project ID or project
  374. // number](https://support.google.com/cloud/answer/6158840).
  375. string project_id = 1;
  376. // The name of the Google Compute Engine
  377. // [zone](/compute/docs/zones#available) in which the cluster
  378. // resides.
  379. string zone = 2;
  380. // A [cluster resource](/container-engine/reference/rest/v1/projects.zones.clusters)
  381. Cluster cluster = 3;
  382. }
  383. // GetClusterRequest gets the settings of a cluster.
  384. message GetClusterRequest {
  385. // The Google Developers Console [project ID or project
  386. // number](https://support.google.com/cloud/answer/6158840).
  387. string project_id = 1;
  388. // The name of the Google Compute Engine
  389. // [zone](/compute/docs/zones#available) in which the cluster
  390. // resides.
  391. string zone = 2;
  392. // The name of the cluster to retrieve.
  393. string cluster_id = 3;
  394. }
  395. // UpdateClusterRequest updates the settings of a cluster.
  396. message UpdateClusterRequest {
  397. // The Google Developers Console [project ID or project
  398. // number](https://support.google.com/cloud/answer/6158840).
  399. string project_id = 1;
  400. // The name of the Google Compute Engine
  401. // [zone](/compute/docs/zones#available) in which the cluster
  402. // resides.
  403. string zone = 2;
  404. // The name of the cluster to upgrade.
  405. string cluster_id = 3;
  406. // A description of the update.
  407. ClusterUpdate update = 4;
  408. }
  409. // DeleteClusterRequest deletes a cluster.
  410. message DeleteClusterRequest {
  411. // The Google Developers Console [project ID or project
  412. // number](https://support.google.com/cloud/answer/6158840).
  413. string project_id = 1;
  414. // The name of the Google Compute Engine
  415. // [zone](/compute/docs/zones#available) in which the cluster
  416. // resides.
  417. string zone = 2;
  418. // The name of the cluster to delete.
  419. string cluster_id = 3;
  420. }
  421. // ListClustersRequest lists clusters.
  422. message ListClustersRequest {
  423. // The Google Developers Console [project ID or project
  424. // number](https://support.google.com/cloud/answer/6158840).
  425. string project_id = 1;
  426. // The name of the Google Compute Engine
  427. // [zone](/compute/docs/zones#available) in which the cluster
  428. // resides, or "-" for all zones.
  429. string zone = 2;
  430. }
  431. // ListClustersResponse is the result of ListClustersRequest.
  432. message ListClustersResponse {
  433. // A list of clusters in the project in the specified zone, or
  434. // across all ones.
  435. repeated Cluster clusters = 1;
  436. // If any zones are listed here, the list of clusters returned
  437. // may be missing those zones.
  438. repeated string missing_zones = 2;
  439. }
  440. // GetOperationRequest gets a single operation.
  441. message GetOperationRequest {
  442. // The Google Developers Console [project ID or project
  443. // number](https://support.google.com/cloud/answer/6158840).
  444. string project_id = 1;
  445. // The name of the Google Compute Engine
  446. // [zone](/compute/docs/zones#available) in which the cluster
  447. // resides.
  448. string zone = 2;
  449. // The server-assigned `name` of the operation.
  450. string operation_id = 3;
  451. }
  452. // ListOperationsRequest lists operations.
  453. message ListOperationsRequest {
  454. // The Google Developers Console [project ID or project
  455. // number](https://support.google.com/cloud/answer/6158840).
  456. string project_id = 1;
  457. // The name of the Google Compute Engine [zone](/compute/docs/zones#available)
  458. // to return operations for, or `-` for all zones.
  459. string zone = 2;
  460. }
  461. // ListOperationsResponse is the result of ListOperationsRequest.
  462. message ListOperationsResponse {
  463. // A list of operations in the project in the specified zone.
  464. repeated Operation operations = 1;
  465. // If any zones are listed here, the list of operations returned
  466. // may be missing the operations from those zones.
  467. repeated string missing_zones = 2;
  468. }
  469. // Gets the current Container Engine service configuration.
  470. message GetServerConfigRequest {
  471. // The Google Developers Console [project ID or project
  472. // number](https://support.google.com/cloud/answer/6158840).
  473. string project_id = 1;
  474. // The name of the Google Compute Engine [zone](/compute/docs/zones#available)
  475. // to return operations for.
  476. string zone = 2;
  477. }
  478. // Container Engine service configuration.
  479. message ServerConfig {
  480. // Version of Kubernetes the service deploys by default.
  481. string default_cluster_version = 1;
  482. // List of valid node upgrade target versions.
  483. repeated string valid_node_versions = 3;
  484. }